diff options
| author | kylo252 <59826753+kylo252@users.noreply.github.com> | 2021-11-14 18:47:12 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-14 09:47:12 -0800 |
| commit | 4d64e8e1cc47fc6a2d25020fe5c086c6b1622215 (patch) | |
| tree | 2aafdea607b49a6f5b6a6ccdd79ff9ec8884dc29 /test/minimal_init.lua | |
| parent | fix(graphql): detect graphql.config.* files as root (#1351) (diff) | |
| download | nvim-lspconfig-4d64e8e1cc47fc6a2d25020fe5c086c6b1622215.tar nvim-lspconfig-4d64e8e1cc47fc6a2d25020fe5c086c6b1622215.tar.gz nvim-lspconfig-4d64e8e1cc47fc6a2d25020fe5c086c6b1622215.tar.bz2 nvim-lspconfig-4d64e8e1cc47fc6a2d25020fe5c086c6b1622215.tar.lz nvim-lspconfig-4d64e8e1cc47fc6a2d25020fe5c086c6b1622215.tar.xz nvim-lspconfig-4d64e8e1cc47fc6a2d25020fe5c086c6b1622215.tar.zst nvim-lspconfig-4d64e8e1cc47fc6a2d25020fe5c086c6b1622215.zip | |
feat: support using `minimal_init.lua` on windows (#1354)
* let `packpath` use the correct temp folder per platform
* use the appropriate path-separator per platform
Diffstat (limited to 'test/minimal_init.lua')
| -rw-r--r-- | test/minimal_init.lua | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/test/minimal_init.lua b/test/minimal_init.lua index fa9d0d94..39b17a98 100644 --- a/test/minimal_init.lua +++ b/test/minimal_init.lua @@ -1,8 +1,25 @@ +local on_windows = vim.loop.os_uname().version:match 'Windows' + +local function join_paths(...) + local path_sep = on_windows and '\\' or '/' + local result = table.concat({ ... }, path_sep) + return result +end + vim.cmd [[set runtimepath=$VIMRUNTIME]] -vim.cmd [[set packpath=/tmp/nvim/site]] -local package_root = '/tmp/nvim/site/pack' -local install_path = package_root .. '/packer/start/packer.nvim' +local temp_dir +if on_windows then + temp_dir = vim.loop.os_getenv 'TEMP' +else + temp_dir = '/tmp' +end + +vim.cmd('set packpath=' .. join_paths(temp_dir, 'nvim', 'site')) + +local package_root = join_paths(temp_dir, 'nvim', 'site', 'pack') +local install_path = join_paths(package_root, 'packer', 'start', 'packer.nvim') +local compile_path = join_paths(install_path, 'plugin', 'packer_compiled.lua') local function load_plugins() require('packer').startup { @@ -12,7 +29,7 @@ local function load_plugins() }, config = { package_root = package_root, - compile_path = install_path .. '/plugin/packer_compiled.lua', + compile_path = compile_path, }, } end |
