diff runtime/doc/autocmd.txt @ 10244:876fbdd84e52

commit https://github.com/vim/vim/commit/2ec618c9feac4573b154510236ad8121c77d0eca Author: Bram Moolenaar <Bram@vim.org> Date: Sat Oct 1 14:47:05 2016 +0200 Updated runtime files.
author Christian Brabandt <cb@256bit.org>
date Sat, 01 Oct 2016 15:00:04 +0200
parents 584c835a2de1
children 9a75c8a1b8b1
line wrap: on
line diff
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -1,4 +1,4 @@
-*autocmd.txt*   For Vim version 8.0.  Last change: 2016 Sep 21
+*autocmd.txt*   For Vim version 8.0.  Last change: 2016 Sep 27
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -79,11 +79,15 @@ exception is that "<sfile>" is expanded 
 
 Here Vim expands <sfile> 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` adds to the list of autocommands regardless of whether they are
+already present.  When your .vimrc file is sourced twice, the autocommands
+will appear twice.  To avoid this, define your autocommands in a group, so
+that you can easily clear them: >
 
-	:autocmd!	" Remove ALL autocommands for the current group.
+	augroup vimrc
+	  autocmd!	" Remove all vimrc autocommands
+	  au BufNewFile,BufRead *.html so <sfile>: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: >
@@ -130,8 +134,13 @@ 3. Removing autocommands				*autocmd-rem
 
 :au[tocmd]! [group] {event}
 			Remove ALL autocommands for {event}.
+			Warning: You should not do this without a group for
+			|BufRead| and other common events, it can break
+			plugins, syntax highlighting, etc.
 
 :au[tocmd]! [group]	Remove ALL autocommands.
+			Warning: You should normally not do this without a
+			group, it breaks plugins, syntax highlighting, etc.
 
 When the [group] argument is not given, Vim uses the current group (as defined
 with ":augroup"); otherwise, Vim uses the group defined with [group].