1
- *autocmd.txt* For Vim version 8.2. Last change: 2020 Oct 26
1
+ *autocmd.txt* For Vim version 8.2. Last change: 2020 Dec 19
2
2
3
3
4
4
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -70,6 +70,11 @@ effects. Be careful not to destroy your text.
70
70
The special pattern <buffer> or <buffer=N> defines a buffer-local autocommand.
71
71
See | autocmd-buflocal | .
72
72
73
+ If the `:autocmd ` is in Vim9 script (a script that starts with `:vim9script `
74
+ and in a `:def ` function) then {cmd} will be executed as in Vim9
75
+ script. Thus this depends on where the autocmd is defined, not where it is
76
+ triggered.
77
+
73
78
Note: The ":autocmd" command can only be followed by another command when the
74
79
'|' appears before {cmd} . This works: >
75
80
:augroup mine | au! BufRead | augroup END
@@ -301,6 +306,9 @@ Name triggered by ~
301
306
| VimLeavePre | before exiting Vim, before writing the viminfo file
302
307
| VimLeave | before exiting Vim, after writing the viminfo file
303
308
309
+ | VimSuspend | when suspending Vim
310
+ | VimResume | when Vim is resumed after being suspended
311
+
304
312
Terminal
305
313
| TerminalOpen | after a terminal buffer was created
306
314
| TerminalWinOpen | after a terminal buffer was created in a new window
@@ -551,12 +559,15 @@ CmdlineChanged After a change was made to the text in the
551
559
*CmdlineEnter*
552
560
CmdlineEnter After moving the cursor to the command line,
553
561
where the user can type a command or search
554
- string.
562
+ string; including non-interactive use of ":"
563
+ in a mapping, but not when using | <Cmd> | .
555
564
<afile> is set to a single character,
556
565
indicating the type of command-line.
557
566
| cmdwin-char |
558
567
*CmdlineLeave*
559
- CmdlineLeave Before leaving the command line.
568
+ CmdlineLeave Before leaving the command line; including
569
+ non-interactive use of ":" in a mapping, but
570
+ not when using | <Cmd> | .
560
571
Also when abandoning the command line, after
561
572
typing CTRL-C or <Esc> .
562
573
When the commands result in an error the
@@ -840,6 +851,8 @@ FuncUndefined When a user function is used but it isn't
840
851
when it's used. The pattern is matched
841
852
against the function name. Both <amatch> and
842
853
<afile> are set to the name of the function.
854
+ Not triggered when compiling a | Vim9 |
855
+ function.
843
856
NOTE: When writing Vim scripts a better
844
857
alternative is to use an autoloaded function.
845
858
See | autoload-functions | .
@@ -1207,6 +1220,7 @@ VimLeave Before exiting Vim, just after writing the
1207
1220
To detect an abnormal exit use | v:dying | .
1208
1221
When v:dying is 2 or more this event is not
1209
1222
triggered.
1223
+ To get the exit code use | v:exiting | .
1210
1224
*VimLeavePre*
1211
1225
VimLeavePre Before exiting Vim, just before writing the
1212
1226
.viminfo file. This is executed only once,
@@ -1217,10 +1231,22 @@ VimLeavePre Before exiting Vim, just before writing the
1217
1231
< To detect an abnormal exit use | v:dying | .
1218
1232
When v:dying is 2 or more this event is not
1219
1233
triggered.
1234
+ To get the exit code use | v:exiting | .
1220
1235
*VimResized*
1221
1236
VimResized After the Vim window was resized, thus 'lines'
1222
1237
and/or 'columns' changed. Not when starting
1223
1238
up though.
1239
+ *VimResume*
1240
+ VimResume When the Vim instance is resumed after being
1241
+ suspended and | VimSuspend | was triggered.
1242
+ Useful for triggering | :checktime | and ensure
1243
+ the buffers content did not change while Vim
1244
+ was suspended: >
1245
+ :autocmd VimResume * checktime
1246
+ < *VimSuspend*
1247
+ VimSuspend When the Vim instance is suspended. Only when
1248
+ CTRL-Z was typed inside Vim, not when the
1249
+ SIGSTOP or SIGTSTP signal was sent to Vim.
1224
1250
*WinEnter*
1225
1251
WinEnter After entering another window. Not done for
1226
1252
the first window, when Vim has just started.
0 commit comments