diff --git a/vim/.vimrc b/vim/.vimrc index b7076df..d9a46c1 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -1,80 +1,63 @@ -set rtp+=/home/linuxbrew/.linuxbrew/opt/fzf,/usr/local/opt/fzf,/opt/homebrew/opt/fzf -nnoremap ,fa :call fzf#run({'sink': 'edit', 'options': '--preview="bat --color=always {}"'}) -nnoremap ,ff :call fzf#run({'sink': 'edit', 'options': '--preview="bat --color=always {}"', 'source': 'git ls-files'}) - -set exrc -set secure -if has('clipboard') - set clipboard^=unnamed,unnamedplus -endif -set tabstop=4 -set shiftwidth=0 -set expandtab -set rnu -set nu -set nowrap -set shiftround -set nohlsearch -set incsearch -set guicursor=n-v-c:block-Cursor -set cursorline -set autoindent -set ttimeoutlen=50 -syntax on - -nnoremap ,co :copen +autocmd BufEnter *__virtual* setlocal buftype=nofile bufhidden=hide noswapfile +autocmd BufNewFile,BufRead *.h set filetype=c +autocmd BufWinEnter *.* silent! loadview +autocmd BufWinLeave *.* silent! mkview +autocmd FileType * setlocal indentexpr= +autocmd FileType c setlocal path+=/usr/local/include,/usr/include +autocmd FileType csharp setlocal makeprg=dotnet +autocmd FileType go setlocal makeprg=go noexpandtab +autocmd FileType python setlocal makeprg=basedpyright +autocmd FileType yaml setlocal tabstop=2 +let g:rustfmt_autosave = 0 +nnoremap ,cD :call setqflist(filter(getqflist(), 'v:val != getqflist()[getqflist({"idx": 0}).idx - 1]')) nnoremap ,cc :cclose -nnoremap ,cq :call setqflist([]):cclose -nnoremap ,ct :call setqflist([{'filename': expand('%'), 'lnum': line('.'), 'col': col('.'), 'text': 'TODO'}], 'a') nnoremap ,cf :cfirst nnoremap ,cl :clast -nnoremap :cnextzz -nnoremap :cpreviouszz -nnoremap ,cu :colder +nnoremap ,co :copen +nnoremap ,cq :call setqflist([]):cclose nnoremap ,cr :cnewer +nnoremap ,ct :call setqflist([{'filename': expand('%'), 'lnum': line('.'), 'col': col('.'), 'text': 'TODO'}], 'a') +nnoremap ,cu :colder +nnoremap ,fa :call fzf#run({'sink': 'edit', 'options': '--preview="bat --color=always {}"'}) +nnoremap ,ff :call fzf#run({'sink': 'edit', 'options': '--preview="bat --color=always {}"', 'source': 'git ls-files'}) nnoremap ,h H nnoremap ,l L -nnoremap H ^ -nnoremap L $ -xnoremap H ^ -xnoremap L $ - -nnoremap ,cD :call setqflist(filter(getqflist(), 'v:val != getqflist()[getqflist({"idx": 0}).idx - 1]')) - nnoremap ,t vl:terminala - -" Don't include curdir, it just causes pain. -set viewoptions=folds,cursor -autocmd BufWinLeave *.* silent! mkview -autocmd BufWinEnter *.* silent! loadview - +nnoremap zz nnoremap h nnoremap j nnoremap k nnoremap l - -nnoremap zz +nnoremap :cnextzz +nnoremap :cpreviouszz nnoremap zz - -tnoremap c c - -autocmd BufEnter *__virtual* setlocal buftype=nofile bufhidden=hide noswapfile - -let g:rustfmt_autosave = 0 - -" remove annoying and bad indentation -autocmd FileType * setlocal indentexpr= - -set wildignore=*.o,*.obj,.git/**,tags,*.pyc - -" for c tests +nnoremap H ^ +nnoremap L $ +set autoindent +set cursorline set errorformat^=[----]\ %f:%l:\ %m +set expandtab +set exrc +set guicursor=n-v-c:block-Cursor +set incsearch +set nohlsearch +set nowrap +set nu set path=** +set rnu +set rtp+=/home/linuxbrew/.linuxbrew/opt/fzf,/usr/local/opt/fzf,/opt/homebrew/opt/fzf +set secure +set shiftround +set shiftwidth=0 +set tabstop=4 +set ttimeoutlen=50 +set viewoptions=folds,cursor +set wildignore=*.o,*.obj,.git/**,tags,*.pyc +syntax on +tnoremap c c +xnoremap H ^ +xnoremap L $ -" language specific makeprgs -autocmd BufNewFile,BufRead *.h set filetype=c -autocmd FileType c setlocal path+=/usr/local/include,/usr/include -autocmd FileType python setlocal makeprg=basedpyright -autocmd FileType go setlocal makeprg=go noexpandtab -autocmd FileType csharp setlocal makeprg=dotnet -autocmd FileType yaml setlocal tabstop=2 +if has('clipboard') + set clipboard^=unnamed,unnamedplus +endif