When starting to edit a file that doesn't exist.
Can be used to read in a skeleton file.
Not triggered for the :read file command when the file doesn't exist See BufWinEnter to do something after processing modelines.
When the state of channel changed, for instance the client of a RPC channel described itself.
See nvim_get_chan_info()
for the format of the info Dictionary.
Just after a channel opens.
See nvim_get_chan_info()
for the format of the info Dictionary.
When an undefined user-command is called.
Useful for defining a command only when it's used.
The pattern is matched against the command name.
Both <amatch>
and <afile>
expand to the command name.
Note that Autocompletion won't work until the command is defined.
An alternative is to always define the user-command and have it invoke an autoloaded function.
After a change was made to the text inside the command-line.
Be careful not to mess up the command-line, it may cause Neovim to lock up.
<afile>
expands to the cmdline-char.
After entering the command-line.
The pattern is matched against cmdline-char.
<afile>
expands to the cmdline-char.
After entering the command-line window.
Useful for setting options specifically for this special type of window.
<afile>
expands to a single character, indicating the type of command-line.
Before leaving the command-line window.
Useful to clean up any global setting done with CmdwinEnter.
<afile>
expands to a single character, indicating the type of command-line.
After loading a color scheme.
Not triggered if the color scheme is not found.
The pattern is matched against the colorscheme name.
<afile>
can be used for the name of the actual file where this option was set, and
<amatch>
for the new colorscheme name.
Before loading a color scheme.
Useful to setup removing things added by a color scheme, before another one is loaded.
After each time the insert mode completion menu changed.
Not fired on popup menu hide, use CompleteDonePre or CompleteDone for that.
After insert mode completion is done, either when something was completed or abandoning completion.
After insert mode completion is done, either when something was completed or abandoning completion.
When in normal mode and the user doesn't press a key for the time specified with 'updatetime'.
After the cursor was moved, in insert mode.
Not triggered when the popup menu is visible. Otherwise the same as CursorMoved.
After diffs have been updated.
Depending on what kind of diff is being used (internal or external) this can be triggered on every change or when doing :diffupdate.
After the current-directory was changed.
Can be used to close any non-essential window. Exiting may still be cancelled if there is a modified buffer that isn't automatically saved, use VimLeavePre for really exiting.
Before appending to a file.
Should do the appending to the file.
Use the '[
and ']
marks for the range of lines.
After appending to a file.
Before making the first change to a read-only file.
When making the first change in a buffer
When making the first change after 'readonly' was set, just before the change is applied to the text.
Can be used to checkout the file from a source control system. Not triggered when the change was caused by an auto-command.
When Neovim notices that the modification time of a file has changed since editing started.
When the file attributes of the file change
When the size of the file changes.
Triggered for each changed file, after executing a shell command
After handling a file that was changed outside of Neovim.
Can be used to update the statusline.
After reading a file from a filter command.
Neovim checks the pattern against the name of the current buffer as with FilterReadPre. Not triggered when 'shelltemp' is off.
After writing a file for a filter command or making a diff with an external diff
Neovim checks the pattern against the name of the current buffer as with FilterWritePre. Not triggered when 'shelltemp' is off. See DiffUpdated for internal diff.
When Neovim gains focus.
When Neovim loses focus.
Possibly when a GUI dialog pops up.
When an undefined user-function is called.
Useful for defining a function only when it's used.
The pattern is matched against the function name.
Both <amatch>
and <afile>
are set to the name of the function.
When a character is typed in insert mode, before inserting the char.
The v:char variable indicates the char typed and can be changed during the event to insert a different character. When v:char is set to more than one character this text is inserted literally. Cannot change the text.
The v:insertmode variable indicates the mode. Be careful not to do anything else that the user does not expect. The cursor is restored afterwards. If you do not want that set v:char to a non-empty string.
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 one or two characters representing the mode.
After changing the mode.
The pattern is matched against 'old_mode:new_mode', for example match against *:c to simulate CmdlineEnter.
When a reply from a Neovim that functions as server was received
server2client()
.
The pattern is matched against the {serverid}.
<amatch>
is equal to the {serverid} from which the reply was sent, and <afile>
is the actual reply string.
When nothing is pending, going to wait for the user to type a character.
After executing a shell command with :!cmd, :make, and :grep.
Can be used to check for any changed files. For non-blocking shell commands, see job-control.
After executing a shell command with :{range}!cmd, :w !cmd, or :r !cmd.
Can be used to check for any changed files.
After Neovim receives a signal.
The pattern is matched against the signal name. Only "SIGUSR1" and "SIGWINCH" are supported.
When sourcing a vim/lua file.
:source <afile>
is the name of the file being sourced.
The auto-command must source this file.
After sourcing a vim/lua file.
After a SourceCmd auto-command was triggered.
:source <afile>
is the name of the file being sourced.
Not triggered when sourcing was interrupted.
When trying to load a spell checking file and it can't be found.
The pattern is matched against the language.
<amatch>
is the language,
'encoding' also matters.
When an existing swap file is detected when starting to edit a file.
When a terminal job ends.
When a terminal job emits an
OSC
orDCS
sequence.
When used from Lua, the request string is included in the "data" field of the auto-command callback.
When Neovim receives an
OSC
orDCS
response from the terminal.
When used from Lua, the response string is included in the "data" field of the auto-command callback. May be triggered halfway through another event (file I/O, a shell command, or anything else that takes time).
That is after b:changedtick has changed (also when that happened before the TextChanged auto-command was defined). Not triggered when there is typeahead or when an operator is pending. Careful - This is triggered very often, don't do anything that the user does not expect or that is slow.
After a change was made to the text in the current buffer in Terminal-mode.
Otherwise the same as TextChanged.
Just after a yank or deleting command, but not if the black-hole register
quote_ is used nor for setreg()
.
Pattern must be "*".
Not executed automatically. Use :doautocmd to trigger this, typically for "custom events" in a plugin.
Before exiting Neovim, just after writing the
.shada
file.
Executed only once, like VimLeavePre.
After Neovim resumes from suspend state.
Before Neovim enters suspend state.
After entering another window.
Not fired for the first window, when Neovim has just started. Useful for setting the window height. If the window is for another buffer, Neovim executes the BufEnter auto-commands after the WinEnter auto-commands.