mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
update nvim-lsp related settings
This commit is contained in:
parent
50c761119a
commit
8d5a7477d2
@ -342,16 +342,17 @@ local on_attach = function(client, bufnr)
|
||||
-- Set some keybinds conditional on server capabilities
|
||||
if client.resolved_capabilities.document_formatting then
|
||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
||||
elseif client.resolved_capabilities.document_range_formatting then
|
||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
|
||||
end
|
||||
if client.resolved_capabilities.document_range_formatting then
|
||||
buf_set_keymap("x", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR><ESC>", opts)
|
||||
end
|
||||
|
||||
-- Set autocommands conditional on server_capabilities
|
||||
if client.resolved_capabilities.document_highlight then
|
||||
vim.api.nvim_exec([[
|
||||
hi LspReferenceRead cterm=bold ctermbg=red guibg=LightYellow
|
||||
hi LspReferenceText cterm=bold ctermbg=red guibg=LightYellow
|
||||
hi LspReferenceWrite cterm=bold ctermbg=red guibg=LightYellow
|
||||
hi link LspReferenceRead Visual
|
||||
hi link LspReferenceText Visual
|
||||
hi link LspReferenceWrite Visual
|
||||
augroup lsp_document_highlight
|
||||
autocmd! * <buffer>
|
||||
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
|
||||
@ -389,7 +390,7 @@ lspconfig.ccls.setup {
|
||||
}
|
||||
|
||||
-- set up vim-language-server
|
||||
lspconfig.vimls.setup{}
|
||||
lspconfig.vimls.setup{ on_attach = on_attach }
|
||||
|
||||
-- Change diagnostic signs.
|
||||
vim.fn.sign_define('LspDiagnosticsSignError', { text = "✗", texthl = "LspDiagnosticsDefaultError" })
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user