Skip to content

Commit

Permalink
fix: make minimal init and benchmark work with Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
famiu authored and lukas-reineke committed Dec 22, 2021
1 parent 47dc59e commit 758dc26
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 16 deletions.
17 changes: 11 additions & 6 deletions benchmark/startup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@
-- run from Feline top-level directory using:
-- env AK_PROFILER=1 nvim --noplugin -u benchmark/startup.lua > /dev/null 2>&1 | less

local opt = vim.opt
local fn = vim.fn
local tmpdir

if vim.fn.has('win32') == 1 then
tmpdir = os.getenv('TEMP')
else
tmpdir = '/tmp'
end

-- Automatically install profiler.nvim if it doesn't exist
if not pcall(require, 'profiler') then
local install_path = '/tmp/nvim/site/pack/feline/start/profiler.nvim'
local install_path = tmpdir .. '/nvim/site/pack/feline/start/profiler.nvim'

opt.packpath:append('/tmp/nvim/site')
vim.opt.packpath:append(tmpdir .. '/nvim/site')

if fn.isdirectory(install_path) == 0 then
fn.system({'git', 'clone', 'https://github.com/norcalli/profiler.nvim', install_path})
if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system({'git', 'clone', 'https://github.com/norcalli/profiler.nvim', install_path})
end
end

Expand Down
18 changes: 11 additions & 7 deletions benchmark/statusline.lua
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
-- Feline statusline generation benchmark test
-- Start Neovim with Feline installed and configured and source this file using the luafile command

local opt = vim.opt
local fn = vim.fn
local tmpdir

if vim.fn.has('win32') == 1 then
tmpdir = os.getenv('TEMP')
else
tmpdir = '/tmp'
end

-- Automatically install plenary.nvim if it doesn't exist
if not pcall(require, 'plenary.benchmark') then
local install_path = '/tmp/nvim/site/pack/feline/start/plenary.nvim'
local install_path = tmpdir .. '/nvim/site/pack/feline/start/plenary.nvim'

opt.packpath:append('/tmp/nvim/site')
vim.opt.packpath:append(tmpdir .. '/nvim/site')

if fn.isdirectory(install_path) == 0 then
fn.system({'git', 'clone', 'https://github.com/nvim-lua/plenary.nvim', install_path})
if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system({'git', 'clone', 'https://github.com/nvim-lua/plenary.nvim', install_path})
end
end

Expand All @@ -32,4 +37,3 @@ benchmark("Feline statusline generation benchmark", {
}
}
})

14 changes: 11 additions & 3 deletions minimal_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@
-- Run from Feline top-level directory using:
-- nvim --noplugin -u minimal_init.lua

local tmpdir

if vim.fn.has('win32') == 1 then
tmpdir = os.getenv('TEMP')
else
tmpdir = '/tmp'
end

local function load_plugins()
local packer = require('packer')
local use = packer.use

packer.reset()
packer.init {
package_root = '/tmp/nvim/site/pack',
package_root = tmpdir .. '/nvim/site/pack',
git = {
clone_timeout = -1
}
Expand Down Expand Up @@ -46,9 +54,9 @@ _G.load_config = function()
require('feline').setup()
end

local install_path = '/tmp/nvim/site/pack/packer/start/packer.nvim'
local install_path = tmpdir .. '/nvim/site/pack/packer/start/packer.nvim'

vim.opt.packpath = {'/tmp/nvim/site'}
vim.opt.packpath = { tmpdir .. '/nvim/site'}

if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system({'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path})
Expand Down

0 comments on commit 758dc26

Please sign in to comment.