mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-11 12:53:52 -05:00
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:
@@ -2497,7 +2497,7 @@ function! s:ReplaceCmd(cmd) abort
|
|||||||
throw 'fugitive: ' . (len(err) ? substitute(err, "\n$", '', '') : 'unknown error running ' . string(a:cmd))
|
throw 'fugitive: ' . (len(err) ? substitute(err, "\n$", '', '') : 'unknown error running ' . string(a:cmd))
|
||||||
endif
|
endif
|
||||||
setlocal noswapfile
|
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
|
if &foldenable && foldlevel('$') > 0
|
||||||
set nofoldenable
|
set nofoldenable
|
||||||
silent keepjumps $delete _
|
silent keepjumps $delete _
|
||||||
@@ -2507,7 +2507,7 @@ function! s:ReplaceCmd(cmd) abort
|
|||||||
endif
|
endif
|
||||||
call delete(temp)
|
call delete(temp)
|
||||||
if s:cpath(fnamemodify(bufname('$'), ':p'), temp)
|
if s:cpath(fnamemodify(bufname('$'), ':p'), temp)
|
||||||
silent! execute bufnr('$') . 'bwipeout'
|
silent! noautocmd execute bufnr('$') . 'bwipeout'
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -642,26 +642,26 @@ augroup fugitive
|
|||||||
\ endif |
|
\ endif |
|
||||||
\ let b:undo_ftplugin = get(b:, 'undo_ftplugin', 'exe') . '|setl inex= inc='
|
\ 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')) |
|
\ if FugitiveIsGitDir(expand('<amatch>:p:h')) |
|
||||||
\ let b:git_dir = s:Slash(expand('<amatch>:p:h')) |
|
\ let b:git_dir = s:Slash(expand('<amatch>:p:h')) |
|
||||||
\ exe fugitive#BufReadStatus(v:cmdbang) |
|
\ exe fugitive#BufReadStatus(v:cmdbang) |
|
||||||
\ elseif filereadable(expand('<amatch>')) |
|
\ elseif filereadable(expand('<amatch>')) |
|
||||||
\ silent doautocmd BufReadPre |
|
\ silent doautocmd BufReadPre |
|
||||||
\ keepalt read <amatch> |
|
\ keepalt noautocmd read <amatch> |
|
||||||
\ 1delete_ |
|
\ silent 1delete_ |
|
||||||
\ silent doautocmd BufReadPost |
|
\ silent doautocmd BufReadPost |
|
||||||
\ else |
|
\ else |
|
||||||
\ silent doautocmd BufNewFile |
|
\ silent doautocmd BufNewFile |
|
||||||
\ endif
|
\ endif
|
||||||
|
|
||||||
autocmd BufReadCmd fugitive://*//* exe fugitive#BufReadCmd() |
|
autocmd BufReadCmd fugitive://*//* nested exe fugitive#BufReadCmd() |
|
||||||
\ if &path =~# '^\.\%(,\|$\)' |
|
\ if &path =~# '^\.\%(,\|$\)' |
|
||||||
\ let &l:path = substitute(&path, '^\.,\=', '', '') |
|
\ let &l:path = substitute(&path, '^\.,\=', '', '') |
|
||||||
\ endif
|
\ endif
|
||||||
autocmd BufWriteCmd fugitive://*//[0-3]/* exe fugitive#BufWriteCmd()
|
autocmd BufWriteCmd fugitive://*//[0-3]/* nested exe fugitive#BufWriteCmd()
|
||||||
autocmd FileReadCmd fugitive://*//* exe fugitive#FileReadCmd()
|
autocmd FileReadCmd fugitive://*//* nested exe fugitive#FileReadCmd()
|
||||||
autocmd FileWriteCmd fugitive://*//[0-3]/* exe fugitive#FileWriteCmd()
|
autocmd FileWriteCmd fugitive://*//[0-3]/* nested exe fugitive#FileWriteCmd()
|
||||||
if exists('##SourceCmd')
|
if exists('##SourceCmd')
|
||||||
autocmd SourceCmd fugitive://*//* nested exe fugitive#SourceCmd()
|
autocmd SourceCmd fugitive://*//* nested exe fugitive#SourceCmd()
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user