|
|
|
@ -1,4 +1,4 @@
|
|
|
|
*autocmd.txt* For Vim version 7.0aa. Last change: 2005 Nov 21
|
|
|
|
*autocmd.txt* For Vim version 7.0aa. Last change: 2005 Dec 07
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
|
|
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
|
|
|
@ -169,18 +169,195 @@ See |:verbose-cmd| for more information.
|
|
|
|
==============================================================================
|
|
|
|
==============================================================================
|
|
|
|
5. Events *autocmd-events* *E215* *E216*
|
|
|
|
5. Events *autocmd-events* *E215* *E216*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
You can specify a comma-separated list of event names. No white space can be
|
|
|
|
|
|
|
|
used in this list. The command applies to all the events in the list.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
For READING FILES there are four kinds of events possible:
|
|
|
|
|
|
|
|
BufNewFile starting to edit a non-existent file
|
|
|
|
|
|
|
|
BufReadPre BufReadPost starting to edit an existing file
|
|
|
|
|
|
|
|
FilterReadPre FilterReadPost read the temp file with filter output
|
|
|
|
|
|
|
|
FileReadPre FileReadPost any other file read
|
|
|
|
|
|
|
|
Vim uses only one of these four kinds when reading a file. The "Pre" and
|
|
|
|
|
|
|
|
"Post" events are both triggered, before and after reading the file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Note that the autocommands for the *ReadPre events and all the Filter events
|
|
|
|
|
|
|
|
are not allowed to change the current buffer (you will get an error message if
|
|
|
|
|
|
|
|
this happens). This is to prevent the file to be read into the wrong buffer.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Note that the 'modified' flag is reset AFTER executing the BufReadPost
|
|
|
|
|
|
|
|
and BufNewFile autocommands. But when the 'modified' option was set by the
|
|
|
|
|
|
|
|
autocommands, this doesn't happen.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
You can use the 'eventignore' option to ignore a number of events or all
|
|
|
|
|
|
|
|
events.
|
|
|
|
*autocommand-events* *{event}*
|
|
|
|
*autocommand-events* *{event}*
|
|
|
|
Vim recognizes the following events. Vim ignores the case of event names
|
|
|
|
Vim recognizes the following events. Vim ignores the case of event names
|
|
|
|
(e.g., you can use "BUFread" or "bufread" instead of "BufRead").
|
|
|
|
(e.g., you can use "BUFread" or "bufread" instead of "BufRead").
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
First an overview by function with a short explanation. Then the list
|
|
|
|
|
|
|
|
alpabetically with full explanations |autocmd-events-abc|.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Name triggered by ~
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Reading
|
|
|
|
|
|
|
|
|BufNewFile| starting to edit a file that doesn't exist
|
|
|
|
|
|
|
|
|BufReadPre| starting to edit a new buffer, before reading the file
|
|
|
|
|
|
|
|
|BufRead| starting to edit a new buffer, after reading the file
|
|
|
|
|
|
|
|
|BufReadPost| starting to edit a new buffer, after reading the file
|
|
|
|
|
|
|
|
|BufReadCmd| before starting to edit a new buffer |Cmd-event|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|FileReadPre| before reading a file with a ":read" command
|
|
|
|
|
|
|
|
|FileReadPost| after reading a file with a ":read" command
|
|
|
|
|
|
|
|
|FileReadCmd| before reading a file with a ":read" comman |Cmd-event|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|FilterReadPre| before reading a file from a filter command
|
|
|
|
|
|
|
|
|FilterReadPost| after reading a file from a filter command
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|StdinReadPre| before reading from stdin into the buffer
|
|
|
|
|
|
|
|
|StdinReadPost| After reading from the stdin into the buffer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Writing
|
|
|
|
|
|
|
|
|BufWrite| starting to write the whole buffer to a file
|
|
|
|
|
|
|
|
|BufWritePre| starting to write the whole buffer to a file
|
|
|
|
|
|
|
|
|BufWritePost| after writing the whole buffer to a file
|
|
|
|
|
|
|
|
|BufWriteCmd| before writing the whole buffer to a file |Cmd-event|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|FileWritePre| starting to write part of a buffer to a file
|
|
|
|
|
|
|
|
|FileWritePost| after writing part of a buffer to a file
|
|
|
|
|
|
|
|
|FileWriteCmd| before writing part of a buffer to a file |Cmd-event|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|FileAppendPre| starting to append to a file
|
|
|
|
|
|
|
|
|FileAppendPost| after appending to a file
|
|
|
|
|
|
|
|
|FileAppendCmd| before appending to a file |Cmd-event|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|FilterWritePre| starting to write a file for a filter command or diff
|
|
|
|
|
|
|
|
|FilterWritePost| after writing a file for a filter command or diff
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Buffers
|
|
|
|
|
|
|
|
|BufAdd| just after adding a buffer to the buffer list
|
|
|
|
|
|
|
|
|BufCreate| just after adding a buffer to the buffer list
|
|
|
|
|
|
|
|
|BufDelete| before deleting a buffer from the buffer list
|
|
|
|
|
|
|
|
|BufWipeout| before completely deleting a buffer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|BufFilePre| before changing the name of the current buffer
|
|
|
|
|
|
|
|
|BufFilePost| after changing the name of the current buffer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|BufEnter| after entering a buffer
|
|
|
|
|
|
|
|
|BufLeave| before leaving to another buffer
|
|
|
|
|
|
|
|
|BufWinEnter| after a buffer is displayed in a window
|
|
|
|
|
|
|
|
|BufWinLeave| before a buffer is removed from a window
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|BufUnload| before unloading a buffer
|
|
|
|
|
|
|
|
|BufHidden| just after a buffer has become hidden
|
|
|
|
|
|
|
|
|BufNew| just after creating a new buffer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|SwapExists| detected an existing swap file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Options
|
|
|
|
|
|
|
|
|FileType| when the 'filetype' option has been set
|
|
|
|
|
|
|
|
|Syntax| when the 'syntax' option has been set
|
|
|
|
|
|
|
|
|EncodingChanged| after the 'encoding' option has been changed
|
|
|
|
|
|
|
|
|TermChanged| after the value of 'term' has changed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Startup and exit
|
|
|
|
|
|
|
|
|VimEnter| after doing all the startup stuff
|
|
|
|
|
|
|
|
|GUIEnter| after starting the GUI successfully
|
|
|
|
|
|
|
|
|TermResponse| after the termainal response to |t_RV| is received
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|VimLeavePre| before exiting Vim, before writing the viminfo file
|
|
|
|
|
|
|
|
|VimLeave| before exiting Vim, after writing the viminfo file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Various
|
|
|
|
|
|
|
|
|FileChangedShell| Vim notices that a file changed since editing started
|
|
|
|
|
|
|
|
|FileChangedRO| before making the first change to a read-only file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|FuncUndefined| a user function is used but it isn't defined
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|FocusGained| Vim got input focus
|
|
|
|
|
|
|
|
|FocusLost| Vim lost input focus
|
|
|
|
|
|
|
|
|CursorHold| the user doesn't press a key for a while
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|WinEnter| after entering another window
|
|
|
|
|
|
|
|
|WinLeave| before leaving a window
|
|
|
|
|
|
|
|
|CmdwinEnter| after entering the command-line window
|
|
|
|
|
|
|
|
|CmdwinLeave| before leaving the command-line window
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|InsertEnter| starting Insert mode
|
|
|
|
|
|
|
|
|InsertChange| when typing <Insert> while in Insert or Replace mode
|
|
|
|
|
|
|
|
|InsertLeave| when leaving Insert mode
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|ColorScheme| after loading a color scheme
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|RemoteReply| a reply from a server Vim was received
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|QuickFixCmdPre| before a quickfix command is run
|
|
|
|
|
|
|
|
|QuickFixCmdPost| after a quickfix command is run
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|SessionLoadPost| after loading a session file
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|MenuPopup| just before showing the popup menu
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|User| to be used in combination with ":doautocmd"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The alphabetical list of autocommand events: *autocmd-events-abc*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*BufCreate* *BufAdd*
|
|
|
|
|
|
|
|
BufAdd or BufCreate Just after creating a new buffer which is
|
|
|
|
|
|
|
|
added to the buffer list, or adding a buffer
|
|
|
|
|
|
|
|
to the buffer list.
|
|
|
|
|
|
|
|
Also used just after a buffer in the buffer
|
|
|
|
|
|
|
|
list has been renamed.
|
|
|
|
|
|
|
|
The BufCreate event is for historic reasons.
|
|
|
|
|
|
|
|
NOTE: When this autocommand is executed, the
|
|
|
|
|
|
|
|
current buffer "%" may be different from the
|
|
|
|
|
|
|
|
buffer being created "<afile>".
|
|
|
|
|
|
|
|
*BufDelete*
|
|
|
|
|
|
|
|
BufDelete Before deleting a buffer from the buffer list.
|
|
|
|
|
|
|
|
The BufUnload may be called first (if the
|
|
|
|
|
|
|
|
buffer was loaded).
|
|
|
|
|
|
|
|
Also used just before a buffer in the buffer
|
|
|
|
|
|
|
|
list is renamed.
|
|
|
|
|
|
|
|
NOTE: When this autocommand is executed, the
|
|
|
|
|
|
|
|
current buffer "%" may be different from the
|
|
|
|
|
|
|
|
buffer being deleted "<afile>".
|
|
|
|
|
|
|
|
*BufEnter*
|
|
|
|
|
|
|
|
BufEnter After entering a buffer. Useful for setting
|
|
|
|
|
|
|
|
options for a file type. Also executed when
|
|
|
|
|
|
|
|
starting to edit a buffer, after the
|
|
|
|
|
|
|
|
BufReadPost autocommands.
|
|
|
|
|
|
|
|
*BufFilePost*
|
|
|
|
|
|
|
|
BufFilePost After changing the name of the current buffer
|
|
|
|
|
|
|
|
with the ":file" or ":saveas" command.
|
|
|
|
|
|
|
|
*BufReadCmd*
|
|
|
|
|
|
|
|
BufFilePre Before changing the name of the current buffer
|
|
|
|
|
|
|
|
with the ":file" or ":saveas" command.
|
|
|
|
|
|
|
|
*BufHidden*
|
|
|
|
|
|
|
|
BufHidden Just after a buffer has become hidden. That
|
|
|
|
|
|
|
|
is, when there are no longer windows that show
|
|
|
|
|
|
|
|
the buffer, but the buffer is not unloaded or
|
|
|
|
|
|
|
|
deleted. Not used for ":qa" or ":q" when
|
|
|
|
|
|
|
|
exiting Vim.
|
|
|
|
|
|
|
|
NOTE: When this autocommand is executed, the
|
|
|
|
|
|
|
|
current buffer "%" may be different from the
|
|
|
|
|
|
|
|
buffer being unloaded "<afile>".
|
|
|
|
|
|
|
|
*BufLeave*
|
|
|
|
|
|
|
|
BufLeave Before leaving to another buffer. Also when
|
|
|
|
|
|
|
|
leaving or closing the current window and the
|
|
|
|
|
|
|
|
new current window is not for the same buffer.
|
|
|
|
|
|
|
|
Not used for ":qa" or ":q" when exiting Vim.
|
|
|
|
|
|
|
|
*BufNew*
|
|
|
|
|
|
|
|
BufNew Just after creating a new buffer. Also used
|
|
|
|
|
|
|
|
just after a buffer has been renamed. When
|
|
|
|
|
|
|
|
the buffer is added to the buffer list BufAdd
|
|
|
|
|
|
|
|
will be triggered too.
|
|
|
|
|
|
|
|
NOTE: When this autocommand is executed, the
|
|
|
|
|
|
|
|
current buffer "%" may be different from the
|
|
|
|
|
|
|
|
buffer being created "<afile>".
|
|
|
|
*BufNewFile*
|
|
|
|
*BufNewFile*
|
|
|
|
BufNewFile When starting to edit a file that doesn't
|
|
|
|
BufNewFile When starting to edit a file that doesn't
|
|
|
|
exist. Can be used to read in a skeleton
|
|
|
|
exist. Can be used to read in a skeleton
|
|
|
|
file.
|
|
|
|
file.
|
|
|
|
*BufReadPre* *E200* *E201*
|
|
|
|
|
|
|
|
BufReadPre When starting to edit a new buffer, before
|
|
|
|
|
|
|
|
reading the file into the buffer. Not used
|
|
|
|
|
|
|
|
if the file doesn't exist.
|
|
|
|
|
|
|
|
*BufRead* *BufReadPost*
|
|
|
|
*BufRead* *BufReadPost*
|
|
|
|
BufRead or BufReadPost When starting to edit a new buffer, after
|
|
|
|
BufRead or BufReadPost When starting to edit a new buffer, after
|
|
|
|
reading the file into the buffer, before
|
|
|
|
reading the file into the buffer, before
|
|
|
|
@ -190,63 +367,49 @@ BufRead or BufReadPost When starting to edit a new buffer, after
|
|
|
|
This does NOT work for ":r file". Not used
|
|
|
|
This does NOT work for ":r file". Not used
|
|
|
|
when the file doesn't exist. Also used after
|
|
|
|
when the file doesn't exist. Also used after
|
|
|
|
successfully recovering a file.
|
|
|
|
successfully recovering a file.
|
|
|
|
*BufReadCmd*
|
|
|
|
*BufReadPre* *E200* *E201*
|
|
|
|
BufReadCmd Before starting to edit a new buffer. Should
|
|
|
|
BufReadCmd Before starting to edit a new buffer. Should
|
|
|
|
read the file into the buffer. |Cmd-event|
|
|
|
|
read the file into the buffer. |Cmd-event|
|
|
|
|
*BufFilePre*
|
|
|
|
*BufFilePre*
|
|
|
|
BufFilePre Before changing the name of the current buffer
|
|
|
|
BufReadPre When starting to edit a new buffer, before
|
|
|
|
with the ":file" or ":saveas" command.
|
|
|
|
reading the file into the buffer. Not used
|
|
|
|
*BufFilePost*
|
|
|
|
if the file doesn't exist.
|
|
|
|
BufFilePost After changing the name of the current buffer
|
|
|
|
*BufUnload*
|
|
|
|
with the ":file" or ":saveas" command.
|
|
|
|
BufUnload Before unloading a buffer. This is when the
|
|
|
|
*FileReadPre*
|
|
|
|
text in the buffer is going to be freed. This
|
|
|
|
FileReadPre Before reading a file with a ":read" command.
|
|
|
|
may be after a BufWritePost and before a
|
|
|
|
*FileReadPost*
|
|
|
|
BufDelete. Also used for all buffers that are
|
|
|
|
FileReadPost After reading a file with a ":read" command.
|
|
|
|
loaded when Vim is going to exit.
|
|
|
|
Note that Vim sets the '[ and '] marks to the
|
|
|
|
NOTE: When this autocommand is executed, the
|
|
|
|
first and last line of the read. This can be
|
|
|
|
current buffer "%" may be different from the
|
|
|
|
used to operate on the lines just read.
|
|
|
|
buffer being unloaded "<afile>".
|
|
|
|
*FileReadCmd*
|
|
|
|
*BufWinEnter*
|
|
|
|
FileReadCmd Before reading a file with a ":read" command.
|
|
|
|
BufWinEnter After a buffer is displayed in a window. This
|
|
|
|
Should do the reading of the file. |Cmd-event|
|
|
|
|
can be when the buffer is loaded (after
|
|
|
|
*FilterReadPre* *E135*
|
|
|
|
processing the modelines), when a hidden
|
|
|
|
FilterReadPre Before reading a file from a filter command.
|
|
|
|
buffer is displayed in a window (and is no
|
|
|
|
Vim checks the pattern against the name of
|
|
|
|
longer hidden) or a buffer already visible in
|
|
|
|
the current buffer, not the name of the
|
|
|
|
a window is also displayed in another window.
|
|
|
|
temporary file that is the output of the
|
|
|
|
*BufWinLeave*
|
|
|
|
filter command.
|
|
|
|
BufWinLeave Before a buffer is removed from a window.
|
|
|
|
Not triggered when 'shelltemp' is off.
|
|
|
|
Not when it's still visible in another window.
|
|
|
|
*FilterReadPost*
|
|
|
|
Also triggered when exiting. It's triggered
|
|
|
|
FilterReadPost After reading a file from a filter command.
|
|
|
|
before BufUnload or BufHidden.
|
|
|
|
Vim checks the pattern against the name of
|
|
|
|
NOTE: When this autocommand is executed, the
|
|
|
|
the current buffer as with FilterReadPre.
|
|
|
|
current buffer "%" may be different from the
|
|
|
|
Not triggered when 'shelltemp' is off.
|
|
|
|
buffer being unloaded "<afile>".
|
|
|
|
*FileType*
|
|
|
|
*BufWipeout*
|
|
|
|
FileType When the 'filetype' option has been set.
|
|
|
|
BufWipeout Before completely deleting a buffer. The
|
|
|
|
<afile> can be used for the name of the file
|
|
|
|
BufUnload and BufDelete events may be called
|
|
|
|
where this option was set, and <amatch> for
|
|
|
|
first (if the buffer was loaded and was in the
|
|
|
|
the new value of 'filetype'.
|
|
|
|
buffer list). Also used just before a buffer
|
|
|
|
See |filetypes|.
|
|
|
|
is renamed (also when it's not in the buffer
|
|
|
|
*Syntax*
|
|
|
|
list).
|
|
|
|
Syntax When the 'syntax' option has been set.
|
|
|
|
NOTE: When this autocommand is executed, the
|
|
|
|
<afile> can be used for the name of the file
|
|
|
|
current buffer "%" may be different from the
|
|
|
|
where this option was set, and <amatch> for
|
|
|
|
buffer being deleted "<afile>".
|
|
|
|
the new value of 'syntax'.
|
|
|
|
|
|
|
|
See |:syn-on|.
|
|
|
|
|
|
|
|
*StdinReadPre*
|
|
|
|
|
|
|
|
StdinReadPre Before reading from stdin into the buffer.
|
|
|
|
|
|
|
|
Only used when the "-" argument was used when
|
|
|
|
|
|
|
|
Vim was started |--|.
|
|
|
|
|
|
|
|
*StdinReadPost*
|
|
|
|
|
|
|
|
StdinReadPost After reading from the stdin into the buffer,
|
|
|
|
|
|
|
|
before executing the modelines. Only used
|
|
|
|
|
|
|
|
when the "-" argument was used when Vim was
|
|
|
|
|
|
|
|
started |--|.
|
|
|
|
|
|
|
|
*BufWrite* *BufWritePre*
|
|
|
|
*BufWrite* *BufWritePre*
|
|
|
|
BufWrite or BufWritePre Before writing the whole buffer to a file.
|
|
|
|
BufWrite or BufWritePre Before writing the whole buffer to a file.
|
|
|
|
*BufWritePost*
|
|
|
|
|
|
|
|
BufWritePost After writing the whole buffer to a file
|
|
|
|
|
|
|
|
(should undo the commands for BufWritePre).
|
|
|
|
|
|
|
|
*BufWriteCmd*
|
|
|
|
*BufWriteCmd*
|
|
|
|
BufWriteCmd Before writing the whole buffer to a file.
|
|
|
|
BufWriteCmd Before writing the whole buffer to a file.
|
|
|
|
Should do the writing of the file and reset
|
|
|
|
Should do the writing of the file and reset
|
|
|
|
@ -254,42 +417,68 @@ BufWriteCmd Before writing the whole buffer to a file.
|
|
|
|
'cpo' and writing to another file |cpo-+|.
|
|
|
|
'cpo' and writing to another file |cpo-+|.
|
|
|
|
The buffer contents should not be changed.
|
|
|
|
The buffer contents should not be changed.
|
|
|
|
|Cmd-event|
|
|
|
|
|Cmd-event|
|
|
|
|
*FileWritePre*
|
|
|
|
*BufWritePost*
|
|
|
|
FileWritePre Before writing to a file, when not writing the
|
|
|
|
BufWritePost After writing the whole buffer to a file
|
|
|
|
whole buffer. Use the '[ and '] marks for the
|
|
|
|
(should undo the commands for BufWritePre).
|
|
|
|
range of lines.
|
|
|
|
*CmdwinEnter*
|
|
|
|
*FileWritePost*
|
|
|
|
CmdwinEnter After entering the command-line window.
|
|
|
|
FileWritePost After writing to a file, when not writing the
|
|
|
|
Useful for setting options specifically for
|
|
|
|
whole buffer.
|
|
|
|
this special type of window. This is
|
|
|
|
*FileWriteCmd*
|
|
|
|
triggered _instead_ of BufEnter and WinEnter.
|
|
|
|
FileWriteCmd Before writing to a file, when not writing the
|
|
|
|
<afile> is set to a single character,
|
|
|
|
whole buffer. Should do the writing to the
|
|
|
|
indicating the type of command-line.
|
|
|
|
file. Should not change the buffer. Use the
|
|
|
|
|cmdwin-char|
|
|
|
|
'[ and '] marks for the range of lines.
|
|
|
|
*CmdwinLeave*
|
|
|
|
|Cmd-event|
|
|
|
|
CmdwinLeave Before leaving the command-line window.
|
|
|
|
*FileAppendPre*
|
|
|
|
Useful to clean up any global setting done
|
|
|
|
FileAppendPre Before appending to a file. Use the '[ and ']
|
|
|
|
with CmdwinEnter. This is triggered _instead_
|
|
|
|
marks for the range of lines.
|
|
|
|
of BufLeave and WinLeave.
|
|
|
|
*FileAppendPost*
|
|
|
|
<afile> is set to a single character,
|
|
|
|
FileAppendPost After appending to a file.
|
|
|
|
indicating the type of command-line.
|
|
|
|
|
|
|
|
|cmdwin-char|
|
|
|
|
|
|
|
|
*ColorScheme*
|
|
|
|
|
|
|
|
ColorScheme After loading a color scheme. |:colorscheme|
|
|
|
|
|
|
|
|
*CursorHold*
|
|
|
|
|
|
|
|
CursorHold When the user doesn't press a key for the time
|
|
|
|
|
|
|
|
specified with 'updatetime'. Not re-triggered
|
|
|
|
|
|
|
|
until the user has pressed a key (i.e. doesn't
|
|
|
|
|
|
|
|
fire every 'updatetime' ms if you leave Vim to
|
|
|
|
|
|
|
|
make some coffee. :) See |CursorHold-example|
|
|
|
|
|
|
|
|
for previewing tags.
|
|
|
|
|
|
|
|
This event is only triggered in Normal mode.
|
|
|
|
|
|
|
|
Note: Interactive commands cannot be used for
|
|
|
|
|
|
|
|
this event. There is no hit-enter prompt,
|
|
|
|
|
|
|
|
the screen is updated directly (when needed).
|
|
|
|
|
|
|
|
Note: In the future there will probably be
|
|
|
|
|
|
|
|
another option to set the time.
|
|
|
|
|
|
|
|
Hint: to force an update of the status lines
|
|
|
|
|
|
|
|
use: >
|
|
|
|
|
|
|
|
:let &ro = &ro
|
|
|
|
|
|
|
|
< {only on Amiga, Unix, Win32, MSDOS and all GUI
|
|
|
|
|
|
|
|
versions}
|
|
|
|
|
|
|
|
*EncodingChanged*
|
|
|
|
|
|
|
|
EncodingChanged Fires off after the 'encoding' option has been
|
|
|
|
|
|
|
|
changed. Useful to set up fonts, for example.
|
|
|
|
*FileAppendCmd*
|
|
|
|
*FileAppendCmd*
|
|
|
|
FileAppendCmd Before appending to a file. Should do the
|
|
|
|
FileAppendCmd Before appending to a file. Should do the
|
|
|
|
appending to the file. Use the '[ and ']
|
|
|
|
appending to the file. Use the '[ and ']
|
|
|
|
marks for the range of lines.|Cmd-event|
|
|
|
|
marks for the range of lines.|Cmd-event|
|
|
|
|
*FilterWritePre*
|
|
|
|
*FileAppendPost*
|
|
|
|
FilterWritePre Before writing a file for a filter command or
|
|
|
|
FileAppendPost After appending to a file.
|
|
|
|
making a diff.
|
|
|
|
*FileAppendPre*
|
|
|
|
Vim checks the pattern against the name of
|
|
|
|
FileAppendPre Before appending to a file. Use the '[ and ']
|
|
|
|
the current buffer, not the name of the
|
|
|
|
marks for the range of lines.
|
|
|
|
temporary file that is the output of the
|
|
|
|
*FileChangedRO*
|
|
|
|
filter command.
|
|
|
|
FileChangedRO Before making the first change to a read-only
|
|
|
|
Not triggered when 'shelltemp' is off.
|
|
|
|
file. Can be used to check-out the file from
|
|
|
|
*FilterWritePost*
|
|
|
|
a source control system. Not triggered when
|
|
|
|
FilterWritePost After writing a file for a filter command or
|
|
|
|
the change was caused by an autocommand.
|
|
|
|
making a diff.
|
|
|
|
This event is triggered when making the first
|
|
|
|
Vim checks the pattern against the name of
|
|
|
|
change in a buffer or the first change after
|
|
|
|
the current buffer as with FilterWritePre.
|
|
|
|
'readonly' was set,
|
|
|
|
Not triggered when 'shelltemp' is off.
|
|
|
|
just before the change is applied to the text.
|
|
|
|
|
|
|
|
WARNING: If the autocommand moves the cursor
|
|
|
|
|
|
|
|
the effect of the change is undefined.
|
|
|
|
*FileChangedShell*
|
|
|
|
*FileChangedShell*
|
|
|
|
FileChangedShell When Vim notices that the modification time of
|
|
|
|
FileChangedShell When Vim notices that the modification time of
|
|
|
|
a file has changed since editing started.
|
|
|
|
a file has changed since editing started.
|
|
|
|
@ -319,17 +508,64 @@ FileChangedShell When Vim notices that the modification time of
|
|
|
|
commands for the FileChangedShell event no
|
|
|
|
commands for the FileChangedShell event no
|
|
|
|
other FileChangedShell event will be
|
|
|
|
other FileChangedShell event will be
|
|
|
|
triggered.
|
|
|
|
triggered.
|
|
|
|
*FileChangedRO*
|
|
|
|
*FileEncoding*
|
|
|
|
FileChangedRO Before making the first change to a read-only
|
|
|
|
FileEncoding Obsolete. It still works and is equivalent
|
|
|
|
file. Can be used to check-out the file from
|
|
|
|
to |EncodingChanged|.
|
|
|
|
a source control system. Not triggered when
|
|
|
|
*FileReadCmd*
|
|
|
|
the change was caused by an autocommand.
|
|
|
|
FileReadCmd Before reading a file with a ":read" command.
|
|
|
|
This event is triggered when making the first
|
|
|
|
Should do the reading of the file. |Cmd-event|
|
|
|
|
change in a buffer or the first change after
|
|
|
|
*FileReadPost*
|
|
|
|
'readonly' was set,
|
|
|
|
FileReadPost After reading a file with a ":read" command.
|
|
|
|
just before the change is applied to the text.
|
|
|
|
Note that Vim sets the '[ and '] marks to the
|
|
|
|
WARNING: If the autocommand moves the cursor
|
|
|
|
first and last line of the read. This can be
|
|
|
|
the effect of the change is undefined.
|
|
|
|
used to operate on the lines just read.
|
|
|
|
|
|
|
|
*FileReadPre*
|
|
|
|
|
|
|
|
FileReadPre Before reading a file with a ":read" command.
|
|
|
|
|
|
|
|
*FileType*
|
|
|
|
|
|
|
|
FileType When the 'filetype' option has been set.
|
|
|
|
|
|
|
|
<afile> can be used for the name of the file
|
|
|
|
|
|
|
|
where this option was set, and <amatch> for
|
|
|
|
|
|
|
|
the new value of 'filetype'.
|
|
|
|
|
|
|
|
See |filetypes|.
|
|
|
|
|
|
|
|
*FileWriteCmd*
|
|
|
|
|
|
|
|
FileWriteCmd Before writing to a file, when not writing the
|
|
|
|
|
|
|
|
whole buffer. Should do the writing to the
|
|
|
|
|
|
|
|
file. Should not change the buffer. Use the
|
|
|
|
|
|
|
|
'[ and '] marks for the range of lines.
|
|
|
|
|
|
|
|
|Cmd-event|
|
|
|
|
|
|
|
|
*FileWritePost*
|
|
|
|
|
|
|
|
FileWritePost After writing to a file, when not writing the
|
|
|
|
|
|
|
|
whole buffer.
|
|
|
|
|
|
|
|
*FileWritePre*
|
|
|
|
|
|
|
|
FileWritePre Before writing to a file, when not writing the
|
|
|
|
|
|
|
|
whole buffer. Use the '[ and '] marks for the
|
|
|
|
|
|
|
|
range of lines.
|
|
|
|
|
|
|
|
*FilterReadPost*
|
|
|
|
|
|
|
|
FilterReadPost After reading a file from a filter command.
|
|
|
|
|
|
|
|
Vim checks the pattern against the name of
|
|
|
|
|
|
|
|
the current buffer as with FilterReadPre.
|
|
|
|
|
|
|
|
Not triggered when 'shelltemp' is off.
|
|
|
|
|
|
|
|
*FilterReadPre* *E135*
|
|
|
|
|
|
|
|
FilterReadPre Before reading a file from a filter command.
|
|
|
|
|
|
|
|
Vim checks the pattern against the name of
|
|
|
|
|
|
|
|
the current buffer, not the name of the
|
|
|
|
|
|
|
|
temporary file that is the output of the
|
|
|
|
|
|
|
|
filter command.
|
|
|
|
|
|
|
|
Not triggered when 'shelltemp' is off.
|
|
|
|
|
|
|
|
*FilterWritePost*
|
|
|
|
|
|
|
|
FilterWritePost After writing a file for a filter command or
|
|
|
|
|
|
|
|
making a diff.
|
|
|
|
|
|
|
|
Vim checks the pattern against the name of
|
|
|
|
|
|
|
|
the current buffer as with FilterWritePre.
|
|
|
|
|
|
|
|
Not triggered when 'shelltemp' is off.
|
|
|
|
|
|
|
|
*FilterWritePre*
|
|
|
|
|
|
|
|
FilterWritePre Before writing a file for a filter command or
|
|
|
|
|
|
|
|
making a diff.
|
|
|
|
|
|
|
|
Vim checks the pattern against the name of
|
|
|
|
|
|
|
|
the current buffer, not the name of the
|
|
|
|
|
|
|
|
temporary file that is the output of the
|
|
|
|
|
|
|
|
filter command.
|
|
|
|
|
|
|
|
Not triggered when 'shelltemp' is off.
|
|
|
|
*FocusGained*
|
|
|
|
*FocusGained*
|
|
|
|
FocusGained When Vim got input focus. Only for the GUI
|
|
|
|
FocusGained When Vim got input focus. Only for the GUI
|
|
|
|
version and a few console versions where this
|
|
|
|
version and a few console versions where this
|
|
|
|
@ -345,104 +581,134 @@ FuncUndefined When a user function is used but it isn't
|
|
|
|
when it's used. Both <amatch> and <afile> are
|
|
|
|
when it's used. Both <amatch> and <afile> are
|
|
|
|
set to the name of the function.
|
|
|
|
set to the name of the function.
|
|
|
|
See |autoload-functions|.
|
|
|
|
See |autoload-functions|.
|
|
|
|
*CursorHold*
|
|
|
|
*GUIEnter*
|
|
|
|
CursorHold When the user doesn't press a key for the time
|
|
|
|
GUIEnter After starting the GUI successfully, and after
|
|
|
|
specified with 'updatetime'. Not re-triggered
|
|
|
|
opening the window. It is triggered before
|
|
|
|
until the user has pressed a key (i.e. doesn't
|
|
|
|
VimEnter when using gvim. Can be used to
|
|
|
|
fire every 'updatetime' ms if you leave Vim to
|
|
|
|
position the window from a .gvimrc file: >
|
|
|
|
make some coffee. :) See |CursorHold-example|
|
|
|
|
:autocmd GUIEnter * winpos 100 50
|
|
|
|
for previewing tags.
|
|
|
|
< *InsertChange*
|
|
|
|
This event is only triggered in Normal mode.
|
|
|
|
InsertChange When typing <Insert> while in Insert or
|
|
|
|
Note: Interactive commands cannot be used for
|
|
|
|
Replace mode. The |v:insertmode| variable
|
|
|
|
this event. There is no hit-enter prompt,
|
|
|
|
indicates the new mode.
|
|
|
|
the screen is updated directly (when needed).
|
|
|
|
Be careful not to move the cursor or do
|
|
|
|
Note: In the future there will probably be
|
|
|
|
anything else that the user does not expect.
|
|
|
|
another option to set the time.
|
|
|
|
*InsertEnter*
|
|
|
|
Hint: to force an update of the status lines
|
|
|
|
InsertEnter When starting Insert mode. Also for Replace
|
|
|
|
use: >
|
|
|
|
mode and Virtual Replace mode. The
|
|
|
|
:let &ro = &ro
|
|
|
|
|v:insertmode| variable indicates the mode.
|
|
|
|
< {only on Amiga, Unix, Win32, MSDOS and all GUI
|
|
|
|
Be careful not to move the cursor or do
|
|
|
|
versions}
|
|
|
|
anything else that the user does not expect.
|
|
|
|
*BufEnter*
|
|
|
|
*InsertLeave*
|
|
|
|
BufEnter After entering a buffer. Useful for setting
|
|
|
|
InsertLeave When leaving Insert mode. Also when using
|
|
|
|
options for a file type. Also executed when
|
|
|
|
CTRL-O |i_CTRL-O|. But not for |i_CTRL-C|.
|
|
|
|
starting to edit a buffer, after the
|
|
|
|
*MenuPopup*
|
|
|
|
BufReadPost autocommands.
|
|
|
|
MenuPopup Just before showing the popup menu (under the
|
|
|
|
*BufLeave*
|
|
|
|
right mouse button). Useful for adjusting the
|
|
|
|
BufLeave Before leaving to another buffer. Also when
|
|
|
|
menu for what is under the cursor or mouse
|
|
|
|
leaving or closing the current window and the
|
|
|
|
pointer.
|
|
|
|
new current window is not for the same buffer.
|
|
|
|
The pattern is matched against a single
|
|
|
|
Not used for ":qa" or ":q" when exiting Vim.
|
|
|
|
character representing the mode:
|
|
|
|
*BufWinEnter*
|
|
|
|
n Normal
|
|
|
|
BufWinEnter After a buffer is displayed in a window. This
|
|
|
|
v Visual
|
|
|
|
can be when the buffer is loaded (after
|
|
|
|
o Operator-pending
|
|
|
|
processing the modelines), when a hidden
|
|
|
|
i Insert
|
|
|
|
buffer is displayed in a window (and is no
|
|
|
|
c Commmand line
|
|
|
|
longer hidden) or a buffer already visible in
|
|
|
|
*QuickFixCmdPre*
|
|
|
|
a window is also displayed in another window.
|
|
|
|
QuickFixCmdPre Before a quickfix command is run (|:make|,
|
|
|
|
*BufWinLeave*
|
|
|
|
|:grep|, |:grepadd|, |:vimgrep|,
|
|
|
|
BufWinLeave Before a buffer is removed from a window.
|
|
|
|
|:vimgrepadd|). The pattern is matched against
|
|
|
|
Not when it's still visible in another window.
|
|
|
|
the command being run. When |:grep| is used
|
|
|
|
Also triggered when exiting. It's triggered
|
|
|
|
but 'grepprg' is set to "internal" it still
|
|
|
|
before BufUnload or BufHidden.
|
|
|
|
matches "grep".
|
|
|
|
NOTE: When this autocommand is executed, the
|
|
|
|
This command cannot be used to set the
|
|
|
|
current buffer "%" may be different from the
|
|
|
|
'makeprg' and 'grepprg' variables.
|
|
|
|
buffer being unloaded "<afile>".
|
|
|
|
If this command causes an error, the quickfix
|
|
|
|
*BufUnload*
|
|
|
|
command is not executed.
|
|
|
|
BufUnload Before unloading a buffer. This is when the
|
|
|
|
*QuickFixCmdPost*
|
|
|
|
text in the buffer is going to be freed. This
|
|
|
|
QuickFixCmdPost Like QuickFixCmdPre, but after a quickfix
|
|
|
|
may be after a BufWritePost and before a
|
|
|
|
command is run.
|
|
|
|
BufDelete. Also used for all buffers that are
|
|
|
|
*RemoteReply*
|
|
|
|
loaded when Vim is going to exit.
|
|
|
|
RemoteReply When a reply from a Vim that functions as
|
|
|
|
NOTE: When this autocommand is executed, the
|
|
|
|
server was received |server2client()|.
|
|
|
|
current buffer "%" may be different from the
|
|
|
|
<amatch> is equal to the {serverid} from which
|
|
|
|
buffer being unloaded "<afile>".
|
|
|
|
the reply was sent, and <afile> is the actual
|
|
|
|
*BufHidden*
|
|
|
|
reply string.
|
|
|
|
BufHidden Just after a buffer has become hidden. That
|
|
|
|
Note that even if an autocommand is defined,
|
|
|
|
is, when there are no longer windows that show
|
|
|
|
the reply should be read with |remote_read()|
|
|
|
|
the buffer, but the buffer is not unloaded or
|
|
|
|
to consume it.
|
|
|
|
deleted. Not used for ":qa" or ":q" when
|
|
|
|
*SessionLoadPost*
|
|
|
|
exiting Vim.
|
|
|
|
SessionLoadPost After loading the session file created using
|
|
|
|
NOTE: When this autocommand is executed, the
|
|
|
|
the |:mksession| command.
|
|
|
|
current buffer "%" may be different from the
|
|
|
|
*StdinReadPost*
|
|
|
|
buffer being unloaded "<afile>".
|
|
|
|
StdinReadPost After reading from the stdin into the buffer,
|
|
|
|
*BufNew*
|
|
|
|
before executing the modelines. Only used
|
|
|
|
BufNew Just after creating a new buffer. Also used
|
|
|
|
when the "-" argument was used when Vim was
|
|
|
|
just after a buffer has been renamed. When
|
|
|
|
started |--|.
|
|
|
|
the buffer is added to the buffer list BufAdd
|
|
|
|
*StdinReadPre*
|
|
|
|
will be triggered too.
|
|
|
|
StdinReadPre Before reading from stdin into the buffer.
|
|
|
|
NOTE: When this autocommand is executed, the
|
|
|
|
Only used when the "-" argument was used when
|
|
|
|
current buffer "%" may be different from the
|
|
|
|
Vim was started |--|.
|
|
|
|
buffer being created "<afile>".
|
|
|
|
*SwapExists*
|
|
|
|
*BufCreate* *BufAdd*
|
|
|
|
SwapExists Detected an existing swap file when starting
|
|
|
|
BufAdd or BufCreate Just after creating a new buffer which is
|
|
|
|
to edit a file. Only when it is possible to
|
|
|
|
added to the buffer list, or adding a buffer
|
|
|
|
select a way to handle the situation, when Vim
|
|
|
|
to the buffer list.
|
|
|
|
would ask the user what to do.
|
|
|
|
Also used just after a buffer in the buffer
|
|
|
|
The |v:swapname| variable holds the name of
|
|
|
|
list has been renamed.
|
|
|
|
the swap file found.
|
|
|
|
The BufCreate event is for historic reasons.
|
|
|
|
The |v:swapchoice| variable should be set to
|
|
|
|
NOTE: When this autocommand is executed, the
|
|
|
|
a string with one character to tell what Vim
|
|
|
|
current buffer "%" may be different from the
|
|
|
|
should do next:
|
|
|
|
buffer being created "<afile>".
|
|
|
|
'o' open read-only
|
|
|
|
*BufDelete*
|
|
|
|
'e' edit the file anyway
|
|
|
|
BufDelete Before deleting a buffer from the buffer list.
|
|
|
|
'r' recover
|
|
|
|
The BufUnload may be called first (if the
|
|
|
|
'd' delete the swap file
|
|
|
|
buffer was loaded).
|
|
|
|
'q' quit, don't edit the file
|
|
|
|
Also used just before a buffer in the buffer
|
|
|
|
'a' abort, like hitting CTRL-C
|
|
|
|
list is renamed.
|
|
|
|
When set to an empty string the user will be
|
|
|
|
NOTE: When this autocommand is executed, the
|
|
|
|
asked, as if there was no SwapExists autocmd.
|
|
|
|
current buffer "%" may be different from the
|
|
|
|
Note: Do not try to change the buffer, the
|
|
|
|
buffer being deleted "<afile>".
|
|
|
|
results are unpredictable.
|
|
|
|
*BufWipeout*
|
|
|
|
*Syntax*
|
|
|
|
BufWipeout Before completely deleting a buffer. The
|
|
|
|
Syntax When the 'syntax' option has been set.
|
|
|
|
BufUnload and BufDelete events may be called
|
|
|
|
<afile> can be used for the name of the file
|
|
|
|
first (if the buffer was loaded and was in the
|
|
|
|
where this option was set, and <amatch> for
|
|
|
|
buffer list). Also used just before a buffer
|
|
|
|
the new value of 'syntax'.
|
|
|
|
is renamed (also when it's not in the buffer
|
|
|
|
See |:syn-on|.
|
|
|
|
list).
|
|
|
|
*TermChanged*
|
|
|
|
NOTE: When this autocommand is executed, the
|
|
|
|
TermChanged After the value of 'term' has changed. Useful
|
|
|
|
current buffer "%" may be different from the
|
|
|
|
for re-loading the syntax file to update the
|
|
|
|
buffer being deleted "<afile>".
|
|
|
|
colors, fonts and other terminal-dependent
|
|
|
|
|
|
|
|
settings. Executed for all loaded buffers.
|
|
|
|
|
|
|
|
*TermResponse*
|
|
|
|
|
|
|
|
TermResponse After the response to |t_RV| is received from
|
|
|
|
|
|
|
|
the terminal. The value of |v:termresponse|
|
|
|
|
|
|
|
|
can be used to do things depending on the
|
|
|
|
|
|
|
|
terminal version.
|
|
|
|
|
|
|
|
*User*
|
|
|
|
|
|
|
|
User Never executed automatically. To be used for
|
|
|
|
|
|
|
|
autocommands that are only executed with
|
|
|
|
|
|
|
|
":doautocmd".
|
|
|
|
|
|
|
|
*UserGettingBored*
|
|
|
|
|
|
|
|
UserGettingBored When the user hits CTRL-C. Just kidding! :-)
|
|
|
|
|
|
|
|
*VimEnter*
|
|
|
|
|
|
|
|
VimEnter After doing all the startup stuff, including
|
|
|
|
|
|
|
|
loading .vimrc files, executing the "-c cmd"
|
|
|
|
|
|
|
|
arguments, creating all windows and loading
|
|
|
|
|
|
|
|
the buffers in them.
|
|
|
|
|
|
|
|
*VimLeave*
|
|
|
|
|
|
|
|
VimLeave Before exiting Vim, just after writing the
|
|
|
|
|
|
|
|
.viminfo file. Executed only once, like
|
|
|
|
|
|
|
|
VimLeavePre.
|
|
|
|
|
|
|
|
To detect an abnormal exit use |v:dying|.
|
|
|
|
|
|
|
|
*VimLeavePre*
|
|
|
|
|
|
|
|
VimLeavePre Before exiting Vim, just before writing the
|
|
|
|
|
|
|
|
.viminfo file. This is executed only once,
|
|
|
|
|
|
|
|
if there is a match with the name of what
|
|
|
|
|
|
|
|
happens to be the current buffer when exiting.
|
|
|
|
|
|
|
|
Mostly useful with a "*" pattern. >
|
|
|
|
|
|
|
|
:autocmd VimLeavePre * call CleanupStuff()
|
|
|
|
|
|
|
|
< To detect an abnormal exit use |v:dying|.
|
|
|
|
*WinEnter*
|
|
|
|
*WinEnter*
|
|
|
|
WinEnter After entering another window. Not done for
|
|
|
|
WinEnter After entering another window. Not done for
|
|
|
|
the first window, when Vim has just started.
|
|
|
|
the first window, when Vim has just started.
|
|
|
|
@ -459,145 +725,6 @@ WinLeave Before leaving a window. If the window to be
|
|
|
|
executes the BufLeave autocommands before the
|
|
|
|
executes the BufLeave autocommands before the
|
|
|
|
WinLeave autocommands (but not for ":new").
|
|
|
|
WinLeave autocommands (but not for ":new").
|
|
|
|
Not used for ":qa" or ":q" when exiting Vim.
|
|
|
|
Not used for ":qa" or ":q" when exiting Vim.
|
|
|
|
*CmdwinEnter*
|
|
|
|
|
|
|
|
CmdwinEnter After entering the command-line window.
|
|
|
|
|
|
|
|
Useful for setting options specifically for
|
|
|
|
|
|
|
|
this special type of window. This is
|
|
|
|
|
|
|
|
triggered _instead_ of BufEnter and WinEnter.
|
|
|
|
|
|
|
|
<afile> is set to a single character,
|
|
|
|
|
|
|
|
indicating the type of command-line.
|
|
|
|
|
|
|
|
|cmdwin-char|
|
|
|
|
|
|
|
|
*CmdwinLeave*
|
|
|
|
|
|
|
|
CmdwinLeave Before leaving the command-line window.
|
|
|
|
|
|
|
|
Useful to clean up any global setting done
|
|
|
|
|
|
|
|
with CmdwinEnter. This is triggered _instead_
|
|
|
|
|
|
|
|
of BufLeave and WinLeave.
|
|
|
|
|
|
|
|
<afile> is set to a single character,
|
|
|
|
|
|
|
|
indicating the type of command-line.
|
|
|
|
|
|
|
|
|cmdwin-char|
|
|
|
|
|
|
|
|
*GUIEnter*
|
|
|
|
|
|
|
|
GUIEnter After starting the GUI successfully, and after
|
|
|
|
|
|
|
|
opening the window. It is triggered before
|
|
|
|
|
|
|
|
VimEnter when using gvim. Can be used to
|
|
|
|
|
|
|
|
position the window from a .gvimrc file: >
|
|
|
|
|
|
|
|
:autocmd GUIEnter * winpos 100 50
|
|
|
|
|
|
|
|
< *VimEnter*
|
|
|
|
|
|
|
|
VimEnter After doing all the startup stuff, including
|
|
|
|
|
|
|
|
loading .vimrc files, executing the "-c cmd"
|
|
|
|
|
|
|
|
arguments, creating all windows and loading
|
|
|
|
|
|
|
|
the buffers in them.
|
|
|
|
|
|
|
|
*VimLeavePre*
|
|
|
|
|
|
|
|
VimLeavePre Before exiting Vim, just before writing the
|
|
|
|
|
|
|
|
.viminfo file. This is executed only once,
|
|
|
|
|
|
|
|
if there is a match with the name of what
|
|
|
|
|
|
|
|
happens to be the current buffer when exiting.
|
|
|
|
|
|
|
|
Mostly useful with a "*" pattern. >
|
|
|
|
|
|
|
|
:autocmd VimLeavePre * call CleanupStuff()
|
|
|
|
|
|
|
|
< To detect an abnormal exit use |v:dying|.
|
|
|
|
|
|
|
|
*VimLeave*
|
|
|
|
|
|
|
|
VimLeave Before exiting Vim, just after writing the
|
|
|
|
|
|
|
|
.viminfo file. Executed only once, like
|
|
|
|
|
|
|
|
VimLeavePre.
|
|
|
|
|
|
|
|
To detect an abnormal exit use |v:dying|.
|
|
|
|
|
|
|
|
*EncodingChanged*
|
|
|
|
|
|
|
|
EncodingChanged Fires off after the 'encoding' option has been
|
|
|
|
|
|
|
|
changed. Useful to set up fonts, for example.
|
|
|
|
|
|
|
|
*InsertEnter*
|
|
|
|
|
|
|
|
InsertEnter When starting Insert mode. Also for Replace
|
|
|
|
|
|
|
|
mode and Virtual Replace mode. The
|
|
|
|
|
|
|
|
|v:insertmode| variable indicates the mode.
|
|
|
|
|
|
|
|
Be careful not to move the cursor or do
|
|
|
|
|
|
|
|
anything else that the user does not expect.
|
|
|
|
|
|
|
|
*InsertChange*
|
|
|
|
|
|
|
|
InsertChange When typing <Insert> while in Insert or
|
|
|
|
|
|
|
|
Replace mode. The |v:insertmode| variable
|
|
|
|
|
|
|
|
indicates the new mode.
|
|
|
|
|
|
|
|
Be careful not to move the cursor or do
|
|
|
|
|
|
|
|
anything else that the user does not expect.
|
|
|
|
|
|
|
|
*InsertLeave*
|
|
|
|
|
|
|
|
InsertLeave When leaving Insert mode. Also when using
|
|
|
|
|
|
|
|
CTRL-O |i_CTRL-O|. But not for |i_CTRL-C|.
|
|
|
|
|
|
|
|
*FileEncoding*
|
|
|
|
|
|
|
|
FileEncoding Obsolete. It still works and is equivalent
|
|
|
|
|
|
|
|
to |EncodingChanged|.
|
|
|
|
|
|
|
|
*ColorScheme*
|
|
|
|
|
|
|
|
ColorScheme After loading a color scheme. |:colorscheme|
|
|
|
|
|
|
|
|
*RemoteReply*
|
|
|
|
|
|
|
|
RemoteReply When a reply from a Vim that functions as
|
|
|
|
|
|
|
|
server was received |server2client()|.
|
|
|
|
|
|
|
|
<amatch> is equal to the {serverid} from which
|
|
|
|
|
|
|
|
the reply was sent, and <afile> is the actual
|
|
|
|
|
|
|
|
reply string.
|
|
|
|
|
|
|
|
Note that even if an autocommand is defined,
|
|
|
|
|
|
|
|
the reply should be read with |remote_read()|
|
|
|
|
|
|
|
|
to consume it.
|
|
|
|
|
|
|
|
*TermChanged*
|
|
|
|
|
|
|
|
TermChanged After the value of 'term' has changed. Useful
|
|
|
|
|
|
|
|
for re-loading the syntax file to update the
|
|
|
|
|
|
|
|
colors, fonts and other terminal-dependent
|
|
|
|
|
|
|
|
settings. Executed for all loaded buffers.
|
|
|
|
|
|
|
|
*TermResponse*
|
|
|
|
|
|
|
|
TermResponse After the response to |t_RV| is received from
|
|
|
|
|
|
|
|
the terminal. The value of |v:termresponse|
|
|
|
|
|
|
|
|
can be used to do things depending on the
|
|
|
|
|
|
|
|
terminal version.
|
|
|
|
|
|
|
|
QuickFixCmdPre *QuickFixCmdPre*
|
|
|
|
|
|
|
|
Before a quickfix command is run (|:make|,
|
|
|
|
|
|
|
|
|:grep|, |:grepadd|, |:vimgrep|,
|
|
|
|
|
|
|
|
|:vimgrepadd|). The pattern is matched against
|
|
|
|
|
|
|
|
the command being run. When |:grep| is used
|
|
|
|
|
|
|
|
but 'grepprg' is set to "internal" it still
|
|
|
|
|
|
|
|
matches "grep".
|
|
|
|
|
|
|
|
This command cannot be used to set the
|
|
|
|
|
|
|
|
'makeprg' and 'grepprg' variables.
|
|
|
|
|
|
|
|
If this command causes an error, the quickfix
|
|
|
|
|
|
|
|
command is not executed.
|
|
|
|
|
|
|
|
QuickFixCmdPost *QuickFixCmdPost*
|
|
|
|
|
|
|
|
like QuickFixCmdPre, but after a quickfix
|
|
|
|
|
|
|
|
command is run.
|
|
|
|
|
|
|
|
*SessionLoadPost*
|
|
|
|
|
|
|
|
SessionLoadPost After loading the session file created using
|
|
|
|
|
|
|
|
the |:mksession| command.
|
|
|
|
|
|
|
|
*MenuPopup*
|
|
|
|
|
|
|
|
MenuPopup Just before showing the popup menu (under the
|
|
|
|
|
|
|
|
right mouse button). Useful for adjusting the
|
|
|
|
|
|
|
|
menu for what is under the cursor or mouse
|
|
|
|
|
|
|
|
pointer.
|
|
|
|
|
|
|
|
The pattern is matched against a single
|
|
|
|
|
|
|
|
character representing the mode:
|
|
|
|
|
|
|
|
n Normal
|
|
|
|
|
|
|
|
v Visual
|
|
|
|
|
|
|
|
o Operator-pending
|
|
|
|
|
|
|
|
i Insert
|
|
|
|
|
|
|
|
c Commmand line
|
|
|
|
|
|
|
|
*UserGettingBored*
|
|
|
|
|
|
|
|
UserGettingBored When the user hits CTRL-C. Just kidding! :-)
|
|
|
|
|
|
|
|
*User*
|
|
|
|
|
|
|
|
User Never executed automatically. To be used for
|
|
|
|
|
|
|
|
autocommands that are only executed with
|
|
|
|
|
|
|
|
":doautocmd".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
You can specify a comma-separated list of event names. No white space can be
|
|
|
|
|
|
|
|
used in this list. The command applies to all the events in the list.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
For READING FILES there are four kinds of events possible:
|
|
|
|
|
|
|
|
BufNewFile starting to edit a non-existent file
|
|
|
|
|
|
|
|
BufReadPre BufReadPost starting to edit an existing file
|
|
|
|
|
|
|
|
FilterReadPre FilterReadPost read the temp file with filter output
|
|
|
|
|
|
|
|
FileReadPre FileReadPost any other file read
|
|
|
|
|
|
|
|
Vim uses only one of these four kinds when reading a file. The "Pre" and
|
|
|
|
|
|
|
|
"Post" events are both triggered, before and after reading the file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Note that the autocommands for the *ReadPre events and all the Filter events
|
|
|
|
|
|
|
|
are not allowed to change the current buffer (you will get an error message if
|
|
|
|
|
|
|
|
this happens). This is to prevent the file to be read into the wrong buffer.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Note that the 'modified' flag is reset AFTER executing the BufReadPost
|
|
|
|
|
|
|
|
and BufNewFile autocommands. But when the 'modified' option was set by the
|
|
|
|
|
|
|
|
autocommands, this doesn't happen.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
You can use the 'eventignore' option to ignore a number of events or all
|
|
|
|
|
|
|
|
events.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
==============================================================================
|
|
|
|
6. Patterns *autocmd-patterns* *{pat}*
|
|
|
|
6. Patterns *autocmd-patterns* *{pat}*
|
|
|
|
|