+ loads LSP server based on file type
+ imports native-lsp (our's) and lspconfig (foreign)
+ key mappings for lsp
This commit is contained in:
Just Midi 2021-08-11 20:52:37 +00:00
parent 14b563ff20
commit 052b4513c2
3 changed files with 142 additions and 22 deletions

View file

@ -275,27 +275,26 @@ end
map('n', '<leader>p', ':lua pm_sync()<CR>', {noremap = true})
-- LSP
function lsp_shortcuts()
local lsp_commands = {
new = {'d','r','f','t','x','a','c','C','h','s','m'},
old = {
'#textDocument_definition', -- d
'#textDocument_rename', -- r
'#textDocument_formatting', -- f
'#textDocument_typeDefinition', -- t
'#textDocument_references', -- x
'_workspace_applyEdit', -- a
'#textDocument_completion', -- c
'#textDocument_codeAction', -- C
'#textDocument_hover', -- h
'_textDocument_documentSymbol', -- s
'_contextMenu' -- m
}
local lsp_commands = {
new = {'<', '>','a','d','D','f','h','n','r','s'},
old = {
'diagnostic.goto_prev', -- <
'diagnostic.goto_next', -- >
'buf.code_action', -- a
'buf.definition', -- d
'buf.declaration', -- D
'buf.formatting', -- f
'buf.hover', -- h
'buf.rename', -- n
'buf.references', -- r
'buf.document_symbol' -- s
}
for i = 1, #lspcommands.new do
for _,f in pairs(modes_map({'n'})) do
f('<Leader>l'..key_pair.new[i],
':call LanguageClient'..key_pair.old[i]..'()<CR>', {noremap = true})
end
}
for i = 1, #lsp_commands.new do
for _,f in pairs(modes_map({'n'})) do
f('<Leader>l'..lsp_commands.new[i],
'<cmd>lua vim.lsp.'..lsp_commands.old[i]..'()<CR>',
{noremap = true}
)
end
end