diff options
author | kylo252 <[email protected]> | 2021-10-31 11:15:50 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-10-31 11:15:50 +0100 |
commit | 7a2a5fc810e6eaef185d9b0023b598a83c29d93e (patch) | |
tree | a352aca1fdd939812754a8e20bc2440c2cf7a3ea /tests | |
parent | 61a2e0b1912a0c66ec6be8df464396c5de9eac5e (diff) |
feat: add support for using minimal_lsp on windows (#1882)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/minimal_lsp.lua | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/tests/minimal_lsp.lua b/tests/minimal_lsp.lua index a2b9ab57..9873e5ef 100644 --- a/tests/minimal_lsp.lua +++ b/tests/minimal_lsp.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") -- Choose whether to use the executable that's managed by lsp-installer local use_lsp_installer = true @@ -16,7 +33,7 @@ local function load_plugins() }, config = { package_root = package_root, - compile_path = install_path .. "/plugin/packer_compiled.lua", + compile_path = compile_path, }, } end |