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
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.
After entering the command-line.
The pattern is matched against cmdline-char.
After entering the command-line window.
Useful for setting options specifically for this special type of window.
Before leaving the command-line window.
Useful to clean up any global setting done with CmdwinEnter.
After loading a color scheme.
Not triggered if the color scheme is not found.
The pattern is matched against the 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 after 'readonly' was set, just before the change is applied to the text.
When making the first change in a buffer
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.
Possibly when a GUI dialog pops up.
When Neovim loses focus.
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
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}.
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
After a SourceCmd auto-command was triggered.
After sourcing a vim/lua file.
:source
When trying to load a spell checking file and it can't be found.
The pattern is matched against the language.
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.