From 2ae214a15602fe7c5b949238a8154117480ca644 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 12 Mar 2013 02:01:49 -0400 Subject: [PATCH] Seek to blob name in tree with - --- plugin/fugitive.vim | 56 ++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 3a984c8..3a2f143 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -642,6 +642,12 @@ call s:command("-bar -bang -nargs=? -complete=customlist,s:DirComplete Glcd :lcd " Gstatus {{{1 call s:command("-bar Gstatus :execute s:Status()") +augroup fugitive_status + autocmd! + if !has('win32') + autocmd FocusGained,ShellCmdPost * call fugitive#reload_status() + endif +augroup END function! s:Status() abort try @@ -656,28 +662,36 @@ function! s:Status() abort endfunction function! fugitive#reload_status() abort - let mytab = tabpagenr() - for tab in [mytab] + range(1,tabpagenr('$')) - for winnr in range(1,tabpagewinnr(tab,'$')) - if getbufvar(tabpagebuflist(tab)[winnr-1],'fugitive_type') ==# 'index' - execute 'tabnext '.tab - if winnr != winnr() - execute winnr.'wincmd w' - let restorewinnr = 1 + if exists('s:reloading_status') + return + endif + try + let s:reloading_status = 1 + let mytab = tabpagenr() + for tab in [mytab] + range(1,tabpagenr('$')) + for winnr in range(1,tabpagewinnr(tab,'$')) + if getbufvar(tabpagebuflist(tab)[winnr-1],'fugitive_type') ==# 'index' + execute 'tabnext '.tab + if winnr != winnr() + execute winnr.'wincmd w' + let restorewinnr = 1 + endif + try + if !&modified + call s:BufReadIndex() + endif + finally + if exists('restorewinnr') + wincmd p + endif + execute 'tabnext '.mytab + endtry endif - try - if !&modified - call s:BufReadIndex() - endif - finally - if exists('restorewinnr') - wincmd p - endif - execute 'tabnext '.mytab - endtry - endif + endfor endfor - endfor + finally + unlet! s:reloading_status + endtry endfunction function! s:stage_info(lnum) abort @@ -2269,7 +2283,7 @@ function! s:JumpInit() abort nnoremap o :exe GF("split") nnoremap S :exe GF("vsplit") nnoremap O :exe GF("tabedit") - nnoremap - :exe Edit('edit',0,buffer().up(v:count1)) + nnoremap - :exe Edit('edit',0,buffer().up(v:count1)) if fugitive#buffer().type('tree')call search('^'.escape(expand('#:t'),'.*[]~\').'/\=$','wc')endif nnoremap P :exe Edit('edit',0,buffer().commit().'^'.v:count1.buffer().path(':')) nnoremap ~ :exe Edit('edit',0,buffer().commit().'~'.v:count1.buffer().path(':')) nnoremap C :exe Edit('edit',0,buffer().containing_commit())