this repo has no description
at main 123 lines 6.6 kB view raw
1-- ┌──────────────────────────┐ 2-- │ Built-in Neovim behavior │ 3-- └──────────────────────────┘ 4-- 5-- This file defines Neovim's built-in behavior. The goal is to improve overall 6-- usability in a way that works best with MINI. 7-- 8-- Here `vim.o.xxx = value` sets default value of option `xxx` to `value`. 9-- See `:h 'xxx'` (replace `xxx` with actual option name). 10-- 11-- Option values can be customized on per buffer or window basis. 12-- See 'after/ftplugin/' for common example. 13 14-- stylua: ignore start 15-- The next part (until `-- stylua: ignore end`) is aligned manually for easier 16-- reading. Consider preserving this or remove `-- stylua` lines to autoformat. 17 18-- General ==================================================================== 19vim.g.mapleader = ' ' -- Use `<Space>` as <Leader> key 20 21vim.o.mouse = 'a' -- Enable mouse 22-- vim.o.mousescroll = 'ver:25,hor:6' -- Customize mouse scroll 23vim.o.switchbuf = 'usetab' -- Use already opened buffers when switching 24vim.o.undofile = true -- Enable persistent undo 25 26vim.o.shada = "'100,<50,s10,:1000,/100,@100,h" -- Limit ShaDa file (for startup) 27 28-- Enable all filetype plugins and syntax (if not enabled, for better startup) 29vim.cmd('filetype plugin indent on') 30if vim.fn.exists('syntax_on') ~= 1 then vim.cmd('syntax enable') end 31 32-- UI ========================================================================= 33vim.o.breakindent = true -- Indent wrapped lines to match line start 34vim.o.breakindentopt = 'list:-1' -- Add padding for lists (if 'wrap' is set) 35vim.o.colorcolumn = '+1' -- Draw column on the right of maximum width 36vim.o.cursorline = true -- Enable current line highlighting 37vim.o.linebreak = true -- Wrap lines at 'breakat' (if 'wrap' is set) 38vim.o.list = true -- Show helpful text indicators 39vim.o.number = true -- Show line numbers 40vim.wo.relativenumber = true 41vim.o.pumheight = 10 -- Make popup menu smaller 42vim.o.ruler = false -- Don't show cursor coordinates 43vim.o.shortmess = 'CFOSWaco' -- Disable some built-in completion messages 44vim.o.showmode = false -- Don't show mode in command line 45vim.o.signcolumn = 'yes' -- Always show signcolumn (less flicker) 46vim.o.splitbelow = true -- Horizontal splits will be below 47vim.o.splitkeep = 'screen' -- Reduce scroll during window split 48vim.o.splitright = true -- Vertical splits will be to the right 49vim.o.winborder = 'single' -- Use border in floating windows 50vim.o.wrap = false -- Don't visually wrap lines (toggle with \w) 51 52vim.o.cursorlineopt = 'screenline,number' -- Show cursor line per screen line 53 54-- Special UI symbols. More is set via 'mini.basics' later. 55vim.o.fillchars = 'eob: ,fold:╌' 56vim.o.listchars = 'extends:…,nbsp:␣,precedes:…,tab:> ' 57 58-- Folds (see `:h fold-commands`, `:h zM`, `:h zR`, `:h zA`, `:h zj`) 59vim.o.foldlevel = 10 -- Fold nothing by default; set to 0 or 1 to fold 60vim.o.foldmethod = 'indent' -- Fold based on indent level 61vim.o.foldnestmax = 10 -- Limit number of fold levels 62vim.o.foldtext = '' -- Show text under fold with its highlighting 63 64-- Editing ==================================================================== 65vim.o.autoindent = true -- Use auto indent 66vim.o.expandtab = true -- Convert tabs to spaces 67vim.o.formatoptions = 'rqnl1j' -- Improve comment editing 68vim.o.ignorecase = true -- Ignore case during search 69vim.o.incsearch = true -- Show search matches while typing 70vim.o.infercase = true -- Infer case in built-in completion 71vim.o.shiftwidth = 2 -- Use this number of spaces for indentation 72vim.o.smartcase = true -- Respect case if search pattern has upper case 73vim.o.smartindent = true -- Make indenting smart 74vim.o.spelloptions = 'camel' -- Treat camelCase word parts as separate words 75vim.o.tabstop = 2 -- Show tab as this number of spaces 76vim.o.virtualedit = 'block' -- Allow going past end of line in blockwise mode 77 78vim.o.iskeyword = '@,48-57,_,192-255,-' -- Treat dash as `word` textobject part 79 80-- Pattern for a start of numbered list (used in `gw`). This reads as 81-- "Start of list item is: at least one special character (digit, -, +, *) 82-- possibly followed by punctuation (. or `)`) followed by at least one space". 83vim.o.formatlistpat = [[^\s*[0-9\-\+\*]\+[\.\)]*\s\+]] 84 85-- Built-in completion 86vim.o.complete = '.,w,b,kspell' -- Use less sources 87vim.o.completeopt = 'menuone,noselect,fuzzy,nosort' -- Use custom behavior 88 89-- Autocommands =============================================================== 90 91-- Don't auto-wrap comments and don't insert comment leader after hitting 'o'. 92-- Do on `FileType` to always override these changes from filetype plugins. 93local f = function() vim.cmd('setlocal formatoptions-=c formatoptions-=o') end 94Config.new_autocmd('FileType', nil, f, "Proper 'formatoptions'") 95 96-- There are other autocommands created by 'mini.basics'. See 'plugin/30_mini.lua'. 97 98-- Diagnostics ================================================================ 99 100-- Neovim has built-in support for showing diagnostic messages. This configures 101-- a more conservative display while still being useful. 102-- See `:h vim.diagnostic` and `:h vim.diagnostic.config()`. 103local diagnostic_opts = { 104 -- Show signs on top of any other sign, but only for warnings and errors 105 signs = { priority = 9999, severity = { min = 'WARN', max = 'ERROR' } }, 106 107 -- Show all diagnostics as underline (for their messages type `<Leader>ld`) 108 underline = { severity = { min = 'HINT', max = 'ERROR' } }, 109 110 -- Show more details immediately for errors on the current line 111 virtual_lines = false, 112 virtual_text = { 113 current_line = true, 114 severity = { min = 'ERROR', max = 'ERROR' }, 115 }, 116 117 -- Don't update diagnostics when typing 118 update_in_insert = false, 119} 120 121-- Use `later()` to avoid sourcing `vim.diagnostic` on startup 122MiniDeps.later(function() vim.diagnostic.config(diagnostic_opts) end) 123-- stylua: ignore end