-- The next part (until `-- stylua: ignore end`) is aligned manually for easier -- reading. Consider preserving this or remove `-- stylua` lines to autoformat. -- General ==================================================================== vim.g.mapleader = " " -- Use `` as key vim.o.clipboard = "unnamedplus" -- Use system clipboard vim.o.mouse = "a" -- Enable mouse vim.o.switchbuf = "usetab" -- Use already opened buffers when switching vim.o.undofile = true -- Enable persistent undo vim.o.shada = "'100,<50,s10,:1000,/100,@100,h" -- Limit ShaDa file (for startup) -- Enable all filetype plugins and syntax (if not enabled, for better startup) vim.cmd("filetype plugin indent on") if vim.fn.exists("syntax_on") ~= 1 then vim.cmd("syntax enable") end -- UI ========================================================================= vim.o.breakindent = true -- Indent wrapped lines to match line start vim.o.breakindentopt = "list:-1" -- Add padding for lists (if "wrap" is set) vim.o.colorcolumn = "+1" -- Draw column on the right of maximum width vim.o.cursorline = true -- Enable current line highlighting vim.o.linebreak = true -- Wrap lines at "breakat" (if "wrap" is set) vim.o.list = true -- Show helpful text indicators vim.o.number = true -- Show line numbers vim.o.pumheight = 10 -- Make popup menu smaller vim.o.ruler = false -- Don"t show cursor coordinates vim.o.shortmess = "CFOSWaco" -- Disable some built-in completion messages vim.o.showmode = false -- Don"t show mode in command line vim.o.signcolumn = "yes" -- Always show signcolumn (less flicker) vim.o.splitbelow = true -- Horizontal splits will be below vim.o.splitkeep = "screen" -- Reduce scroll during window split vim.o.splitright = true -- Vertical splits will be to the right vim.o.termguicolors = true -- Use terminal gui colors vim.o.winborder = "single" -- Use border in floating windows vim.o.wrap = false -- Don"t visually wrap lines (toggle with \w) vim.o.cursorlineopt = "screenline,number" -- Show cursor line per screen line -- Special UI symbols. More is set via "mini.basics" later. vim.o.list = true -- NOTE: use vim.opt with tables until neovim/neovim#20107 is implemented vim.opt.fillchars = { eob = " ", fold = " ", foldopen = "", foldsep = " ", foldclose = "" } vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" } -- Folds (see `:h fold-commands`, `:h zM`, `:h zR`, `:h zA`, `:h zj`) vim.o.foldlevel = 10 -- Fold nothing by default; set to 0 or 1 to fold vim.o.foldmethod = "indent" -- Fold based on indent level vim.o.foldnestmax = 10 -- Limit number of fold levels vim.o.foldtext = "" -- Show text under fold with its highlighting -- Editing ==================================================================== vim.o.autoindent = true -- Use auto indent vim.o.expandtab = true -- Convert tabs to spaces vim.o.formatoptions = "rqnl1j" -- Improve comment editing vim.o.ignorecase = true -- Ignore case during search vim.o.incsearch = true -- Show search matches while typing vim.opt.inccommand = "split" -- Preview substitutions live, as you type! vim.o.infercase = true -- Infer case in built-in completion vim.o.scrolloff = 15 -- Keep a minimum of 15 lines above/below cursor vim.o.shiftwidth = 2 -- Use this number of spaces for indentation vim.o.smartcase = true -- Respect case if search pattern has upper case vim.o.smartindent = true -- Make indenting smart vim.o.spelloptions = "camel" -- Treat camelCase word parts as separate words vim.o.tabstop = 8 -- Show tab as this number of spaces vim.o.virtualedit = "block" -- Allow going past end of line in blockwise mode vim.o.iskeyword = "@,48-57,_,192-255,-" -- Treat dash as `word` textobject part -- Pattern for a start of numbered list (used in `gw`). This reads as -- "Start of list item is: at least one special character (digit, -, +, *) -- possibly followed by punctuation (. or `)`) followed by at least one space". vim.o.formatlistpat = [[^\s*[0-9\-\+\*]\+[\.\)]*\s\+]] -- Reduce time taken to update swapfile vim.opt.updatetime = 250 vim.opt.timeoutlen = 300 -- remove search highlights by clicking escape. vim.keymap.set("n", "", "nohlsearch") -- Remaps previous and next to automatically center search results. vim.keymap.set("n", "n", "nzz", { noremap = true, silent = true }) vim.keymap.set("n", "N", "Nzz", { noremap = true, silent = true }) -- Centers the first search result. vim.keymap.set( "c", "", function() return vim.fn.getcmdtype() == "/" and "zz" or "" end, { expr = true } ) -- Remaps vim.keymap.set("n", "<", "", ">gv", { noremap = true, silent = true }) -- Keybinds for moving visual selections using shift + hjkl/arrows vim.keymap.set("v", "", ":m '<-2gv=gv") vim.keymap.set("v", "", ":m '>+1gv=gv") vim.keymap.set("v", "", ":m '<-2gv=gv") vim.keymap.set("v", "", ":m '>+1gv=gv")