colorscheme nord set breakindent set cinoptions=l1,:0,g0,E-s,N-s,t0,(s,J1,j1 set colorcolumn=+1 set completeopt=menu,menuone,popup,noinsert,fuzzy set confirm set cpoptions-=_ set cursorline set cursorlineopt=number set exrc set foldlevelstart=99 set foldtext= set ignorecase set jumpoptions=view set linebreak set list set listchars+=precedes:<,extends:> set number set pumborder=rounded set pumheight=10 set scrolloff=2 set shada='100,<50,s10,:100,/100,h,r/tmp/,r/private/ set showcmdloc=statusline set sidescrolloff=5 set smartcase set smoothscroll set splitright set statuscolumn=%s%=%l%{%&nu\|\|&rnu?'%#WinSeparator#│':''%} set statusline=%{%v:lua.require'statusline'.statusline()%} set tabline=%!v:lua.require'statusline'.tabline() set tagcase=match set title set undofile set updatetime=250 set wildignore+=*.pyc,__pycache__,.DS_Store,*~,#*#,*.o set wildignorecase set wildmode=longest:full,full set winborder=rounded if executable('rg') set grepprg=rg\ --vimgrep\ --smart-case endif inoremap nnoremap j (v:count == 0 ? 'gj' : 'j') nnoremap k (v:count == 0 ? 'gk' : 'k') nnoremap / ms/ nnoremap ? ms? nnoremap w update nnoremap b :ls:b nnoremap ee :e %:p:h/ nnoremap es :sp %:p:h/ nnoremap ev :vs %:p:h/ nnoremap Y "+y$ nnoremap y "+y xnoremap y "+y " Search in visual selection with // cnoremap / (getcmdtype() =~ '[/?]' && getcmdline() == '') ? "\\/\\%V" : '/' " Use gK for keywordprg, since K gets mapped to 'hover' in LSP buffers nnoremap gK K " Format whole buffer with formatprg without changing cursor position nnoremap gq mzgggqG`z nnoremap gq? set formatprg? formatexpr? " Unimpaired style mappings nnoremap [e '.move --' . v:count1 . '' nnoremap ]e '.move +' . v:count1 . '' xnoremap [e ':move --' . v:count1 . 'gv' xnoremap ]e ":move '>+" . v:count1 . 'gv' function! Sort(type, ...) abort '[,']sort call setpos('.', getpos("''")) endfunction nnoremap gs m'set operatorfunc=Sortg@ xnoremap gs :sort cnoremap wildmenumode() ? '' : '' cnoremap wildmenumode() ? '' : '' cnoremap pumvisible() ? '' : '' cnoremap pumvisible() ? '' : '' inoremap pumvisible() ? '' : '' inoremap pumvisible() ? '' : '' " Readline-style bindings in command and insert modes inoremap inoremap cnoremap cnoremap cnoremap getcmdpos() == (len(getcmdline()) + 1) ? '' : '' cnoremap cnoremap " Don't use fish for 'shell', but if it exists use it as the default shell in " terminal buffers nnoremap ` 'bo term' .. (executable('fish') ? ' fish' : '') .. '' nnoremap ` ':bo te ' " Use to exit Terminal mode in terminal buffers tnoremap augroup init autocmd! " Close preview and command windows with q autocmd BufWinEnter * if &previewwindow | nnoremap q q | endif autocmd CmdWinEnter * nnoremap q q " Highlight yanked text autocmd TextYankPost * silent! lua vim.hl.hl_op({ higroup="Visual" }) autocmd TextPutPost * silent! lua vim.hl.hl_op({ higroup="Visual" }) " Hide cursorline when the current window doesn't have focus autocmd WinLeave,FocusLost * if !&diff && !&cursorbind | setlocal nocursorline | endif autocmd WinEnter,FocusGained * setlocal cursorline " Create missing parent directories automatically autocmd BufNewFile * autocmd BufWritePre ++once call mkdir(expand('%:h'), 'p') " Disable listchars and fix in prompt buffers autocmd OptionSet buftype if &buftype ==# 'prompt' | \ setlocal nolist | \ inoremap | \ endif " Don't show trailing spaces in insert mode autocmd InsertEnter * setlocal listchars-=trail:- autocmd InsertLeave * setlocal listchars< " For some filetypes, completion based on syntax is better than nothing autocmd FileType cmake setlocal omnifunc=syntaxcomplete#Complete " Automatically enter terminal mode when a :terminal opens autocmd TermOpen term://* startinsert autocmd TermClose term://* stopinsert augroup END packadd! nvim.undotree