diff --git a/home/vimrc.lua b/home/vimrc.lua index 7d30dfc..cf973c4 100644 --- a/home/vimrc.lua +++ b/home/vimrc.lua @@ -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', 'd', ':lua vim.diagnostic.open_float()', - { noremap = true, silent = true } -) +vim.api.nvim_set_keymap( 'n', 'd', ':lua vim.diagnostic.open_float()', 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', 'n', ':lua vim.diagnostic.goto_next()', - { noremap = true, silent = true } -) +vim.api.nvim_set_keymap( 'n', 'n', ':lua vim.diagnostic.goto_next()', 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', 'p', ':lua vim.diagnostic.goto_prev()', - { noremap = true, silent = true } -) +vim.api.nvim_set_keymap( 'n', 'p', ':lua vim.diagnostic.goto_prev()', 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 {