LSP no lsp autostart, improved utils

navigator
spike 2 years ago
parent 773778e024
commit 1ced81e035

@ -45,7 +45,7 @@ M.general = { --{{{
-- quit dont save
["<leader>qq"] = { "<cmd> quitall! <cr>", "quit/close all windows, don't save" },
["Q"] = { "<cmd> q!<cr>", "quit now" },
-- ["Q"] = { "<cmd> q!<cr>", "quit now" },
-- easier horizontal scrolling
["zl"] = { "zL", "horizontal scroll left" },
@ -170,12 +170,17 @@ M.general = { --{{{
},
-- TODO: move to lspconfig section
-- ["<leader>lsp"] = { "<cmd> lua require('custom.plugins.configs.navigator').enable()<CR>", "lsp enable"},
["<leader>lsp"] = { "<cmd> LspStart<CR>", "lsp enable"},
["<leader>lst"] = { "<cmd> LspStop<CR>", "lsp disable"},
---------------
-- Programming languages specifics
---------------
-- luadev
["<leader>ls"] = {"<cmd>Luadev<CR>", "Luadev scratch window"},
["<leader>lsc"] = {"<cmd>Luadev<CR>", "Luadev scratch window"},
["<leader>ll"] = {"<Plug>(Luadev-RunLine)", "Luadev Run Line"},
["<leader>lr"] = {"<Plug>(Luadev-Run)", "Luadev Run over movement or text object"},
["<leader>lw"] = {"<Plug>(Luadev-RunWord)", "Luadev Run word under cursor"},
@ -264,7 +269,8 @@ M.comment = { --{{{
n = {
["<leader>/"] = {
function()
require("Comment.api").toggle.linewise.current()
-- require("Comment.api").toggle.linewise.current()
vim.notify("use gcc !")
end,
"toggle comment",
},
@ -575,7 +581,8 @@ M.blankline = { --{{{
M.navigator = {--{{{
plugin = true,
n = {
["<Right>"] = { "<cmd> TSymbols <CR><C-w>h", "toggle TreeSitter symbols " },
["<Right>"] = { "<cmd> lua require'navigator.treesitter'.side_panel()<CR><C-w>h", "toggle TreeSitter symbols panel " },
["<M-Right>"] = { "<cmd> lua require'navigator.symbols'.side_panel()<CR><C-w>h", "toggle LSP symbols panel" },
}
}--}}}
@ -598,4 +605,13 @@ M.asyncrun = { --{{{
},
} --}}}
-- M.neorepl = {
-- plugin = true,
--
-- i = {
-- ["C-p"] = { "<Plug>(neorepl-hist-prev)"},
-- }
--
-- }
return M

@ -5,28 +5,36 @@ if not present then
end
M = {}
local config = {
-- debug = true,
transparency = nil,
transparency = 5,
lsp_signature_help = true,
default_mapping = true,
icons = {
icons = true, -- set to false to use system default ( if you using a terminal does not have nerd/icon)
-- Code action
code_action_icon = ' ', -- "",
code_action_icon = '', -- "",
-- code lens
code_lens_action_icon = '👓',
code_lens_action_icon = '',
-- Diagnostics
diagnostic_head = '🐛',
diagnostic_err = '📛',
diagnostic_warn = '👎',
diagnostic_info = [[👩]],
diagnostic_hint = [[💁]],
diagnostic_head = '', -- default diagnostic head on dialogs
diagnostic_err = '', -- severity 1
diagnostic_warn = '', -- 2
diagnostic_info = '', -- 3
diagnostic_hint = '', -- 4
diagnostic_head_severity_1 = '🈲',
diagnostic_head_severity_2 = '☣️',
diagnostic_head_severity_3 = '👎',
diagnostic_head_description = '👹',
diagnostic_virtual_text = '🦊',
-- used in the diagnostics summary window
diagnostic_head_severity_1 = '',
diagnostic_head_severity_2 = '',
diagnostic_head_severity_3 = 'i',
diagnostic_head_description = ' ',
diagnostic_virtual_text = '',
diagnostic_file = '🚑',
-- Values
value_changed = '📝',
@ -61,7 +69,42 @@ local config = {
mason = true,
format_on_save = false, -- applies to all formatting feature of neovim
-- including auto-fold
diagnostic = {
underline = true,
virtual_text = {
spacing = 3,
source = true
}, -- show virtual for diagnostic message
update_in_insert = false, -- update diagnostic message in insert mode
severity_sort = { reverse = true },
},
-- disable_lsp = {"sqls"},
-- disable auto start of lsp per language
-- set global default on lspconfig (see lspconfig doc)
-- ["lua-dev"] = {
-- autostart = false,
-- }
}
}
navigator.setup(config)
M.setup = function()
navigator.setup(config)
end
M.enable = function()
local lspconfig = require("lspconfig")
lspconfig.util.default_config = vim.tbl_extend(
"force",
lspconfig.util.default_config,
{
autostart = true
}
)
vim.cmd[[
LspStart
]]
end
return M

@ -69,7 +69,7 @@ return {
keys = {"s", "S"},
setup = function()
vim.cmd[[
let g:sneak#label=1
let g:sneak#s_next=1
]]
end
},
@ -113,7 +113,16 @@ return {
event = "InsertEnter",
},
["neovim/nvim-lspconfig"] = {
config = nil -- disable lspconfig, handled by navigator
config = function()
local lspconfig = require("lspconfig")
lspconfig.util.default_config = vim.tbl_extend(
"force",
lspconfig.util.default_config,
{
autostart = false
}
)
end-- disable lspconfig, handled by navigator
},
["williamboman/mason-lspconfig.nvim"] = {
requires = {"williamboman/mason.nvim", "nvim-lspconfig"},
@ -126,13 +135,17 @@ return {
--
-- ["https://git.sp4ke.xyz/sp4ke/navigator.lua"] = {
["ray-x/navigator.lua"] = {
after = "nvim-lspconfig",
after = { "nvim-lspconfig", "base46", "ui" },
requires = {"neovim/nvim-lspconfig", "ray-x/guihua.lua", "nvim-treesitter/nvim-treesitter"},
setup = function()
require("core.utils").load_mappings "navigator"
end,
config = function()
require("custom.plugins.configs.navigator")
require("custom.plugins.configs.navigator").setup()
require("base46").load_highlight "lsp"
-- TODO: use nvchadui_lsp features manually
-- require("nvchad_ui.lsp")
end
},
["ray-x/guihua.lua"] = {
@ -172,6 +185,10 @@ return {
pattern = "neorepl",
callback = function ()
require('cmp').setup.buffer({enabled = false})
-- custom keymap example
-- activate corresponding section in mappings
-- mappings = require("custom.utils").set_plugin_mappings "neorepl"
end
})
end

@ -0,0 +1,22 @@
local M = {}
M.set_plugin_mappings = function(plugin_name, mapping_opt)
mappings = require("core.utils").load_config().mappings[plugin_name]
mappings.plugin = nil
for mode, mode_values in pairs(mappings) do
local default_opts = vim.tbl_deep_extend("force", { mode = mode }, mapping_opt or {})
for keybind, mapping_info in pairs(mode_values) do
-- merge default + user opts
local opts = vim.tbl_deep_extend("force", default_opts, mapping_info.opts or {})
mapping_info.opts, opts.mode = nil, nil
opts.desc = mapping_info[2]
vim.keymap.set(mode, keybind, mapping_info[1], opts)
end
end
end
return M

@ -13,6 +13,7 @@ local utils = require "core.utils"
-- export on_attach & capabilities for custom lspconfigs
M.on_attach = function(client, bufnr)
print("NVCHAD ON ATTACH")
if vim.g.vim_version > 7 then
-- nightly
client.server_capabilities.documentFormattingProvider = false

@ -108,9 +108,9 @@ local plugins = {
setup = function()
require("core.lazy_load").on_file_open "nvim-lspconfig"
end,
config = function()
require "plugins.configs.lspconfig"
end,
-- config = function()
-- require "plugins.configs.lspconfig"
-- end,
},
-- load luasnips + cmp related in insert mode only
@ -208,7 +208,7 @@ local plugins = {
["folke/which-key.nvim"] = {
disable = true,
module = "which-key",
keys = "<leader>",
keys = {"<leader>"},
config = function()
require "plugins.configs.whichkey"
end,

Loading…
Cancel
Save