Breaking Change : LSPInstaller is dead so use mason.nvim

(#1368)
This commit is contained in:
siduck 2022-07-25 13:49:33 +00:00
parent 5d4c51127c
commit a83ebc34e5
7 changed files with 64 additions and 65 deletions

View file

@ -1,3 +1,6 @@
-- add binaries installed by mason.nvim to path
vim.env.PATH = vim.env.PATH .. ":" .. vim.fn.stdpath "data" .. "/mason/bin"
-- commands
vim.cmd "silent! command! NvChadUpdate lua require('nvchad').update_nvchad()"
vim.cmd "silent! command! NvChadSnapshotCreate lua require('nvchad').snap_create()"

View file

@ -1,11 +1,11 @@
local M = {}
local autocmd = vim.api.nvim_create_autocmd
-- require("packer").loader(tb.plugins)
-- This must be used for plugins that need to be loaded just after a file
-- ex : treesitter, lspconfig etc
M.lazy_load = function(tb)
autocmd(tb.events, {
pattern = "*",
group = vim.api.nvim_create_augroup(tb.augroup_name, {}),
callback = function()
if tb.condition() then
@ -13,12 +13,15 @@ M.lazy_load = function(tb)
-- dont defer for treesitter as it will show slow highlighting
-- This deferring only happens only when we do "nvim filename"
if tb.plugins ~= "nvim-treesitter" then
if tb.plugin ~= "nvim-treesitter" then
vim.defer_fn(function()
vim.cmd("PackerLoad " .. tb.plugins)
require("packer").loader(tb.plugin)
if tb.plugin == "nvim-lspconfig" then
vim.cmd "silent! e %"
end
end, 0)
else
vim.cmd("PackerLoad " .. tb.plugins)
require("packer").loader(tb.plugin)
end
end
end,
@ -33,7 +36,7 @@ M.on_file_open = function(plugin_name)
M.lazy_load {
events = { "BufRead", "BufWinEnter", "BufNewFile" },
augroup_name = "BeLazyOnFileOpen" .. plugin_name,
plugins = plugin_name,
plugin = plugin_name,
condition = function()
local file = vim.fn.expand "%"
return file ~= "NvimTree_1" and file ~= "[packer]" and file ~= ""
@ -41,22 +44,6 @@ M.on_file_open = function(plugin_name)
}
end
-- lspinstaller & lspconfig cmds for lazyloading
M.lsp_cmds = {
"LspInfo",
"LspStart",
"LspRestart",
"LspStop",
"LspInstall",
"LspUnInstall",
"LspUnInstallAll",
"LspInstall",
"LspInstallInfo",
"LspInstallLog",
"LspLog",
"LspPrintInstalled",
}
M.treesitter_cmds = {
"TSInstall",
"TSBufEnable",
@ -66,6 +53,14 @@ M.treesitter_cmds = {
"TSModuleInfo",
}
M.mason_cmds = {
"Mason",
"MasonInstall",
"MasonUninstall",
"MasonUninstallAll",
"MasonLog",
}
M.gitsigns = function()
-- taken from https://github.com/max397574
autocmd({ "BufRead" }, {