diff --git a/bundles-init/nerdtree.cfg.vim b/bundles-init/nerdtree.cfg.vim index 0036dcc..326f4b5 100644 --- a/bundles-init/nerdtree.cfg.vim +++ b/bundles-init/nerdtree.cfg.vim @@ -1,4 +1,5 @@ " NERDTree: ' e' = toggle side bar +let g:NERDTreeUpdateOnWrite = 1 nnoremap e :NERDTreeToggle " Open automatically if there are more than 150 columns and no file was specified diff --git a/bundles-init/vim-fugitive.cfg.vim b/bundles-init/vim-fugitive.cfg.vim new file mode 100644 index 0000000..8cb1a52 --- /dev/null +++ b/bundles-init/vim-fugitive.cfg.vim @@ -0,0 +1,13 @@ +" Fugitive commands that don't require interaction with GitGutter or NERDTree +nnoremap gd :Gdiff +nnoremap gs :Gstatus +nnoremap gl :Silent Glog:bot copen +nnoremap gc :Gcommit -q +nnoremap gb :Git branch + +" Note: dangerous commands don't have a +nnoremap gB :Git checkout -b +nnoremap gC :Git checkout +nnoremap gM :Gmove +nnoremap gP :Git push +nnoremap gR :Gremove diff --git a/bundles-init/vim-fugitive.load.vim b/bundles-init/vim-fugitive.load.vim new file mode 100644 index 0000000..09403d1 --- /dev/null +++ b/bundles-init/vim-fugitive.load.vim @@ -0,0 +1 @@ +NeoBundle 'tpope/vim-fugitive' diff --git a/bundles-init/vim-gitgutter.cfg.vim b/bundles-init/vim-gitgutter.cfg.vim new file mode 100644 index 0000000..daf6b71 --- /dev/null +++ b/bundles-init/vim-gitgutter.cfg.vim @@ -0,0 +1,23 @@ +function! 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\:\" , 't' ) +endfunction + + +let g:gitgutter_map_keys = 0 +nnoremap g< :GitGutterPrevHunk +nnoremap g> :GitGutterNextHunk +nnoremap g+ :call RunGitOp( 'GitGutterStageHunk' ) +nnoremap g- :GitGutterRevertHunk + +nnoremap ga :call RunGitOp( 'Git add %:p' ) diff --git a/bundles-init/vim-gitgutter.load.vim b/bundles-init/vim-gitgutter.load.vim new file mode 100644 index 0000000..edacfe2 --- /dev/null +++ b/bundles-init/vim-gitgutter.load.vim @@ -0,0 +1 @@ +NeoBundle 'airblade/vim-gitgutter' diff --git a/doc/heavim.txt b/doc/heavim.txt index 750c19b..63915e2 100644 --- a/doc/heavim.txt +++ b/doc/heavim.txt @@ -42,3 +42,21 @@ local leader key. t Toggle tagbar e Toggle NERDtree explorer + + gd Git: view diff for current buffer + gl Git: show log + gs Git: show status + g< Git: previous modified chunk + g> Git: next modified chunk + + g+ Git: add modified chunk + g- Git: revert modified chunk + ga Git: add whole buffer + gb Git: create branch + gc Git: commit staged changes + + gB Git: create and checkout branch + gC Git: checkout + gM Git: rename current buffer + gP Git: push + gR Git: remove current buffer