plugins - Added and configured vim-gitgutter
This commit is contained in:
parent
46f9922bbd
commit
64ae9ae009
5 changed files with 31 additions and 4 deletions
41
plugins/vim-gitgutter.cfg.vim
Normal file
41
plugins/vim-gitgutter.cfg.vim
Normal file
|
@ -0,0 +1,41 @@
|
|||
" Function that generates the list of hunks and opens the quickfix window
|
||||
function! ShowGitGutterQuickfix()
|
||||
exe "GitGutterQuickFix"
|
||||
call ToggleQuickfix(0, 1)
|
||||
endfunction
|
||||
|
||||
" Function that toggles the hunk preview window.
|
||||
function! ToggleHunkPreviewWindow()
|
||||
if gitgutter#hunk#is_preview_window_open()
|
||||
call gitgutter#hunk#close_hunk_preview_window()
|
||||
else
|
||||
exe "GitGutterPreviewHunk"
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Don't register default key mappings
|
||||
let g:gitgutter_map_keys = 0
|
||||
|
||||
" Keyboard mappings.
|
||||
nnoremap <silent> <Leader>g< :GitGutterPrevHunk<cr>
|
||||
nnoremap <silent> <Leader>g> :GitGutterNextHunk<cr>
|
||||
nnoremap <silent> <Leader>g+ :GitGutterStageHunk<cr>
|
||||
nnoremap <silent> <Leader>g- :GitGutterUndoHunk<cr>
|
||||
nnoremap <silent> <Leader>gq :call ShowGitGutterQuickfix()<cr>
|
||||
nnoremap <silent> <Leader>g* :call ToggleHunkPreviewWindow()<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
|
4
plugins/vim-gitgutter.load.vim
Normal file
4
plugins/vim-gitgutter.load.vim
Normal file
|
@ -0,0 +1,4 @@
|
|||
call dein#add('airblade/vim-gitgutter', #{
|
||||
\ lazy: 1,
|
||||
\ on_source: 'vim-airline',
|
||||
\ })
|
|
@ -28,8 +28,9 @@ let g:which_key_map.p.i = 'open-file'
|
|||
|
||||
" Git commands
|
||||
let g:which_key_map.g = { 'name' : '+git' }
|
||||
let g:which_key_map.g['*'] = 'hunk-preview'
|
||||
let g:which_key_map.g['+'] = 'add-hunk'
|
||||
let g:which_key_map.g['-'] = 'revert-hunk'
|
||||
let g:which_key_map.g['-'] = 'undo-hunk'
|
||||
let g:which_key_map.g['<'] = 'previous-hunk'
|
||||
let g:which_key_map.g['>'] = 'next-hunk'
|
||||
let g:which_key_map.g.a = 'add-file'
|
||||
|
@ -38,6 +39,7 @@ let g:which_key_map.g.B = 'new-branch'
|
|||
let g:which_key_map.g.C = 'checkout-branch'
|
||||
let g:which_key_map.g.c = 'commit'
|
||||
let g:which_key_map.g.d = 'diff'
|
||||
let g:which_key_map.g.q = 'show-hunks'
|
||||
let g:which_key_map.g.L = 'log-full'
|
||||
let g:which_key_map.g.l = 'log-split'
|
||||
let g:which_key_map.g.M = 'move'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue