motiejus/dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone https://git.jakstys.lt/motiejus/dotfiles.git
Log | Tree | Refs | README | LICENSE

commit b248cddf91c7a6513f2a44110cf530fc14331bbe (tree)
parent 68c7df4e2afb8ec1baef9bbc5bc06e33a12b5d86
Author: Tim Pope <code@tpope.net>
Date:   Mon, 19 Oct 2009 21:42:48 -0400

Prevent bells during :Gwrite

Diffstat:
Mplugin/fugitive.vim | 19+++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim @@ -580,7 +580,10 @@ function! s:Write(force,...) abort for winnr in range(1,tabpagewinnr(tab,'$')) if tabpagebuflist(tab)[winnr-1] == treebufnr execute 'tabnext '.tab - execute winnr.'wincmd w' + if winnr != winnr() + execute winnr.'wincmd w' + let restorewinnr = 1 + endif try let lnum = line('.') let last = line('$') @@ -590,7 +593,9 @@ function! s:Write(force,...) abort silent execute lnum let did = 1 finally - wincmd p + if exists('restorewinnr') + wincmd p + endif execute 'tabnext '.mytab endtry endif @@ -621,6 +626,7 @@ function! s:Write(force,...) abort endif endfor + unlet! restorewinnr let zero = s:repo().translate(':0:'.path) for tab in range(1,tabpagenr('$')) for winnr in range(1,tabpagewinnr(tab,'$')) @@ -628,7 +634,10 @@ function! s:Write(force,...) abort let bufname = bufname(bufnr) if bufname ==# zero && bufnr != mybufnr execute 'tabnext '.tab - execute winnr.'wincmd w' + if winnr != winnr() + execute winnr.'wincmd w' + let restorewinnr = 1 + endif try let lnum = line('.') let last = line('$') @@ -638,7 +647,9 @@ function! s:Write(force,...) abort set nomodified diffupdate finally - wincmd p + if exists('restorewinnr') + wincmd p + endif execute 'tabnext '.mytab endtry break