diff options
author | Teddy Wing | 2018-03-07 20:30:29 +0100 |
---|---|---|
committer | Teddy Wing | 2018-03-07 20:39:41 +0100 |
commit | 9e8c040bcb01391aa8ef7bb3206eed156c9315bc (patch) | |
tree | fd023a99ed6704e8d11bcdde87e67954b4ca3ab8 /bundle | |
parent | 6eb4fc5fabefb643a929082b8bfba50e63b3c8ec (diff) | |
download | dotvim-9e8c040bcb01391aa8ef7bb3206eed156c9315bc.tar.bz2 |
git-blamer: Fix bug causing `cursorbind` to be set on other windows
In some instances with more than one window open, closing the GitBlamer
window would cause other windows in the tab to have `cursorbind` (and
presumably `scrollbind`) set.
Fix the bug by setting `scrollbind` and `cursorbind` on the buffer
(these are window-local variables, we'll have to find out if it's weird
to set them on a buffer), and store the "restore" command in a
buffer-local variable (local to the GitBlamer window).
Diffstat (limited to 'bundle')
-rw-r--r-- | bundle/git-blamer/autoload/git_blamer.vim | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/bundle/git-blamer/autoload/git_blamer.vim b/bundle/git-blamer/autoload/git_blamer.vim index 65a1c24..83efe4c 100644 --- a/bundle/git-blamer/autoload/git_blamer.vim +++ b/bundle/git-blamer/autoload/git_blamer.vim @@ -5,17 +5,18 @@ function! git_blamer#Blame() let l:line_number = line('.') let l:buffer_name = shellescape(bufname('%')) - let l:window_number = winnr() + let l:buffer_number = bufnr('%') setlocal scrollbind cursorbind - let t:git_blamer_restore = 'call setwinvar(' . l:window_number . ', "&scrollbind", 0) | - \ call setwinvar(' . l:window_number . ', "&cursorbind", 0)' " Open new window leftabove vnew setlocal noswapfile nowrap nolist nobuflisted buftype=nofile bufhidden=wipe setlocal scrollbind cursorbind + let b:git_blamer_restore = 'call setbufvar(' . l:buffer_number . ', "&scrollbind", 0) | + \ call setbufvar(' . l:buffer_number . ', "&cursorbind", 0)' + " Read in `git blame` output execute 'read !git blame -w ' . l:buffer_name @@ -28,5 +29,5 @@ function! git_blamer#Blame() call setpos('.', [0, l:line_number, 0, 0]) " Restore starting file's scrollbind on exit - autocmd BufWinLeave <buffer> execute t:git_blamer_restore + autocmd BufWinLeave <buffer> execute b:git_blamer_restore endfunction |