-- General vim.g.mapleader = ' ' -- Use as key vim.o.undofile = true -- Keep undo history after closing files vim.o.shada = "'50,<20,s10,:100,/50,@50,h,r/tmp/" -- Fewer saved items (faster startup), skip /tmp files -- UI vim.o.number = true -- Show line numbers vim.o.cursorline = true -- Highlight the line the cursor is on vim.o.signcolumn = 'yes' -- Always show sign column (no text shifting) vim.o.wrap = false -- Don't wrap long lines vim.o.list = true -- Show tabs, trailing spaces and nbsp vim.o.listchars = 'tab:→ ,trail:·,nbsp:␣' -- Symbols used for those characters vim.o.fillchars = 'eob: ' -- Hide `~` on lines after end of buffer vim.o.splitbelow = true -- Open horizontal splits below vim.o.splitright = true -- Open vertical splits to the right vim.o.splitkeep = 'screen' -- Keep text in place when opening splits vim.o.cmdheight = 0 -- Hide command line when not typing a command vim.o.shortmess = 'CFOSWacou' -- Hide completion, search count, undo and write messages vim.cmd.syntax('off') -- Disable legacy syntax (treesitter handles highlighting) require('vim._core.ui2').enable({ -- New message/cmdline UI, messages in float (nightly) msg = { targets = 'msg' } }) -- Editing vim.o.expandtab = true -- Insert spaces when pressing vim.o.shiftwidth = 2 -- Spaces per indent level (>>, <<, autoindent) vim.o.tabstop = 2 -- Display width of a tab character vim.o.ignorecase = true -- Ignore case when searching vim.o.smartcase = true -- ...unless the pattern contains uppercase vim.o.virtualedit = 'block' -- Allow cursor past end of line in visual block vim.o.spelloptions = 'camel' -- Spell-check camelCase words per part -- Completion vim.o.complete = '.,w,b,kspell' -- Complete from buffer, windows, buffers, spell vim.o.completeopt = 'menuone,noselect,fuzzy,popup' -- Show menu for one match, don't preselect, fuzzy match, description popup vim.o.pumheight = 10 -- Max items visible in completion popup vim.o.pummaxwidth = 120 -- Max width of completion popup -- Autocommands Config.autocmd('TextYankPost', '*', function() vim.hl.hl_op() end, 'Highlight yanked text') Config.autocmd('TermOpen', '*', function() vim.cmd('startinsert') end, 'Start insert mode when terminal opens') Config.autocmd('LspAttach', '*', function(ev) vim.bo[ev.buf].complete = 'o' end, 'Use lsp completions') -- Diagnostics Config.later(function() vim.diagnostic.config({ jump = { on_jump = vim.diagnostic.open_float }, signs = { priority = 9999, severity = { min = vim.diagnostic.severity.INFO }, text = { [vim.diagnostic.severity.ERROR] = '', [vim.diagnostic.severity.WARN] = '', [vim.diagnostic.severity.INFO] = '', }, }, }) end)