make lsp look nicer

This commit is contained in:
Anish Lakhwara 2022-12-20 15:50:16 +10:00
parent 3b5e19ec12
commit 68d40b380a

View file

@ -345,10 +345,16 @@ in
nnoremap <leader>vrn :lua vim.lsp.buf.rename()<CR>
nnoremap <leader>vh :lua vim.lsp.buf.hover()<CR>
nnoremap <leader>vca :lua vim.lsp.buf.code_action()<CR>
nnoremap <leader>vsd :lua rim.lsp.diagnostic.show_line_diagnostics(); vim.lsp.util.show_line_diagnostics()<CR>
nnoremap <leader>vsd :lua vim.lsp.util.show_line_diagnostics()<CR>
nnoremap <leader>vn :lua vim.lsp.diagnostic.goto_next()<CR>
nnoremap <leader>vll :call LspLocationList()<CR>
nnoremap <leader>va :lua require('telescope.builtin').lsp_code_actions(require('telescope.themes').get_cursor())<cr>
" lspsaga stuff doesn't work
" nnoremap <leader>vd :call Lspsaga peek_definition<CR>
" nnoremap <leader>vrn :call Lspsaga rename<CR><CR>
" nnoremap <leader>vh :call Lspsaga hover_doc<CR>
" nnoremap <leader>vca :call Lspsaga code_action<CR>
" nnoremap <leader>vsd :call Lspsaga show_line_diagnostics<CR>
" nnoremap <leader>vn :call Lspsaga diagnostic_jump_prev<CR>
" dashboard
let g:dashboard_custom_header = [
@ -431,6 +437,33 @@ in
end
end
vim.diagnostic.config({
signs = true,
update_in_insert = false,
underline = false,
severity_sort = true,
float = {
focusable = false,
style = 'minimal',
border = 'rounded',
source = 'always',
},
})
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
vim.lsp.handlers.hover,
{
border = 'rounded',
}
)
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
vim.lsp.handlers.signature_help,
{
border = 'rounded',
}
)
vim.api.nvim_set_keymap('n', '<leader>vt', ':call v:lua.toggle_diagnostics()<CR>', {noremap = true, silent = true})
-- autopairs
@ -534,11 +567,11 @@ in
null_ls.setup({
sources = {
null_ls.builtins.diagnostics.shellcheck,
null_ls.builtins.diagnostics.proselint.with({ filetypes = { "vimwiki", "mail", }, }),
-- null_ls.builtins.code_actions.statix,
-- null_ls.builtins.diagnostics.clj_kondo,
-- null_ls.builtins.formatting.isort,
-- null_ls.builtins.formatting.black,
-- null_ls.builtins.code_actions.proselint,
},
})
@ -548,11 +581,25 @@ in
local format = require("lsp-format")
local navic = require("nvim-navic")
-- lspsaga, code_action lightbulb is annoying
-- local saga = require('lspsaga')
-- saga.init_lsp_saga({
-- code_action_lightbulb = {
-- enable = true,
-- enable_in_insert = true,
-- cache_code_action = true,
-- sign = true,
-- update_time = 150,
-- sign_priority = 4,
-- virtual_text = false,
-- },
-- })
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
local lspconfig = require('lspconfig')
local servers = { 'clojure_lsp', 'terraform_lsp', 'zls', 'pyright', 'rust_analyzer', 'tsserver' }
local servers = { 'clojure_lsp', 'terraform_lsp', 'zls', 'pyright', 'rust_analyzer', 'tsserver', 'sumneko_lua' }
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
on_attach = function(client, bufnr)
@ -768,6 +815,7 @@ in
python-with-my-packages
nodejs
clojure-lsp
clojure
rnix-lsp
terraform-lsp
rust-analyzer
@ -780,6 +828,7 @@ in
statix
nodePackages.typescript
nodePackages.typescript-language-server
sumneko-lua-language-server
];
plugins = with pkgs.vimPlugins // customPlugins; [
@ -795,7 +844,7 @@ in
undotree
telescope-nvim
plenary-nvim
nvim-gps
nvim-navic
nvim-treesitter
nvim-treesitter-context
my-fterm
@ -806,6 +855,7 @@ in
nvim-peekup
zen-mode-nvim
twilight-nvim
lspsaga-nvim
# language
vim-nix
@ -854,7 +904,6 @@ in
vim-tidal
# experimental
nvim-luapad
nvim-navic
scnvim
leap
vim-beancount