Update 2025-01-01 10:48 OpenBSD/amd64-t14
This commit is contained in:
parent
08aaf050a6
commit
767ba27c2b
81
.vim/vimrc
81
.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 <silent> <Down> gj
|
||||
nmap <silent> <Up> gk
|
||||
|
||||
" NEXT WINDOW
|
||||
" clashes a bit in real life with shift+tag (toggle paste mode)
|
||||
nnoremap <Tab> :wincmd w<cr>
|
||||
|
||||
" USE ARROW / VIM KEYS INSIDE OMNIBOX
|
||||
" FIXME: it has been a while that I've use the omnibox...
|
||||
inoremap <expr> j pumvisible() ? '<C-n>' : 'j'
|
||||
inoremap <expr> k pumvisible() ? '<C-p>' : 'k'
|
||||
inoremap <expr> <Down> pumvisible() ? '<C-n>' : '<Down>'
|
||||
inoremap <expr> <Up> pumvisible() ? '<C-p>' : '<Up>'
|
||||
|
||||
" 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 <c-]> " Jump to tag (go tag)
|
||||
nnoremap gb <c-o> " Jump to last position (go back)
|
||||
nnoremap gh :FSHere<CR> " Jump to header file (go header)
|
||||
nnoremap bb :ls<cr>:b
|
||||
nnoremap :Lex<cr>
|
||||
nnoremap bg :ls<cr>:b " Jump to buffer number (buffer go)
|
||||
nnoremap bb :ls<cr>:b#<cr><cr> " Jump to last open buffer (buffer back)
|
||||
nnoremap :Lex<cr> " 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 <C-R>=expand("<cfile>")<CR><CR>
|
||||
nmap ti :scs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
|
||||
nmap td :scs find d <C-R>=expand("<cword>")<CR><CR>
|
||||
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<CR>
|
||||
" nmap :cprevious<CR>
|
||||
nmap :execute "grep " . expand("<cword>")<CR><CR>
|
||||
|
||||
" CUSTOM: Make shortcuts
|
||||
" this is awful cr cr cr cr cr
|
||||
" FIXME find a more universal solution to trigger builds
|
||||
nmap mm :make<CR><CR><CR>
|
||||
nmap mt :make test<CR><CR><CR>
|
||||
nmap md :make debug<CR><CR><CR>
|
||||
@ -273,6 +283,7 @@ nmap em :!vim Makefile<CR><CR>
|
||||
nmap st :!smake . test<CR>
|
||||
nmap sm :!smake . <CR>
|
||||
|
||||
" CUSTOM: Toggle Paste Mode
|
||||
let s:enablepaste = 0
|
||||
function! TogglePasteMode()
|
||||
if s:enablepaste
|
||||
@ -284,12 +295,16 @@ function! TogglePasteMode()
|
||||
endfunction
|
||||
nmap <S-tab> :call TogglePasteMode()<CR>
|
||||
|
||||
" 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 {<cr> {<cr> <cr>}<up><end><c-h>
|
||||
|
||||
" CUSTOM: 'h' => highlight word, 'n' => search for it
|
||||
nmap # :let @/ = expand('<cword>')\|set hlsearch<C-M>
|
||||
|
||||
" CUSTOM: root save
|
||||
@ -305,43 +320,39 @@ let g:tagbar_ctags_bin = "ectags"
|
||||
" PLUGIN: TERMDEBUGGER
|
||||
let g:termdebugger = "egdb"
|
||||
|
||||
" PLUGIN: EASY ALIGN
|
||||
xmap ga <Plug>(EasyAlign)
|
||||
nmap ga <Plug>(EasyAlign)
|
||||
|
||||
" CUSTOM: AUTO BRACKET
|
||||
inoremap {<cr> {<cr> <cr>}<up><end><c-h>
|
||||
|
||||
" 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
|
||||
|
Loading…
Reference in New Issue
Block a user