nvim: some config changes for lsp
parent
760cf7f833
commit
a59c02690c
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue