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 190fe2a4cf35b4840e7727fae0263488567742e8 (tree)
parent 8f0b8edfbd246c0026b7a2388e1d883d579ac7f6
Author: Quinn Strahl <me@qstrahl.com>
Date:   Fri, 28 Feb 2014 21:48:21 -0500

Store more than just dir in s:temp_files

- Also store 'args', the git arguments used to generate the temp file

Diffstat:
Mplugin/fugitive.vim | 13++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim @@ -1142,7 +1142,8 @@ function! s:Edit(cmd,bang,...) abort endif if a:bang - let args = s:gsub(join(a:000, ' '), '\\@<!%(\\\\)*\zs[%#]', '\=s:buffer().expand(submatch(0))') + let arglist = map(copy(a:000), 's:gsub(v:val, ''\\@<!%(\\\\)*\zs[%#]'', ''\=s:buffer().expand(submatch(0))'')') + let args = join(arglist, ' ') if a:cmd =~# 'read' let git = buffer.repo().git_command() let last = line('$') @@ -1155,7 +1156,7 @@ function! s:Edit(cmd,bang,...) abort return 'redraw|echo '.string(':!'.git.' '.args) else let temp = resolve(tempname()) - let s:temp_files[temp] = buffer.repo().dir() + let s:temp_files[temp] = { 'dir': buffer.repo().dir(), 'args': arglist } silent execute a:cmd.' '.temp if a:cmd =~# 'pedit' wincmd P @@ -1630,7 +1631,8 @@ function! s:Blame(bang,line1,line2,count,args) abort else let cmd += ['--contents', '-'] endif - let basecmd = escape(call(s:repo().git_command,cmd+['--',s:buffer().path()],s:repo()),'!') + let cmd += ['--', s:buffer().path()] + let basecmd = escape(call(s:repo().git_command,cmd,s:repo()),'!') try let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd ' if !s:repo().bare() @@ -1671,7 +1673,7 @@ function! s:Blame(bang,line1,line2,count,args) abort setlocal scrollbind nowrap nofoldenable let top = line('w0') + &scrolloff let current = line('.') - let s:temp_files[temp] = s:repo().dir() + let s:temp_files[temp] = { 'dir': s:repo().dir(), 'args': cmd } exe 'keepalt leftabove vsplit '.temp let b:fugitive_blamed_bufnr = bufnr let w:fugitive_leave = restore @@ -2309,8 +2311,9 @@ augroup fugitive_temp autocmd! autocmd BufNewFile,BufReadPost * \ if has_key(s:temp_files,expand('<afile>:p')) | - \ let b:git_dir = s:temp_files[expand('<afile>:p')] | + \ let b:git_dir = s:temp_files[expand('<afile>:p')].dir | \ let b:git_type = 'temp' | + \ let b:git_args = s:temp_files[expand('<afile>:p')].args | \ call fugitive#detect(expand('<afile>:p')) | \ setlocal bufhidden=delete | \ nnoremap <buffer> <silent> q :<C-U>bdelete<CR>|