vim: add zls, do keybind cleanup

This commit is contained in:
Asmir A 2023-07-10 10:50:42 +02:00
parent 7a54d9fa15
commit eb43190b7c

View File

@ -1,22 +1,30 @@
-- Basic settings
vim.g.loaded_matchparen = true
vim.g.netrw_liststyle = 3
vim.go.background = 'dark'
vim.go.belloff = 'all'
vim.go.breakindent = true
vim.go.hlsearch = false
vim.go.laststatus = 0
vim.go.lazyredraw = true
vim.go.showcmd = true
vim.go.synmaxcol = 800
vim.go.syntax = 'on'
vim.go.termguicolors = true
vim.go.titleold = vim.fn.getcwd()
vim.go.title = true
vim.go.wildmenu = true
vim.go.wrap = true
vim.wo.number = true
local glob_opts = {
background = 'dark',
belloff = 'all',
breakindent = true,
hlsearch = false,
laststatus = 0,
lazyredraw = true,
showcmd = true,
synmaxcol = 800,
syntax = 'on',
termguicolors = true,
titleold = vim.fn.getcwd(),
title = true,
wildmenu = true,
wrap = true,
}
for option, value in pairs(glob_opts) do
vim.go[option] = value
end
vim.cmd([[colorscheme gruvbox]])
require 'nvim-treesitter.configs'.setup {
@ -99,26 +107,18 @@ vim.api.nvim_create_autocmd('LspAttach', {
end
})
vim.diagnostic.config({
virtual_text = false, -- Turn off inline diagnostics
})
vim.diagnostic.config({ virtual_text = false}) -- Turn off inline diagnostics
-- Show all diagnostics on current line in floating window
vim.api.nvim_set_keymap(
'n', '<Leader>d', ':lua vim.diagnostic.open_float()<CR>',
{ noremap = true, silent = true }
)
vim.api.nvim_set_keymap( 'n', '<Leader>d', ':lua vim.diagnostic.open_float()<CR>', opts)
-- Go to next diagnostic (if there are multiple on the same line, only shows
-- one at a time in the floating window)
vim.api.nvim_set_keymap(
'n', '<Leader>n', ':lua vim.diagnostic.goto_next()<CR>',
{ noremap = true, silent = true }
)
vim.api.nvim_set_keymap( 'n', '<Leader>n', ':lua vim.diagnostic.goto_next()<CR>', opts)
-- Go to prev diagnostic (if there are multiple on the same line, only shows
-- one at a time in the floating window)
vim.api.nvim_set_keymap(
'n', '<Leader>p', ':lua vim.diagnostic.goto_prev()<CR>',
{ noremap = true, silent = true }
)
vim.api.nvim_set_keymap( 'n', '<Leader>p', ':lua vim.diagnostic.goto_prev()<CR>', opts)
-- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches
@ -184,7 +184,7 @@ cmp.setup({
}
})
local servers = { 'pyright', 'rust_analyzer', 'ccls', 'nixd', 'texlab' }
local servers = { 'pyright', 'rust_analyzer', 'ccls', 'nixd', 'texlab', 'zls' }
local capabilities = require('cmp_nvim_lsp').default_capabilities()
for _, lsp in pairs(servers) do
require('lspconfig')[lsp].setup {