plugins - Added and configured vim-gitgutter
This commit is contained in:
parent
46f9922bbd
commit
64ae9ae009
5 changed files with 31 additions and 4 deletions
|
@ -1 +0,0 @@
|
||||||
NeoBundle 'airblade/vim-gitgutter'
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
" Toggle, open or close the quickfix window. The first argument is the size
|
||||||
|
" (0 for automatic), and the second argument, if present, determines which
|
||||||
|
" action to perform: 0 forces the window closed, 1 opens it, and 2 toggles it.
|
||||||
function! ToggleQuickfix(size, ...)
|
function! ToggleQuickfix(size, ...)
|
||||||
let l:mode = (a:0 == 0)? 2 : (a:1)
|
let l:mode = (a:0 == 0)? 2 : (a:1)
|
||||||
function! s:WindowCheck(mode)
|
function! s:WindowCheck(mode)
|
||||||
|
|
|
@ -1,9 +1,28 @@
|
||||||
" Key maps
|
" 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
|
let g:gitgutter_map_keys = 0
|
||||||
|
|
||||||
|
" Keyboard mappings.
|
||||||
nnoremap <silent> <Leader>g< :GitGutterPrevHunk<cr>
|
nnoremap <silent> <Leader>g< :GitGutterPrevHunk<cr>
|
||||||
nnoremap <silent> <Leader>g> :GitGutterNextHunk<cr>
|
nnoremap <silent> <Leader>g> :GitGutterNextHunk<cr>
|
||||||
nnoremap <silent> <Leader>g+ :GitGutterStageHunk<cr>
|
nnoremap <silent> <Leader>g+ :GitGutterStageHunk<cr>
|
||||||
nnoremap <Leader>g- :GitGutterRevertHunk
|
nnoremap <silent> <Leader>g- :GitGutterUndoHunk<cr>
|
||||||
|
nnoremap <silent> <Leader>gq :call ShowGitGutterQuickfix()<cr>
|
||||||
|
nnoremap <silent> <Leader>g* :call ToggleHunkPreviewWindow()<cr>
|
||||||
|
|
||||||
" Symbols
|
" Symbols
|
||||||
let g:gitgutter_sign_added = '+'
|
let g:gitgutter_sign_added = '+'
|
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
|
" Git commands
|
||||||
let g:which_key_map.g = { 'name' : '+git' }
|
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['+'] = '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['<'] = 'previous-hunk'
|
||||||
let g:which_key_map.g['>'] = 'next-hunk'
|
let g:which_key_map.g['>'] = 'next-hunk'
|
||||||
let g:which_key_map.g.a = 'add-file'
|
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 = 'checkout-branch'
|
||||||
let g:which_key_map.g.c = 'commit'
|
let g:which_key_map.g.c = 'commit'
|
||||||
let g:which_key_map.g.d = 'diff'
|
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-full'
|
||||||
let g:which_key_map.g.l = 'log-split'
|
let g:which_key_map.g.l = 'log-split'
|
||||||
let g:which_key_map.g.M = 'move'
|
let g:which_key_map.g.M = 'move'
|
||||||
|
|
Loading…
Reference in a new issue