From eb97e0710ca1dee99cba8f5c44d80b84b0310a62 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 29 Nov 2018 19:52:37 +1300 Subject: Wrap Vim gitcommit autocmd clear in :execute Noticed that my b:undo_ftplugin script for this filetype was only getting halfway through its work, and stopping at this command. From `:help autocmd`: > Note: The ":autocmd" command can only be followed by another command when the > '|' appears before {cmd}. This works: > :augroup mine | au! BufRead | augroup END > But this sees "augroup" as part of the defined command: > :augroup mine | au! BufRead * | augroup END > :augroup mine | au BufRead * set tw=70 | augroup END > Instead you can put the group name into the command: > :au! mine BufRead * > :au mine BufRead * set tw=70 > Or use :execute: > :augroup mine | exe "au! BufRead *" | augroup END > :augroup mine | exe "au BufRead * set tw=70" | augroup END --- vim/after/ftplugin/gitcommit.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vim/after') diff --git a/vim/after/ftplugin/gitcommit.vim b/vim/after/ftplugin/gitcommit.vim index 2dc5fa37..0ba80c92 100644 --- a/vim/after/ftplugin/gitcommit.vim +++ b/vim/after/ftplugin/gitcommit.vim @@ -14,7 +14,7 @@ if has('autocmd') && exists('+cursorcolumn') autocmd CursorMoved,CursorMovedI \ let &l:colorcolumn = gitcommit#CursorColumn() augroup END - let b:undo_ftplugin .= '|autocmd! gitcommit' + let b:undo_ftplugin .= '|execute ''autocmd! gitcommit''' \ . '|augroup! gitcommit' endif -- cgit v1.2.3