aboutsummaryrefslogtreecommitdiffstats
path: root/bundle/git-blamer/autoload/git_blamer.vim
diff options
context:
space:
mode:
authorTeddy Wing2018-03-07 21:17:58 +0100
committerTeddy Wing2018-03-07 21:17:58 +0100
commitee5760b0cd08ebe8dce08b230581cedccb7ce4ef (patch)
treec97c156e625063624921fd6930a15af4d8d8f37e /bundle/git-blamer/autoload/git_blamer.vim
parent17acd727bbb97950536da0963f0b9a2af449ee13 (diff)
downloaddotvim-ee5760b0cd08ebe8dce08b230581cedccb7ce4ef.tar.bz2
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
Diffstat (limited to 'bundle/git-blamer/autoload/git_blamer.vim')
-rw-r--r--bundle/git-blamer/autoload/git_blamer.vim7
1 files changed, 6 insertions, 1 deletions
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