Преглед изворни кода

add a couple more fugitive tricks

Weiyi Lou пре 12 година
родитељ
комит
350790ecb4
1 измењених фајлова са 10 додато и 7 уклоњено
  1. 10 7
      vim/vimrc

+ 10 - 7
vim/vimrc

@@ -80,12 +80,15 @@ if has("autocmd")
         \ let g:qfix_win = bufnr("$") |
         \ call MapQfPrevNext()
 
-  " if the last window is NERDTree, then close Vim
-  "autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
-  "
-  " Show cursorline only on active window. No need for this now
-  "autocmd WinEnter * setlocal cursorline
-  "autocmd WinLeave * setlocal nocursorline
+  " Fugitive - Go up to previous tree object while exploring git tree with '..'
+  autocmd User fugitive
+    \ if fugitive#buffer().type() =~# '^\%(tree\|blob\)$' |
+    \   nnoremap <buffer> .. :edit %:h<CR> |
+    \ endif
+
+  " Fugitive - Delete buffers when they are not active
+  autocmd BufReadPost fugitive://* set bufhidden=delete
+
 else
   set autoindent on
 endif
@@ -239,6 +242,7 @@ nnoremap <silent> <leader>gc   :Gcommit -v<CR>
 nnoremap <silent> <leader>gl   :Glog<CR><CR>
 nnoremap <silent> <leader>gap  :Git add -p<CR>
 nnoremap <silent> <leader>b    :Gblame<CR>
+nnoremap <silent> <leader>gd   :Gdiff<CR>
 
 " Ack with Ctrl-F
 nnoremap <C-F> :Grep<space>
@@ -247,7 +251,6 @@ nnoremap <C-F> :Grep<space>
 nnoremap <silent> <leader>t    :TagbarToggle<CR>
 
 " Unite settings
-"
 "nnoremap <C-F> :Unite file_rec/async:! -prompt=Goto\ File\ >\  -buffer-name=Files -resume<CR>
 "let g:unite_enable_start_insert = 1
 "call unite#custom_source('file_rec/async', 'matchers', 'matcher_fuzzy')