From 7a2a5fc810e6eaef185d9b0023b598a83c29d93e Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sun, 31 Oct 2021 11:15:50 +0100 Subject: feat: add support for using minimal_lsp on windows (#1882) --- tests/minimal_lsp.lua | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'tests/minimal_lsp.lua') 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 -- cgit v1.2.3