mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-08 03:23:46 -05:00
Compare commits
3 Commits
a41ef0f9d6
...
0c94816f18
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c94816f18 | ||
|
|
b068eaf1e6 | ||
|
|
28f17e5469 |
@@ -3443,33 +3443,37 @@ function! s:RunEdit(state, tmp, job) abort
|
||||
endif
|
||||
call remove(a:state, 'request')
|
||||
let sentinel = a:state.file . '.edit'
|
||||
let file = FugitiveVimPath(readfile(sentinel, '', 1)[0])
|
||||
try
|
||||
if !&equalalways && a:state.mods !~# '\<\d*tab\>' && 3 > (a:state.mods =~# '\<vert' ? winwidth(0) : winheight(0))
|
||||
let noequalalways = 1
|
||||
setglobal equalalways
|
||||
endif
|
||||
let mods = s:Mods(a:state.mods, 'SpanOrigin')
|
||||
exe substitute(mods, '\<tab\>', '-tab', 'g') 'keepalt split' s:fnameescape(file)
|
||||
finally
|
||||
if exists('l:noequalalways')
|
||||
setglobal noequalalways
|
||||
endif
|
||||
endtry
|
||||
set bufhidden=wipe
|
||||
call s:InitializeBuffer(a:state)
|
||||
let bufnr = bufnr('')
|
||||
let s:edit_jobs[bufnr] = [a:state, a:tmp, a:job, sentinel]
|
||||
call fugitive#DidChange(a:state.git_dir)
|
||||
if bufnr == bufnr('') && !exists('g:fugitive_event')
|
||||
let files = readfile(sentinel, '')
|
||||
call writefile([len(files)], sentinel)
|
||||
for file in reverse(files)
|
||||
let file = FugitiveVimPath(file)
|
||||
try
|
||||
let g:fugitive_event = a:state.git_dir
|
||||
let g:fugitive_result = a:state
|
||||
exe s:DoAutocmd('User FugitiveEditor')
|
||||
if !&equalalways && a:state.mods !~# '\<\d*tab\>' && 3 > (a:state.mods =~# '\<vert' ? winwidth(0) : winheight(0))
|
||||
let noequalalways = 1
|
||||
setglobal equalalways
|
||||
endif
|
||||
let mods = s:Mods(a:state.mods, 'SpanOrigin')
|
||||
exe substitute(mods, '\<tab\>', '-tab', 'g') 'keepalt split' s:fnameescape(file)
|
||||
finally
|
||||
unlet! g:fugitive_event g:fugitive_result
|
||||
if exists('l:noequalalways')
|
||||
setglobal noequalalways
|
||||
endif
|
||||
endtry
|
||||
endif
|
||||
set bufhidden=wipe
|
||||
call s:InitializeBuffer(a:state)
|
||||
let bufnr = bufnr('')
|
||||
let s:edit_jobs[bufnr] = [a:state, a:tmp, a:job, sentinel]
|
||||
call fugitive#DidChange(a:state.git_dir)
|
||||
if bufnr == bufnr('') && !exists('g:fugitive_event')
|
||||
try
|
||||
let g:fugitive_event = a:state.git_dir
|
||||
let g:fugitive_result = a:state
|
||||
exe s:DoAutocmd('User FugitiveEditor')
|
||||
finally
|
||||
unlet! g:fugitive_event g:fugitive_result
|
||||
endtry
|
||||
endif
|
||||
endfor
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
@@ -3623,6 +3627,9 @@ if !exists('s:edit_jobs')
|
||||
endif
|
||||
function! s:RunWait(state, tmp, job, ...) abort
|
||||
if a:0 && filereadable(a:1)
|
||||
if a:0 > 1 && a:2 > 0
|
||||
return ''
|
||||
endif
|
||||
call delete(a:1)
|
||||
endif
|
||||
try
|
||||
@@ -3725,8 +3732,16 @@ function! s:RunBufDelete(bufnr) abort
|
||||
endif
|
||||
if has_key(s:edit_jobs, a:bufnr) |
|
||||
call add(s:resume_queue, remove(s:edit_jobs, a:bufnr))
|
||||
call feedkeys("\<C-\>\<C-N>:redraw!|call delete(" . string(s:resume_queue[-1][0].file . '.edit') .
|
||||
\ ")|call fugitive#Resume()|checktime\r", 'n')
|
||||
let sentinel = s:resume_queue[-1][0].file . '.edit'
|
||||
let active_buffers = str2nr(readfile(sentinel, '', 1)[0]) - 1
|
||||
call add(s:resume_queue[-1], active_buffers)
|
||||
if active_buffers < 1
|
||||
call feedkeys("\<C-\>\<C-N>:redraw!|call delete(" . string(sentinel) .
|
||||
\ ")|call fugitive#Resume()|checktime\r", 'n')
|
||||
else
|
||||
call writefile([active_buffers], sentinel)
|
||||
call fugitive#Resume()
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -3940,7 +3955,7 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg, ...) abort
|
||||
let env.FUGITIVE = state.file
|
||||
let editor = 'sh ' . s:TempScript(
|
||||
\ '[ -f "$FUGITIVE.exit" ] && cat "$FUGITIVE.exit" >&2 && exit 1',
|
||||
\ 'echo "$1" > "$FUGITIVE.edit"',
|
||||
\ 'for arg; do echo "$arg" >> "$FUGITIVE.edit"; done',
|
||||
\ 'printf "\033]51;fugitive:edit\007" >&2',
|
||||
\ 'while [ -f "$FUGITIVE.edit" -a ! -f "$FUGITIVE.exit" ]; do sleep 0.05 2>/dev/null || sleep 1; done',
|
||||
\ 'exit 0')
|
||||
@@ -8030,8 +8045,8 @@ function! fugitive#MapJumps(...) abort
|
||||
call s:MapMotion(']]', 'exe <SID>NextSection(v:count1)')
|
||||
call s:MapMotion('[]', 'exe <SID>PreviousSectionEnd(v:count1)')
|
||||
call s:MapMotion('][', 'exe <SID>NextSectionEnd(v:count1)')
|
||||
call s:Map('nxo', '*', '<SID>PatchSearchExpr(0)', '<expr>')
|
||||
call s:Map('nxo', '#', '<SID>PatchSearchExpr(1)', '<expr>')
|
||||
call s:Map('no', '*', '<SID>PatchSearchExpr(0)', '<expr>')
|
||||
call s:Map('no', '#', '<SID>PatchSearchExpr(1)', '<expr>')
|
||||
endif
|
||||
call s:Map('n', 'S', ':<C-U>echoerr "Use gO"<CR>', '<silent><unique>')
|
||||
call s:Map('n', 'dq', ":<C-U>call fugitive#DiffClose()<CR>", '<silent>')
|
||||
|
||||
Reference in New Issue
Block a user