diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index d6913b6852320..3275d5652c662 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -79,11 +79,15 @@ exception is that "" is expanded when the autocmd is defined. Example: Here Vim expands to the name of the file containing this line. -When your .vimrc file is sourced twice, the autocommands will appear twice. -To avoid this, put this command in your .vimrc file, before defining -autocommands: > - - :autocmd! " Remove ALL autocommands for the current group. +":autocmd" adds to the list of autocommands regardless of whether they are +already present. If you'd like to be able to source your .vimrc more than +once avoiding repeated autocommands, just wrap them in a group and clear the +group first with ":autocmd!": + + augroup vimrc + autocmd! " Remove all commands in the vimrc group + au BufNewFile,BufRead *.html so :h/html.vim + augroup END If you don't want to remove all autocommands, you can instead use a variable to ensure that Vim includes the autocommands only once: >