dotfiles/nvim/lua/config/options.lua
2025-05-22 20:50:30 +02:00

88 lines
3.3 KiB
Lua

vim.cmd([[
syntax on
filetype plugin indent on
let mapleader=","
""" Options
set number " Show line numbers.
set modeline " Allow vim commands in text file comments.
set undofile " Persistent undo tree.
set incsearch " Incremental search.
set tabstop=4 " Number of visual spaces to be displayed per HT.
set expandtab " Expand tabs to spaces by default.
set shiftwidth=0 " Use tabstop value for indenting.
set scrolloff=2 " Keep 2 lines between the end of the buffer and the cursor.
set sidescrolloff=2 " Keep 2 characters between the current column and the screen edge.
set mouse=n " Enable the mouse in normal mode.
set colorcolumn=120
set wildmenu " Tab-complete command menu.
set wildmode=longest:full,full " Most bash-like way.
set wildignorecase " Ignore case when completing.
set splitright " Make :vsplit put the new window on the right.
set splitbelow " Make :split put the new window on the bottom.
set foldlevel=5 " Don't fold almost anything by default.
set hidden " Allow for hidden, modified but not written buffers.
set bufhidden=hide " Hide buffers instead of deleting or unloading them.
set clipboard=
set ignorecase
set smartcase
set gdefault
set cindent " A good basis/default for many languages, though this is usually overridden by the filetype plugin.
set cinoptions=l1,j1 " Indent case blocks correct, and indent Java anonymous classes correctly.
" Autowrap comments using textwidth, inserting the comment leader,
" and remove the comment leader when joining lines when it makes sense.
set formatoptions=cj
" Don't display . on folds.
set fillchars=fold:\
set diffopt=algorithm:patience
set fsync " Syncs the filesystem after :write.
set nowrap
set updatetime=1000 "Lets languageservers update faster, and shortens the time for CursorHold.
set noshowmode " We're using lualine, so showing the mode in the command line is redundant.
" Have the visual-selection indent commands re-highlight the last visual selection after indenting.
vnoremap > >gv
vnoremap < <gv
" Don't use backtick for anything, as it's our wezterm leader key and this leads
" to typos.
map ` <Nop>
" Leader Q should banish the current window.
map <leader>q :only<cr> \| :q<cr>
" Leader W should save and then banish the current window.
map <leader>q :only<cr> \| :wq<cr>
" Fold augroups, functions, Lua, and Python
let g:vimsyn_folding = 'aflP'
" Support embedded Lua and Python.
let g:vimsyn_embed = 'lP'
" Highlight whitespace errors.
let g:c_space_errors = 1
let g:python_space_error_highlight = 1
let g:python_highlight_builtins = 1
let g:python_highlight_builtin_funcs = 1
let g:python_highlight_builtin_types = 1
let g:python_highlight_exceptions = 1
let g:python_highlight_string_formatting = 1
let g:python_highlight_string_format = 1
let g:python_highlight_indent_errors = 1
let g:python_highlight_space_errors = 1
let g:python_highlight_class_vars = 1
let g:xsh_highlight_all = v:true
let g:NERDCustomDelimiters = { 'dosini': { 'left': '#' }, 'xonsh': { 'left': '#' } }
" Use truecolor.
set termguicolors
" Disable relative numbering, if anything turns it on.
set nornu!
]])