mirror of
https://github.com/CompeyDev/my-nvim-setup.git
synced 2024-12-13 13:30:41 +00:00
parent
5d4c51127c
commit
a83ebc34e5
7 changed files with 64 additions and 65 deletions
|
@ -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
|
-- commands
|
||||||
vim.cmd "silent! command! NvChadUpdate lua require('nvchad').update_nvchad()"
|
vim.cmd "silent! command! NvChadUpdate lua require('nvchad').update_nvchad()"
|
||||||
vim.cmd "silent! command! NvChadSnapshotCreate lua require('nvchad').snap_create()"
|
vim.cmd "silent! command! NvChadSnapshotCreate lua require('nvchad').snap_create()"
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
local autocmd = vim.api.nvim_create_autocmd
|
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
|
-- This must be used for plugins that need to be loaded just after a file
|
||||||
-- ex : treesitter, lspconfig etc
|
-- ex : treesitter, lspconfig etc
|
||||||
M.lazy_load = function(tb)
|
M.lazy_load = function(tb)
|
||||||
autocmd(tb.events, {
|
autocmd(tb.events, {
|
||||||
pattern = "*",
|
|
||||||
group = vim.api.nvim_create_augroup(tb.augroup_name, {}),
|
group = vim.api.nvim_create_augroup(tb.augroup_name, {}),
|
||||||
callback = function()
|
callback = function()
|
||||||
if tb.condition() then
|
if tb.condition() then
|
||||||
|
@ -13,12 +13,15 @@ M.lazy_load = function(tb)
|
||||||
|
|
||||||
-- dont defer for treesitter as it will show slow highlighting
|
-- dont defer for treesitter as it will show slow highlighting
|
||||||
-- This deferring only happens only when we do "nvim filename"
|
-- 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.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)
|
end, 0)
|
||||||
else
|
else
|
||||||
vim.cmd("PackerLoad " .. tb.plugins)
|
require("packer").loader(tb.plugin)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
@ -33,7 +36,7 @@ M.on_file_open = function(plugin_name)
|
||||||
M.lazy_load {
|
M.lazy_load {
|
||||||
events = { "BufRead", "BufWinEnter", "BufNewFile" },
|
events = { "BufRead", "BufWinEnter", "BufNewFile" },
|
||||||
augroup_name = "BeLazyOnFileOpen" .. plugin_name,
|
augroup_name = "BeLazyOnFileOpen" .. plugin_name,
|
||||||
plugins = plugin_name,
|
plugin = plugin_name,
|
||||||
condition = function()
|
condition = function()
|
||||||
local file = vim.fn.expand "%"
|
local file = vim.fn.expand "%"
|
||||||
return file ~= "NvimTree_1" and file ~= "[packer]" and file ~= ""
|
return file ~= "NvimTree_1" and file ~= "[packer]" and file ~= ""
|
||||||
|
@ -41,22 +44,6 @@ M.on_file_open = function(plugin_name)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- lspinstaller & lspconfig cmds for lazyloading
|
|
||||||
M.lsp_cmds = {
|
|
||||||
"LspInfo",
|
|
||||||
"LspStart",
|
|
||||||
"LspRestart",
|
|
||||||
"LspStop",
|
|
||||||
"LspInstall",
|
|
||||||
"LspUnInstall",
|
|
||||||
"LspUnInstallAll",
|
|
||||||
"LspInstall",
|
|
||||||
"LspInstallInfo",
|
|
||||||
"LspInstallLog",
|
|
||||||
"LspLog",
|
|
||||||
"LspPrintInstalled",
|
|
||||||
}
|
|
||||||
|
|
||||||
M.treesitter_cmds = {
|
M.treesitter_cmds = {
|
||||||
"TSInstall",
|
"TSInstall",
|
||||||
"TSBufEnable",
|
"TSBufEnable",
|
||||||
|
@ -66,6 +53,14 @@ M.treesitter_cmds = {
|
||||||
"TSModuleInfo",
|
"TSModuleInfo",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
M.mason_cmds = {
|
||||||
|
"Mason",
|
||||||
|
"MasonInstall",
|
||||||
|
"MasonUninstall",
|
||||||
|
"MasonUninstallAll",
|
||||||
|
"MasonLog",
|
||||||
|
}
|
||||||
|
|
||||||
M.gitsigns = function()
|
M.gitsigns = function()
|
||||||
-- taken from https://github.com/max397574
|
-- taken from https://github.com/max397574
|
||||||
autocmd({ "BufRead" }, {
|
autocmd({ "BufRead" }, {
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
local present, lsp_installer = pcall(require, "nvim-lsp-installer")
|
|
||||||
|
|
||||||
if not present then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local options = {
|
|
||||||
-- ensure_installed is not needed as automatic_installation is enabled
|
|
||||||
-- then any lsp server you setup by lspconfig is going to get installed automatically!
|
|
||||||
|
|
||||||
-- ensure_installed = { "lua" },
|
|
||||||
automatic_installation = true,
|
|
||||||
|
|
||||||
ui = {
|
|
||||||
icons = {
|
|
||||||
server_installed = " ",
|
|
||||||
server_pending = " ",
|
|
||||||
server_uninstalled = " ﮊ",
|
|
||||||
},
|
|
||||||
keymaps = {
|
|
||||||
toggle_server_expand = "<CR>",
|
|
||||||
install_server = "i",
|
|
||||||
update_server = "u",
|
|
||||||
check_server_version = "c",
|
|
||||||
update_all_servers = "U",
|
|
||||||
check_outdated_servers = "C",
|
|
||||||
uninstall_server = "X",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
max_concurrent_installers = 10,
|
|
||||||
}
|
|
||||||
|
|
||||||
options = require("core.utils").load_override(options, "williamboman/nvim-lsp-installer")
|
|
||||||
|
|
||||||
lsp_installer.setup(options)
|
|
|
@ -6,7 +6,6 @@ end
|
||||||
|
|
||||||
require("base46").load_highlight "lsp"
|
require("base46").load_highlight "lsp"
|
||||||
require "nvchad_ui.lsp"
|
require "nvchad_ui.lsp"
|
||||||
require "plugins.configs.lsp_installer"
|
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
local utils = require "core.utils"
|
local utils = require "core.utils"
|
||||||
|
|
36
lua/plugins/configs/mason.lua
Normal file
36
lua/plugins/configs/mason.lua
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
local present, mason = pcall(require, "mason")
|
||||||
|
|
||||||
|
if not present then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
require("base46").load_highlight "mason"
|
||||||
|
|
||||||
|
local options = {
|
||||||
|
ensure_installed = { "pyright" },
|
||||||
|
|
||||||
|
ui = {
|
||||||
|
icons = {
|
||||||
|
package_pending = " ",
|
||||||
|
package_installed = " ",
|
||||||
|
package_uninstalled = " ﮊ",
|
||||||
|
},
|
||||||
|
|
||||||
|
keymaps = {
|
||||||
|
toggle_server_expand = "<CR>",
|
||||||
|
install_server = "i",
|
||||||
|
update_server = "u",
|
||||||
|
check_server_version = "c",
|
||||||
|
update_all_servers = "U",
|
||||||
|
check_outdated_servers = "C",
|
||||||
|
uninstall_server = "X",
|
||||||
|
cancel_installation = "<C-c>",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
max_concurrent_installers = 10,
|
||||||
|
}
|
||||||
|
|
||||||
|
options = require("core.utils").load_override(options, "williamboman/mason")
|
||||||
|
|
||||||
|
mason.setup(options)
|
|
@ -49,7 +49,7 @@ M.blankline = function()
|
||||||
"lspinfo",
|
"lspinfo",
|
||||||
"TelescopePrompt",
|
"TelescopePrompt",
|
||||||
"TelescopeResults",
|
"TelescopeResults",
|
||||||
"lsp-installer",
|
"Mason",
|
||||||
"",
|
"",
|
||||||
},
|
},
|
||||||
buftype_exclude = { "terminal" },
|
buftype_exclude = { "terminal" },
|
||||||
|
|
|
@ -82,16 +82,18 @@ local plugins = {
|
||||||
|
|
||||||
-- lsp stuff
|
-- lsp stuff
|
||||||
|
|
||||||
["williamboman/nvim-lsp-installer"] = {
|
["williamboman/mason.nvim"] = {
|
||||||
cmd = require("core.lazy_load").lsp_cmds,
|
cmd = require("core.lazy_load").mason_cmds,
|
||||||
setup = function()
|
config = function()
|
||||||
require("core.lazy_load").on_file_open "nvim-lsp-installer"
|
require "plugins.configs.mason"
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
["neovim/nvim-lspconfig"] = {
|
["neovim/nvim-lspconfig"] = {
|
||||||
after = "nvim-lsp-installer",
|
opt = true,
|
||||||
module = "lspconfig",
|
setup = function()
|
||||||
|
require("core.lazy_load").on_file_open "nvim-lspconfig"
|
||||||
|
end,
|
||||||
config = function()
|
config = function()
|
||||||
require "plugins.configs.lspconfig"
|
require "plugins.configs.lspconfig"
|
||||||
end,
|
end,
|
||||||
|
|
Loading…
Reference in a new issue