vimtricks.wiki Concise Vim tricks, one at a time.

How do you create an autocommand group in Vim?

Answer

augroup MyGroup | autocmd! | autocmd BufWrite *.py :!black % | augroup END

Explanation

Wrap autocommands in an augroup with autocmd! to clear previous entries. Prevents duplicate autocommands when reloading vimrc.

Next

How do I visually select a double-quoted string including the quotes themselves?