refactor : separate lspconfig setups
This commit is contained in:
parent
0b55d45845
commit
1756c92609
|
@ -57,7 +57,7 @@ M.ui = {
|
||||||
-- these are plugin related options
|
-- these are plugin related options
|
||||||
M.plugins = {
|
M.plugins = {
|
||||||
-- enable and disable plugins (false for disable)
|
-- enable and disable plugins (false for disable)
|
||||||
plugin_status = {
|
status = {
|
||||||
autosave = false, -- to autosave files
|
autosave = false, -- to autosave files
|
||||||
blankline = true, -- show code scope with symbols
|
blankline = true, -- show code scope with symbols
|
||||||
bufferline = true, -- list open buffers up the top, easy switching too
|
bufferline = true, -- list open buffers up the top, easy switching too
|
||||||
|
@ -76,7 +76,7 @@ M.plugins = {
|
||||||
},
|
},
|
||||||
options = {
|
options = {
|
||||||
lspconfig = {
|
lspconfig = {
|
||||||
servers = {}, -- eg: "html"
|
setup_lspconf = "", -- path of file containing setups of different lsps
|
||||||
},
|
},
|
||||||
nvimtree = {
|
nvimtree = {
|
||||||
enable_git = 0,
|
enable_git = 0,
|
||||||
|
|
|
@ -57,21 +57,6 @@ capabilities.textDocument.completion.completionItem.resolveSupport = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local servers = require("core.utils").load_config().plugins.options.lspconfig.servers
|
|
||||||
|
|
||||||
for _, lsp in ipairs(servers) do
|
|
||||||
nvim_lsp[lsp].setup {
|
|
||||||
on_attach = on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
-- root_dir = vim.loop.cwd,
|
|
||||||
flags = {
|
|
||||||
debounce_text_changes = 150,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
-- require("anyfile").setup_luaLsp(on_attach, capabilities) -- this will be removed soon after the custom hooks PR
|
|
||||||
|
|
||||||
-- replace the default lsp diagnostic symbols
|
-- replace the default lsp diagnostic symbols
|
||||||
local function lspSymbol(name, icon)
|
local function lspSymbol(name, icon)
|
||||||
vim.fn.sign_define("LspDiagnosticsSign" .. name, { text = icon, numhl = "LspDiagnosticsDefault" .. name })
|
vim.fn.sign_define("LspDiagnosticsSign" .. name, { text = icon, numhl = "LspDiagnosticsDefault" .. name })
|
||||||
|
@ -113,3 +98,11 @@ vim.notify = function(msg, log_level, _opts)
|
||||||
vim.api.nvim_echo({ { msg } }, true, {})
|
vim.api.nvim_echo({ { msg } }, true, {})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- requires a file containing user's lspconfigs
|
||||||
|
|
||||||
|
local addlsp_confs = require("core.utils").load_config().plugins.options.lspconfig.setup_lspconf
|
||||||
|
|
||||||
|
if string.len(addlsp_confs) ~= 0 then
|
||||||
|
require(addlsp_confs).setup_lsp(on_attach, capabilities)
|
||||||
|
end
|
||||||
|
|
|
@ -11,7 +11,7 @@ vim.o.termguicolors = true
|
||||||
|
|
||||||
g.nvim_tree_add_trailing = 0 -- append a trailing slash to folder names
|
g.nvim_tree_add_trailing = 0 -- append a trailing slash to folder names
|
||||||
g.nvim_tree_git_hl = git_status
|
g.nvim_tree_git_hl = git_status
|
||||||
g.nvim_tree_gitignore = git_status
|
g.nvim_tree_gitignore = 0
|
||||||
g.nvim_tree_hide_dotfiles = 0
|
g.nvim_tree_hide_dotfiles = 0
|
||||||
g.nvim_tree_highlight_opened_files = 0
|
g.nvim_tree_highlight_opened_files = 0
|
||||||
g.nvim_tree_indent_markers = 1
|
g.nvim_tree_indent_markers = 1
|
||||||
|
|
|
@ -7,7 +7,7 @@ end
|
||||||
local use = packer.use
|
local use = packer.use
|
||||||
|
|
||||||
return packer.startup(function()
|
return packer.startup(function()
|
||||||
local plugin_status = require("core.utils").load_config().plugins.plugin_status
|
local status = require("core.utils").load_config().plugins.status
|
||||||
|
|
||||||
-- FUNCTION: override_req, use `chadrc` plugin config override if present
|
-- FUNCTION: override_req, use `chadrc` plugin config override if present
|
||||||
-- name = name inside `default_config` / `chadrc`
|
-- name = name inside `default_config` / `chadrc`
|
||||||
|
@ -64,14 +64,14 @@ return packer.startup(function()
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"famiu/feline.nvim",
|
"famiu/feline.nvim",
|
||||||
disable = not plugin_status.feline,
|
disable = not status.feline,
|
||||||
after = "nvim-web-devicons",
|
after = "nvim-web-devicons",
|
||||||
config = override_req("feline", "plugins.configs.statusline"),
|
config = override_req("feline", "plugins.configs.statusline"),
|
||||||
}
|
}
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"akinsho/bufferline.nvim",
|
"akinsho/bufferline.nvim",
|
||||||
disable = not plugin_status.bufferline,
|
disable = not status.bufferline,
|
||||||
after = "nvim-web-devicons",
|
after = "nvim-web-devicons",
|
||||||
config = override_req("bufferline", "plugins.configs.bufferline"),
|
config = override_req("bufferline", "plugins.configs.bufferline"),
|
||||||
setup = function()
|
setup = function()
|
||||||
|
@ -81,14 +81,14 @@ return packer.startup(function()
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"lukas-reineke/indent-blankline.nvim",
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
disable = not plugin_status.blankline,
|
disable = not status.blankline,
|
||||||
event = "BufRead",
|
event = "BufRead",
|
||||||
config = override_req("indent_blankline", "(plugins.configs.others).blankline()"),
|
config = override_req("indent_blankline", "(plugins.configs.others).blankline()"),
|
||||||
}
|
}
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"norcalli/nvim-colorizer.lua",
|
"norcalli/nvim-colorizer.lua",
|
||||||
disable = not plugin_status.colorizer,
|
disable = not status.colorizer,
|
||||||
event = "BufRead",
|
event = "BufRead",
|
||||||
config = override_req("nvim_colorizer", "(plugins.configs.others).colorizer()"),
|
config = override_req("nvim_colorizer", "(plugins.configs.others).colorizer()"),
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ return packer.startup(function()
|
||||||
-- git stuff
|
-- git stuff
|
||||||
use {
|
use {
|
||||||
"lewis6991/gitsigns.nvim",
|
"lewis6991/gitsigns.nvim",
|
||||||
disable = not plugin_status.gitsigns,
|
disable = not status.gitsigns,
|
||||||
opt = true,
|
opt = true,
|
||||||
config = override_req("gitsigns", "plugins.configs.gitsigns"),
|
config = override_req("gitsigns", "plugins.configs.gitsigns"),
|
||||||
setup = function()
|
setup = function()
|
||||||
|
@ -114,7 +114,7 @@ return packer.startup(function()
|
||||||
-- smooth scroll
|
-- smooth scroll
|
||||||
use {
|
use {
|
||||||
"karb94/neoscroll.nvim",
|
"karb94/neoscroll.nvim",
|
||||||
disable = not plugin_status.neoscroll,
|
disable = not status.neoscroll,
|
||||||
opt = true,
|
opt = true,
|
||||||
config = override_req("neoscroll", "(plugins.configs.others).neoscroll()"),
|
config = override_req("neoscroll", "(plugins.configs.others).neoscroll()"),
|
||||||
setup = function()
|
setup = function()
|
||||||
|
@ -139,14 +139,14 @@ return packer.startup(function()
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"ray-x/lsp_signature.nvim",
|
"ray-x/lsp_signature.nvim",
|
||||||
disable = not plugin_status.lspsignature,
|
disable = not status.lspsignature,
|
||||||
after = "nvim-lspconfig",
|
after = "nvim-lspconfig",
|
||||||
config = override_req("signature", "(plugins.configs.others).signature()"),
|
config = override_req("signature", "(plugins.configs.others).signature()"),
|
||||||
}
|
}
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"andymass/vim-matchup",
|
"andymass/vim-matchup",
|
||||||
disable = not plugin_status.vim_matchup,
|
disable = not status.vim_matchup,
|
||||||
opt = true,
|
opt = true,
|
||||||
setup = function()
|
setup = function()
|
||||||
require("core.utils").packer_lazy_load "vim-matchup"
|
require("core.utils").packer_lazy_load "vim-matchup"
|
||||||
|
@ -155,7 +155,7 @@ return packer.startup(function()
|
||||||
|
|
||||||
-- load autosave only if its globally enabled
|
-- load autosave only if its globally enabled
|
||||||
use {
|
use {
|
||||||
disable = not plugin_status.autosave,
|
disable = not status.autosave,
|
||||||
"Pocco81/AutoSave.nvim",
|
"Pocco81/AutoSave.nvim",
|
||||||
config = override_req("autosave", "(plugins.configs.others).autosave()"),
|
config = override_req("autosave", "(plugins.configs.others).autosave()"),
|
||||||
cond = function()
|
cond = function()
|
||||||
|
@ -165,7 +165,7 @@ return packer.startup(function()
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"max397574/better-escape.nvim",
|
"max397574/better-escape.nvim",
|
||||||
disable = not plugin_status.esc_insertmode,
|
disable = not status.esc_insertmode,
|
||||||
event = "InsertEnter",
|
event = "InsertEnter",
|
||||||
config = override_req("better_escape", "(plugins.configs.others).better_escape()"),
|
config = override_req("better_escape", "(plugins.configs.others).better_escape()"),
|
||||||
}
|
}
|
||||||
|
@ -174,20 +174,20 @@ return packer.startup(function()
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"rafamadriz/friendly-snippets",
|
"rafamadriz/friendly-snippets",
|
||||||
disable = not plugin_status.cmp,
|
disable = not status.cmp,
|
||||||
event = "InsertEnter",
|
event = "InsertEnter",
|
||||||
}
|
}
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"hrsh7th/nvim-cmp",
|
"hrsh7th/nvim-cmp",
|
||||||
disable = not plugin_status.cmp,
|
disable = not status.cmp,
|
||||||
after = "friendly-snippets",
|
after = "friendly-snippets",
|
||||||
config = override_req("nvim_cmp", "plugins.configs.cmp"),
|
config = override_req("nvim_cmp", "plugins.configs.cmp"),
|
||||||
}
|
}
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"L3MON4D3/LuaSnip",
|
"L3MON4D3/LuaSnip",
|
||||||
disable = not plugin_status.cmp,
|
disable = not status.cmp,
|
||||||
wants = "friendly-snippets",
|
wants = "friendly-snippets",
|
||||||
after = "nvim-cmp",
|
after = "nvim-cmp",
|
||||||
config = override_req("luasnip", "(plugins.configs.others).luasnip()"),
|
config = override_req("luasnip", "(plugins.configs.others).luasnip()"),
|
||||||
|
@ -195,44 +195,44 @@ return packer.startup(function()
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"saadparwaiz1/cmp_luasnip",
|
"saadparwaiz1/cmp_luasnip",
|
||||||
disable = not plugin_status.cmp,
|
disable = not status.cmp,
|
||||||
after = "LuaSnip",
|
after = "LuaSnip",
|
||||||
}
|
}
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"hrsh7th/cmp-nvim-lua",
|
"hrsh7th/cmp-nvim-lua",
|
||||||
disable = not plugin_status.cmp,
|
disable = not status.cmp,
|
||||||
after = "cmp_luasnip",
|
after = "cmp_luasnip",
|
||||||
}
|
}
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
disable = not plugin_status.cmp,
|
disable = not status.cmp,
|
||||||
after = "cmp-nvim-lua",
|
after = "cmp-nvim-lua",
|
||||||
}
|
}
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"hrsh7th/cmp-buffer",
|
"hrsh7th/cmp-buffer",
|
||||||
disable = not plugin_status.cmp,
|
disable = not status.cmp,
|
||||||
after = "cmp-nvim-lsp",
|
after = "cmp-nvim-lsp",
|
||||||
}
|
}
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"hrsh7th/cmp-path",
|
"hrsh7th/cmp-path",
|
||||||
disable = not plugin_status.cmp,
|
disable = not status.cmp,
|
||||||
after = "cmp-buffer",
|
after = "cmp-buffer",
|
||||||
}
|
}
|
||||||
-- misc plugins
|
-- misc plugins
|
||||||
use {
|
use {
|
||||||
"windwp/nvim-autopairs",
|
"windwp/nvim-autopairs",
|
||||||
disable = not plugin_status.cmp,
|
disable = not status.cmp,
|
||||||
after = "nvim-cmp",
|
after = "nvim-cmp",
|
||||||
config = override_req("nvim_autopairs", "(plugins.configs.others).autopairs()"),
|
config = override_req("nvim_autopairs", "(plugins.configs.others).autopairs()"),
|
||||||
}
|
}
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"glepnir/dashboard-nvim",
|
"glepnir/dashboard-nvim",
|
||||||
disable = not plugin_status.dashboard,
|
disable = not status.dashboard,
|
||||||
config = override_req("dashboard", "plugins.configs.dashboard"),
|
config = override_req("dashboard", "plugins.configs.dashboard"),
|
||||||
setup = function()
|
setup = function()
|
||||||
require("core.mappings").dashboard()
|
require("core.mappings").dashboard()
|
||||||
|
@ -241,7 +241,7 @@ return packer.startup(function()
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"terrortylor/nvim-comment",
|
"terrortylor/nvim-comment",
|
||||||
disable = not plugin_status.comment,
|
disable = not status.comment,
|
||||||
cmd = "CommentToggle",
|
cmd = "CommentToggle",
|
||||||
config = override_req("nvim_comment", "(plugins.configs.others).comment()"),
|
config = override_req("nvim_comment", "(plugins.configs.others).comment()"),
|
||||||
setup = function()
|
setup = function()
|
||||||
|
@ -270,7 +270,7 @@ return packer.startup(function()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nvim-telescope/telescope-media-files.nvim",
|
"nvim-telescope/telescope-media-files.nvim",
|
||||||
disable = not plugin_status.telescope_media,
|
disable = not status.telescope_media,
|
||||||
setup = function()
|
setup = function()
|
||||||
require("core.mappings").telescope_media()
|
require("core.mappings").telescope_media()
|
||||||
end,
|
end,
|
||||||
|
@ -284,7 +284,7 @@ return packer.startup(function()
|
||||||
|
|
||||||
use {
|
use {
|
||||||
"Pocco81/TrueZen.nvim",
|
"Pocco81/TrueZen.nvim",
|
||||||
disable = not plugin_status.truezen,
|
disable = not status.truezen,
|
||||||
cmd = {
|
cmd = {
|
||||||
"TZAtaraxis",
|
"TZAtaraxis",
|
||||||
"TZMinimalist",
|
"TZMinimalist",
|
||||||
|
|
Loading…
Reference in New Issue