Created
January 26, 2022 12:35
-
-
Save glyh/721e63d750efa2e6066e270ec0f46580 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- this template is borrowed from nvim-lspconfig | |
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]]) | |
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 config_lsp() | |
local lspconfig = require('lspconfig') | |
lspconfig.cl_lsp.setup {} | |
lspconfig.pyright.setup {} -- For Constrast | |
end | |
local function config_cmp() | |
local cmp = require("cmp") | |
cmp.setup({ | |
-- snippet = { }, | |
-- mapping = { }, | |
sources = cmp.config.sources({ | |
{ name = 'nvim_lsp' }, | |
}, { }) | |
}) | |
end | |
local function load_plugins() | |
-- only add other plugins if they are necessary to reproduce the issue | |
require("packer").startup({ | |
{ | |
"wbthomason/packer.nvim", -- Package manager | |
{ 'hrsh7th/nvim-cmp', config = config_cmp }, -- Completion | |
'hrsh7th/cmp-nvim-lsp', -- Completion LSP integration | |
{ 'glyh/nvim-lspconfig', branch = 'feat/add-cl-lsp', config = config_lsp } -- LSP configuration | |
}, | |
config = { | |
package_root = package_root, | |
compile_path = compile_path, | |
}, | |
}) | |
end | |
if vim.fn.isdirectory(install_path) == 0 then | |
vim.fn.system({ "git", "clone", "https://github.com/wbthomason/packer.nvim", install_path }) | |
load_plugins() | |
require("packer").sync() | |
else | |
load_plugins() | |
require("packer").sync() | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment