Don't double set temp options on blame buffer

This commit is contained in:
Tim Pope 2019-08-08 19:57:55 -04:00
parent 4a42d4e21c
commit 6db7120c9a

View File

@ -4635,6 +4635,8 @@ function! s:BlameCommand(line1, line2, range, count, bang, mods, reg, arg, args)
let edit = s:Mods(a:mods) . get(['edit', 'split', 'pedit'], a:count - (a:line1 ? a:line1 : 1), 'split') let edit = s:Mods(a:mods) . get(['edit', 'split', 'pedit'], a:count - (a:line1 ? a:line1 : 1), 'split')
return s:BlameCommit(edit, get(readfile(temp), 0, ''), bufnr('')) return s:BlameCommit(edit, get(readfile(temp), 0, ''), bufnr(''))
else else
let temp = s:Resolve(temp)
let s:temp_files[s:cpath(temp)] = {'dir': s:Dir(), 'filetype': 'fugitiveblame', 'args': cmd}
for winnr in range(winnr('$'),1,-1) for winnr in range(winnr('$'),1,-1)
call setwinvar(winnr, '&scrollbind', 0) call setwinvar(winnr, '&scrollbind', 0)
if exists('+cursorbind') if exists('+cursorbind')
@ -4645,6 +4647,7 @@ function! s:BlameCommand(line1, line2, range, count, bang, mods, reg, arg, args)
endif endif
endfor endfor
let bufnr = bufnr('') let bufnr = bufnr('')
let s:temp_files[s:cpath(temp)].bufnr = bufnr
let restore = 'call setwinvar(bufwinnr('.bufnr.'),"&scrollbind",0)' let restore = 'call setwinvar(bufwinnr('.bufnr.'),"&scrollbind",0)'
if exists('+cursorbind') if exists('+cursorbind')
let restore .= '|call setwinvar(bufwinnr('.bufnr.'),"&cursorbind",0)' let restore .= '|call setwinvar(bufwinnr('.bufnr.'),"&cursorbind",0)'
@ -4661,8 +4664,6 @@ function! s:BlameCommand(line1, line2, range, count, bang, mods, reg, arg, args)
endif endif
let top = line('w0') + &scrolloff let top = line('w0') + &scrolloff
let current = line('.') let current = line('.')
let temp = s:Resolve(temp)
let s:temp_files[s:cpath(temp)] = { 'dir': s:Dir(), 'filetype': 'fugitiveblame', 'args': cmd, 'bufnr': bufnr }
exe 'keepalt' (a:bang ? 'split' : 'leftabove vsplit') s:fnameescape(temp) exe 'keepalt' (a:bang ? 'split' : 'leftabove vsplit') s:fnameescape(temp)
let b:fugitive_blamed_bufnr = bufnr let b:fugitive_blamed_bufnr = bufnr
let b:fugitive_type = 'blame' let b:fugitive_type = 'blame'
@ -4674,7 +4675,7 @@ function! s:BlameCommand(line1, line2, range, count, bang, mods, reg, arg, args)
if exists('+cursorbind') if exists('+cursorbind')
setlocal cursorbind setlocal cursorbind
endif endif
setlocal nomodified nomodifiable nonumber scrollbind nowrap foldcolumn=0 nofoldenable winfixwidth filetype=fugitiveblame buftype=nowrite setlocal nonumber scrollbind nowrap foldcolumn=0 nofoldenable winfixwidth
if exists('+concealcursor') if exists('+concealcursor')
setlocal concealcursor=nc conceallevel=2 setlocal concealcursor=nc conceallevel=2
endif endif