nvim: some config changes for lsp

master
Jef Roosens 2022-04-26 20:51:51 +02:00
parent 760cf7f833
commit a59c02690c
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
1 changed files with 8 additions and 6 deletions

View File

@ -9,12 +9,12 @@ local function on_attach(client, bufnr)
-- Jump to definition -- Jump to definition
buf_nmap("gd", "<Cmd>lua vim.lsp.buf.definition()<CR>") buf_nmap("gd", "<Cmd>lua vim.lsp.buf.definition()<CR>")
-- Format current buffer on write -- Format current buffer on write
vim.api.nvim_command([[autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_seq_sync()]]) -- vim.api.nvim_command([[autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_seq_sync()]])
-- Show diagnostics for current line -- Show diagnostics for current line
buf_nmap("<leader>dd", "<Cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>") buf_nmap("<leader>dd", "<Cmd>lua vim.diagnostic.open_float()<CR>")
-- Jump between diagnostic messages -- Jump between diagnostic messages
buf_nmap("<leader>dj", "<Cmd>lua vim.lsp.diagnostic.goto_next()<CR>") buf_nmap("<leader>dj", "<Cmd>lua vim.diagnostic.goto_next()<CR>")
buf_nmap("<leader>dk", "<Cmd>lua vim.lsp.diagnostic.goto_previous()<CR>") buf_nmap("<leader>dk", "<Cmd>lua vim.diagnostic.goto_prev()<CR>")
-- Rename symbol under cursor -- Rename symbol under cursor
buf_nmap("<leader>dr", "<Cmd>lua vim.lsp.buf.rename()<CR>") buf_nmap("<leader>dr", "<Cmd>lua vim.lsp.buf.rename()<CR>")
-- Show hover info -- Show hover info
@ -39,7 +39,9 @@ require'lspconfig'.hls.setup{
-- Pacman: vieter-vls (requires my Vieter repository) -- Pacman: vieter-vls (requires my Vieter repository)
-- GH: https://github.com/vlang/vls -- GH: https://github.com/vlang/vls
require'lspconfig'.vls.setup{ require'lspconfig'.vls.setup{
cmd = {'vls'} cmd = {'vls'},
filetypes = {'v'},
on_attach = on_attach
} }
-- Pacman: rust-analyzer -- Pacman: rust-analyzer
-- GH: https://github.com/rust-analyzer/rust-analyzer -- GH: https://github.com/rust-analyzer/rust-analyzer