Open lencioni opened 9 years ago
Sound good.
How about these examples?
Good:
augroup Foo
autocmd!
autocmd BufNewFile * put ='Nyan'
augroup END
augroup Foo
autocmd! BufNewFile * put ='Nyan'
" :au[tocmd]! [group] {event} {pat} [nested] {cmd} should be allowed,
" because this command is a short-hand equivalent to the first case.
augroup END
augroup Foo
" Comment node placed before autocmd! should be allowed.
autocmd!
autocmd BufNewFile * put ='Nyan'
augroup END
Bad:
augroup Foo
autocmd BufNewFile * put ='Nyan'
" autocmd! not found.
augroup END
augroup Foo
autocmd! BufNewFile *
" Partial removing should not be allowed.
augroup END
autocmd! Foo
augroup Foo
autocmd BufNewFile * put ='Nyan'
augroup END
" It should not allowed because there are many similar cases.
" I want to keep allowed notations lean.
augroup Foo
autocmd! Foo
autocmd BufNewFile * put ='Nyan'
augroup END
" Same reason.
We cannot check the case:
:+1:
Usually when defining an
augroup
, you want to includeautocmd!
at the top to clear any old autocommands before defining new ones. More info: http://learnvimscriptthehardway.stevelosh.com/chapters/14.htmlIt might be nice for vint to warn about
augroup
s that are missing anautocmd!
at the top. What do you think?