Improving Git support

This commit is contained in:
Emmanuel BENOîT 2020-12-04 23:04:57 +01:00
parent 7a908c6f9c
commit de95477978
5 changed files with 29 additions and 19 deletions

View file

@ -1,4 +1,5 @@
" Fugitive commands that don't require interaction with GitGutter or NERDTree
nnoremap <silent> <Leader>ga :Git add %:p<cr>
nnoremap <silent> <Leader>gd :Gdiff<cr>
nnoremap <silent> <Leader>gs :Gstatus<cr>
nnoremap <silent> <Leader>gc :Gcommit -q<cr>
@ -8,5 +9,6 @@ nnoremap <Leader>gb :Git branch<space>
nnoremap <Leader>gB :Git checkout -b<space>
nnoremap <Leader>gC :Git checkout<space>
nnoremap <Leader>gM :Gmove<space>
nnoremap <Leader>gp :Git pull --recurse-submodules<space>
nnoremap <Leader>gP :Git push<space>
nnoremap <Leader>gR :Gremove

View file

@ -1,23 +1,22 @@
function! <SID>RunGitOp(op)
execute "Silent" a:op
GitGutter
let wins = filter( range( 1 , winnr( '$' ) ) ,
\ "buffer_name(winbufnr(v:val)) =~ '^NERD_tree_[0-9]\\+$'" )
if empty( l:wins )
return
endif
let wn = winnr()
call NERDTreeFocus()
call feedkeys( "R:" . l:wn . "wincmd w\<cr>:\<esc>" , 't' )
endfunction
" Key maps
let g:gitgutter_map_keys = 0
nnoremap <silent> <Leader>g< :GitGutterPrevHunk<cr>
nnoremap <silent> <Leader>g> :GitGutterNextHunk<cr>
nnoremap <silent> <Leader>g+ :call <SID>RunGitOp( 'GitGutterStageHunk' )<cr>
nnoremap <silent> <Leader>g+ :GitGutterStageHunk<cr>
nnoremap <Leader>g- :GitGutterRevertHunk
nnoremap <silent> <Leader>ga :call <SID>RunGitOp( 'Git add %:p' )<cr>
" Symbols
let g:gitgutter_sign_added = '+'
let g:gitgutter_sign_modified = '±'
let g:gitgutter_sign_removed = '∅'
" Symbol colors
highlight GitGutterAdd ctermfg=10 ctermbg=236
highlight GitGutterChange ctermfg=11 ctermbg=236
highlight GitGutterDelete ctermfg=9 ctermbg=236 cterm=bold
" No highlights for added/changed/deleted lines
highlight GitGutterAddLine ctermbg=0
highlight GitGutterChangeLine ctermbg=0
highlight GitGutterDeleteLine ctermbg=0
highlight GitGutterChangeDeleteLine ctermbg=0

View file

@ -1,6 +1,8 @@
" Timeout settings for key sequences
set notimeout
set timeoutlen=0
set ttimeout
set ttimeoutlen=-1
" Time between updates
set updatetime=100

4
cfg/50-diff-colors.vim Normal file
View file

@ -0,0 +1,4 @@
" Diff colors
highlight DiffAdd ctermbg=17
highlight DiffChange ctermbg=22
highlight DiffDelete ctermbg=52

3
cfg/50-sign-column.vim Normal file
View file

@ -0,0 +1,3 @@
" Sign column color and visibility
set signcolumn=yes
highlight SignColumn ctermbg=234