Try nested autocmds for ReadCmd/WriteCmd

I'm trying to leverage OptionSet for something.  Let's see if this
causes issues for anybody.
This commit is contained in:
Tim Pope
2021-12-07 09:06:29 -05:00
parent 2064312ad7
commit 79c2b3f48d
2 changed files with 9 additions and 9 deletions

View File

@@ -2497,7 +2497,7 @@ function! s:ReplaceCmd(cmd) abort
throw 'fugitive: ' . (len(err) ? substitute(err, "\n$", '', '') : 'unknown error running ' . string(a:cmd))
endif
setlocal noswapfile
silent exe 'lockmarks keepalt 0read ++edit' s:fnameescape(temp)
silent exe 'lockmarks keepalt noautocmd 0read ++edit' s:fnameescape(temp)
if &foldenable && foldlevel('$') > 0
set nofoldenable
silent keepjumps $delete _
@@ -2507,7 +2507,7 @@ function! s:ReplaceCmd(cmd) abort
endif
call delete(temp)
if s:cpath(fnamemodify(bufname('$'), ':p'), temp)
silent! execute bufnr('$') . 'bwipeout'
silent! noautocmd execute bufnr('$') . 'bwipeout'
endif
endfunction

View File

@@ -642,26 +642,26 @@ augroup fugitive
\ endif |
\ let b:undo_ftplugin = get(b:, 'undo_ftplugin', 'exe') . '|setl inex= inc='
autocmd BufReadCmd index{,.lock}
autocmd BufReadCmd index{,.lock} nested
\ if FugitiveIsGitDir(expand('<amatch>:p:h')) |
\ let b:git_dir = s:Slash(expand('<amatch>:p:h')) |
\ exe fugitive#BufReadStatus(v:cmdbang) |
\ elseif filereadable(expand('<amatch>')) |
\ silent doautocmd BufReadPre |
\ keepalt read <amatch> |
\ 1delete_ |
\ keepalt noautocmd read <amatch> |
\ silent 1delete_ |
\ silent doautocmd BufReadPost |
\ else |
\ silent doautocmd BufNewFile |
\ endif
autocmd BufReadCmd fugitive://*//* exe fugitive#BufReadCmd() |
autocmd BufReadCmd fugitive://*//* nested exe fugitive#BufReadCmd() |
\ if &path =~# '^\.\%(,\|$\)' |
\ let &l:path = substitute(&path, '^\.,\=', '', '') |
\ endif
autocmd BufWriteCmd fugitive://*//[0-3]/* exe fugitive#BufWriteCmd()
autocmd FileReadCmd fugitive://*//* exe fugitive#FileReadCmd()
autocmd FileWriteCmd fugitive://*//[0-3]/* exe fugitive#FileWriteCmd()
autocmd BufWriteCmd fugitive://*//[0-3]/* nested exe fugitive#BufWriteCmd()
autocmd FileReadCmd fugitive://*//* nested exe fugitive#FileReadCmd()
autocmd FileWriteCmd fugitive://*//[0-3]/* nested exe fugitive#FileWriteCmd()
if exists('##SourceCmd')
autocmd SourceCmd fugitive://*//* nested exe fugitive#SourceCmd()
endif