comparison runtime/doc/autocmd.txt @ 13482:9eebe457eb3c

Update runtime files. Convert a couple of help files to utf-8. commit https://github.com/vim/vim/commit/98ef233e14faaaf42e0342da1803d493ce0337b2 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 18 14:44:37 2018 +0100 Update runtime files. Convert a couple of help files to utf-8.
author Christian Brabandt <cb@256bit.org>
date Sun, 18 Mar 2018 15:00:07 +0100
parents 9f06f7aca74c
children a62eeee5f116
comparison
equal deleted inserted replaced
13481:cd85b03c9fe2 13482:9eebe457eb3c
1 *autocmd.txt* For Vim version 8.0. Last change: 2018 Mar 05 1 *autocmd.txt* For Vim version 8.0. Last change: 2018 Mar 15
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
54 *:au* *:autocmd* 54 *:au* *:autocmd*
55 :au[tocmd] [group] {event} {pat} [nested] {cmd} 55 :au[tocmd] [group] {event} {pat} [nested] {cmd}
56 Add {cmd} to the list of commands that Vim will 56 Add {cmd} to the list of commands that Vim will
57 execute automatically on {event} for a file matching 57 execute automatically on {event} for a file matching
58 {pat} |autocmd-patterns|. 58 {pat} |autocmd-patterns|.
59 Note: A quote character is seen as argument to the
60 :autocmd and won't start a comment.
59 Vim always adds the {cmd} after existing autocommands, 61 Vim always adds the {cmd} after existing autocommands,
60 so that the autocommands execute in the order in which 62 so that the autocommands execute in the order in which
61 they were given. See |autocmd-nested| for [nested]. 63 they were given. See |autocmd-nested| for [nested].
62 64
63 The special pattern <buffer> or <buffer=N> defines a buffer-local autocommand. 65 The special pattern <buffer> or <buffer=N> defines a buffer-local autocommand.
89 already present. When your .vimrc file is sourced twice, the autocommands 91 already present. When your .vimrc file is sourced twice, the autocommands
90 will appear twice. To avoid this, define your autocommands in a group, so 92 will appear twice. To avoid this, define your autocommands in a group, so
91 that you can easily clear them: > 93 that you can easily clear them: >
92 94
93 augroup vimrc 95 augroup vimrc
94 autocmd! " Remove all vimrc autocommands 96 " Remove all vimrc autocommands
97 autocmd!
95 au BufNewFile,BufRead *.html so <sfile>:h/html.vim 98 au BufNewFile,BufRead *.html so <sfile>:h/html.vim
96 augroup END 99 augroup END
97 100
98 If you don't want to remove all autocommands, you can instead use a variable 101 If you don't want to remove all autocommands, you can instead use a variable
99 to ensure that Vim includes the autocommands only once: > 102 to ensure that Vim includes the autocommands only once: >
143 Warning: You should not do this without a group for 146 Warning: You should not do this without a group for
144 |BufRead| and other common events, it can break 147 |BufRead| and other common events, it can break
145 plugins, syntax highlighting, etc. 148 plugins, syntax highlighting, etc.
146 149
147 :au[tocmd]! [group] Remove ALL autocommands. 150 :au[tocmd]! [group] Remove ALL autocommands.
151 Note: a quote will be seen as argument to the :autocmd
152 and won't start a comment.
148 Warning: You should normally not do this without a 153 Warning: You should normally not do this without a
149 group, it breaks plugins, syntax highlighting, etc. 154 group, it breaks plugins, syntax highlighting, etc.
150 155
151 When the [group] argument is not given, Vim uses the current group (as defined 156 When the [group] argument is not given, Vim uses the current group (as defined
152 with ":augroup"); otherwise, Vim uses the group defined with [group]. 157 with ":augroup"); otherwise, Vim uses the group defined with [group].
322 |WinLeave| before leaving a window 327 |WinLeave| before leaving a window
323 |TabEnter| after entering another tab page 328 |TabEnter| after entering another tab page
324 |TabLeave| before leaving a tab page 329 |TabLeave| before leaving a tab page
325 |CmdwinEnter| after entering the command-line window 330 |CmdwinEnter| after entering the command-line window
326 |CmdwinLeave| before leaving the command-line window 331 |CmdwinLeave| before leaving the command-line window
327
328 |CmdlineChanged| after a change was made to the command-line text
329 |CmdlineEnter| after the cursor moves to the command line
330 |CmdlineLeave| before the cursor leaves the command line
331 332
332 |CmdlineChanged| after a change was made to the command-line text 333 |CmdlineChanged| after a change was made to the command-line text
333 |CmdlineEnter| after the cursor moves to the command line 334 |CmdlineEnter| after the cursor moves to the command line
334 |CmdlineLeave| before the cursor leaves the command line 335 |CmdlineLeave| before the cursor leaves the command line
335 336