From ee5760b0cd08ebe8dce08b230581cedccb7ce4ef Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 7 Mar 2018 21:17:58 +0100 Subject: git-blamer: Set `nowrap` on buffer In order to get the cursor lines to correctly match up horizontally in all cases, set 'nowrap' on the buffer. To set 'wrap' back, follow fugitive.vim's example: https://github.com/tpope/vim-fugitive/blob/f3ccb0c12ee4985b8808f83059830a24cc92821c/plugin/fugitive.vim#L2038-L2040 --- bundle/git-blamer/autoload/git_blamer.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'bundle/git-blamer/autoload') diff --git a/bundle/git-blamer/autoload/git_blamer.vim b/bundle/git-blamer/autoload/git_blamer.vim index 55c4dbe..7f90adf 100644 --- a/bundle/git-blamer/autoload/git_blamer.vim +++ b/bundle/git-blamer/autoload/git_blamer.vim @@ -8,13 +8,18 @@ function! git_blamer#Blame() let l:buffer_name = shellescape(bufname('%')) let l:buffer_number = bufnr('%') - setlocal scrollbind cursorbind + if &l:wrap + let restore = '| call setbufvar(' . l:buffer_number . ', "&wrap", 1)' + endif + + setlocal scrollbind cursorbind nowrap " Open new window leftabove vnew let b:git_blamer_restore = 'call setbufvar(' . l:buffer_number . ', "&scrollbind", 0) | \ call setbufvar(' . l:buffer_number . ', "&cursorbind", 0)' + \ . restore " Read in `git blame` output execute 'read !git blame -w ' . l:buffer_name -- cgit v1.2.3