Home Explore Blog CI



neovim

8th chunk of `runtime/doc/autocmd.txt`
5c1df8fecac6da53c37192d32d2f98fd3ef53c4ff8ec605d0000000100000fa4
			For an example see |match-parens|.
				Note: Cannot be skipped with |:noautocmd|.
				Careful: This is triggered very often, don't
				do anything that the user does not expect or
				that is slow.
							*CursorMovedC*
CursorMovedC			After the cursor was moved in the command
				line.  Be careful not to mess up the command
				line, it may cause Vim to lock up.
				<afile> expands to the |cmdline-char|.
							*CursorMovedI*
CursorMovedI			After the cursor was moved in Insert mode.
				Not triggered when the popup menu is visible.
				Otherwise the same as CursorMoved.
							*DiffUpdated*
DiffUpdated			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|.
							*DirChanged*
DirChanged			After the |current-directory| was changed.
				The pattern can be:
					"window"  to trigger on `:lcd`
					"tabpage" to trigger on `:tcd`
					"global"  to trigger on `:cd`
					"auto"    to trigger on 'autochdir'.
				Sets these |v:event| keys:
				    cwd:            current working directory
				    scope:          "global", "tabpage", "window"
				    changed_window: v:true if we fired the event
				                    switching window (or tab)
				<afile> is set to the new directory name.
				Non-recursive (event cannot trigger itself).
							*DirChangedPre*
DirChangedPre			When the |current-directory| is going to be
				changed, as with |DirChanged|.
				The pattern is like with |DirChanged|.
				Sets these |v:event| keys:
				    directory:      new working directory
				    scope:          "global", "tabpage", "window"
				    changed_window: v:true if we fired the event
				                    switching window (or tab)
				<afile> is set to the new directory name.
				Non-recursive (event cannot trigger itself).
							*ExitPre*
ExitPre				When using `:quit`, `:wq` in a way it makes
				Vim exit, or using `:qall`, just after
				|QuitPre|.  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.
				See also |QuitPre|, |WinClosed|.
							*FileAppendCmd*
FileAppendCmd			Before appending to a file.  Should do the
				appending to the file.  Use the '[ and ']
				marks for the range of lines. |Cmd-event|
							*FileAppendPost*
FileAppendPost			After appending to a file.
							*FileAppendPre*
FileAppendPre			Before appending to a file.  Use the '[ and ']
				marks for the range of lines.
							*FileChangedRO*
FileChangedRO			Before making the first change to a read-only
				file.  Can be used to checkout the file from
				a source control system.  Not triggered when
				the change was caused by an autocommand.
				Triggered when making the first change in
				a buffer or the first change after 'readonly'
				was set, just before the change is applied to
				the text.
				WARNING: If the autocommand moves the cursor
				the effect of the change is undefined.
							*E788*
				Cannot switch buffers.  You can reload the
				buffer but not edit another one.
							*E881*
				If the number of lines changes saving for undo
				may fail and the change will be aborted.
							*FileChangedShell*
FileChangedShell		When Vim notices that the modification time of
				a file has changed since editing started.
				Also when the file attributes of the file
				change or when the size of the file changes.
				|timestamp|
				Triggered for each changed file, after:
				- executing a shell command
				- |:checktime|
				- |FocusGained|

				Not used when 'autoread' is set and the buffer
				was not changed.  If a FileChangedShell
				autocommand exists the warning message and
				prompt is not given.
				|v:fcs_reason| indicates what happened. Set
				|v:fcs_choice| to control what happens next.
				NOTE: Current buffer "%" is not the target
				buffer "<afile>" and "<abuf>". |<buffer=abuf>|

Title: Nvim Autocommand Events: Cursor Movement, Directory Changes, and File Operations
Summary
This section describes Nvim autocommand events related to cursor movement in the command line and insert mode (CursorMovedC, CursorMovedI), diff updates (DiffUpdated), directory changes (DirChanged, DirChangedPre), exiting Vim (ExitPre), file appending (FileAppendCmd, FileAppendPost, FileAppendPre), and handling changes to read-only files or externally modified files (FileChangedRO, FileChangedShell). It details the variables available for DirChanged and DirChangedPre events, and the limitations and considerations for using FileChangedRO.