commit 79c2b3f48d574e63c2eba4fcd8d5ab729ddd41d1 (tree)
parent 2064312ad7bb80050baf9acbdfb7641162919e53
Author: Tim Pope <code@tpope.net>
Date: Tue, 7 Dec 2021 09:06:29 -0500
Try nested autocmds for ReadCmd/WriteCmd
I'm trying to leverage OptionSet for something. Let's see if this
causes issues for anybody.
Diffstat:
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim
@@ -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
diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim
@@ -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