From 767ba27c2b78255b6c70303f89c0740ee685c78e Mon Sep 17 00:00:00 2001 From: c0dev0id Date: Wed, 1 Jan 2025 10:48:50 +0100 Subject: [PATCH] Update 2025-01-01 10:48 OpenBSD/amd64-t14 --- .vim/vimrc | 81 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 46 insertions(+), 35 deletions(-) diff --git a/.vim/vimrc b/.vim/vimrc index feee5b3..9fb10cb 100644 --- a/.vim/vimrc +++ b/.vim/vimrc @@ -158,7 +158,7 @@ highlight DiffDelete ctermfg=234 ctermbg=52 highlight DiffChange ctermfg=255 ctermbg=234 highlight DiffText ctermfg=166 ctermbg=234 -" GITGUTTER +" PLUGIN: GITGUTTER set signcolumn=number highlight GitGutterAddLine ctermfg=1 ctermbg=0 highlight GitGutterChangeLine ctermfg=3 ctermbg=0 @@ -201,15 +201,18 @@ nmap gj nmap gk " NEXT WINDOW +" clashes a bit in real life with shift+tag (toggle paste mode) nnoremap :wincmd w " USE ARROW / VIM KEYS INSIDE OMNIBOX +" FIXME: it has been a while that I've use the omnibox... inoremap j pumvisible() ? '' : 'j' inoremap k pumvisible() ? '' : 'k' inoremap pumvisible() ? '' : '' inoremap pumvisible() ? '' : '' " NETRW +" because nerdtree is unnecessary let g:netrw_banner = 0 " disable annoying banner let g:netrw_browse_split = 4 " open in prior window let g:netrw_altv = 1 " open splits to the right @@ -219,17 +222,24 @@ let g:netrw_keepdir = 0 let g:netrw_winsize = 25 hi! link netrwMarkFile Search -" TAGS FILE +" findtags dir searches for the root of CVS or GIT repositories +" and returns the path for the tag file, and $PWD if neigher +" GIT nor CVS is detected. Tags will go in: +" - gitroot/.git/tags +" - cvsroot/.tags/tags +" - $PWD/.tags/tags +" The same location will be used by cscope. let tagsdir = trim(system("$HOME/.vim/bin/findtagsdir")) execute "set tags=".tagsdir."/tags" "set tags=.git/tags;.tags/tags; " Search tagfile backward recursive nnoremap gt " Jump to tag (go tag) nnoremap gb " Jump to last position (go back) -nnoremap gh :FSHere " Jump to header file (go header) -nnoremap bb :ls:b -nnoremap  :Lex +nnoremap bg :ls:b " Jump to buffer number (buffer go) +nnoremap bb :ls:b# " Jump to last open buffer (buffer back) +nnoremap  :Lex " open file browser -" CSCOPE +" PLUGIN: CSCOPE +" I can never remember these keys.., or what they do if has("cscope") set csprg=cscope set cst @@ -256,16 +266,16 @@ if has("cscope") nmap tf :scs find f =expand("") nmap ti :scs find i ^=expand("")$ nmap td :scs find d =expand("") - function! UpdateCSCOPE() - :! cscope -RL -f .git/cscope.out - :! ectags -Rf .git/tags - endfunction endif +" CUSTOM: Good idea, but when have I used this last time? " nmap  :cnext " nmap  :cprevious nmap  :execute "grep " . expand("") +" CUSTOM: Make shortcuts +" this is awful cr cr cr cr cr +" FIXME find a more universal solution to trigger builds nmap mm :make nmap mt :make test nmap md :make debug @@ -273,6 +283,7 @@ nmap em :!vim Makefile nmap st :!smake . test nmap sm :!smake . +" CUSTOM: Toggle Paste Mode let s:enablepaste = 0 function! TogglePasteMode() if s:enablepaste @@ -284,12 +295,16 @@ function! TogglePasteMode() endfunction nmap :call TogglePasteMode() +" FIXME: not really used...? if executable('ugrep') set grepprg=ugrep\ -RInk\ -j\ -u\ --tabs=1\ --ignore-files set grepformat=%f:%l:%c:%m,%f+%l+%c+%m,%-G%f\\\|%l\\\|%c\\\|%m endif -" CUSTOM: # highlights, n searches. +" CUSTOM: AUTO BRACKET +inoremap { { } + +" CUSTOM: 'h' => highlight word, 'n' => search for it nmap # :let @/ = expand('')\|set hlsearch " CUSTOM: root save @@ -305,43 +320,39 @@ let g:tagbar_ctags_bin = "ectags" " PLUGIN: TERMDEBUGGER let g:termdebugger = "egdb" -" PLUGIN: EASY ALIGN -xmap ga (EasyAlign) -nmap ga (EasyAlign) - -" CUSTOM: AUTO BRACKET -inoremap { { } - -" CUSTOM: TREAT C FILES AS C, NOT C++ -augroup Programming - autocmd! - autocmd BufRead,BufNewFile *.h,*.c set filetype=c.doxygen +""" +""" AUTOCOMMANDS +""" +augroup CisNotCPP + au! + au BufRead,BufNewFile *.h,*.c set filetype=c.doxygen augroup END -" CUSTOM: AUTORELOAD ON VIMRC CHANGE augroup AutoReloadVimrc au! au BufWritePost vimrc so $MYVIMRC augroup END -augroup myquickfix - autocmd! - autocmd QuickFixCmdPost [^l]* cwindow - autocmd QuickFixCmdPost l* lwindow +augroup AutoOpenCloseQFixWindow + au! + au QuickFixCmdPost [^l]* cwindow + au QuickFixCmdPost l* lwindow augroup END -augroup CurorPosOnLoad -autocmd BufReadPost * +augroup LoadCursorPosition + au! + au BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif augroup END -augroup DiffSyntax - autocmd! OptionSet diff syntax off +augroup ResplitOnResize + au! + au VimResized * wincmd = augroup END -augroup AutoSplitResize - autocmd! - autocmd VimResized * wincmd = -augroup END +augroup AutoTabSpace + au! + au BufRead,BufNewFile Makefile,/usr/src/*.c,/usr/src/*.h,*.gmk setl sw=8 ts=8 noet +augroup end