Home Explore Blog CI



neovim

13th chunk of `runtime/doc/cmdline.txt`
a99a39801ece45a1c5d6a290078d47eef52a80e6ff2bdc550000000100000fa5
 uses)
							*:<afile>* *<afile>*
	<afile>    When executing autocommands, is replaced with the file name
		   of the buffer being manipulated, or the file for a read or
		   write.  *E495*
							*:<abuf>* *<abuf>*
	<abuf>     When executing autocommands, is replaced with the currently
		   effective buffer number.  It is not set for all events,
		   also see |bufnr()|.  For ":r file" and ":so file" it is the
		   current buffer, the file being read/sourced is not in a
		   buffer.  *E496*
							*:<amatch>* *<amatch>*
	<amatch>   When executing autocommands, is replaced with the match for
		   which this autocommand was executed.  *E497*
		   It differs from <afile> when the file name isn't used to
		   match with (for FileType, Syntax and SpellFileMissing
		   events).
		   When the match is with a file name, it is expanded to the
		   full path.
							*:<sfile>* *<sfile>*
	<sfile>    When executing a `:source` command, is replaced with the
		   file name of the sourced file.  *E498*
		   When executing a function, is replaced with the call stack,
		   as with <stack> (this is for backwards compatibility, using
		   <stack> or <script> is preferred).
		   Note that filename-modifiers are useless when <sfile> is
		   not used inside a script.
							*:<stack>* *<stack>*
	<stack>	   is replaced with the call stack, using
		   "function {function-name}[{lnum}]" for a function line
		   and "script {file-name}[{lnum}]" for a script line, and
		   ".." in between items.  E.g.:
		   "function {function-name1}[{lnum}]..{function-name2}[{lnum}]"
		   If there is no call stack you get error *E489* .
							*:<script>* *<script>*
	<script>   When executing a `:source` command, is replaced with the file
		   name of the sourced file.  When executing a function, is
		   replaced with the file name of the script where it is
		   defined.
		   If the file name cannot be determined you get error *E1274* .
							*:<slnum>* *<slnum>*
	<slnum>	   When executing a `:source` command, is replaced with the
		   line number.  *E842*
		   When executing a function it's the line number relative to
		   the start of the function.
							*:<sflnum>* *<sflnum>*
	<sflnum>   When executing a script, is replaced with the line number.
		   It differs from <slnum> in that <sflnum> is replaced with
		   the script line number in any situation.  *E961*

							 *filename-modifiers*
*:_%:* *::8* *::p* *::.* *::~* *::h* *::t* *::r* *::e* *::s* *::gs* *::S*
     *%:8* *%:p* *%:.* *%:~* *%:h* *%:t* *%:r* *%:e* *%:s* *%:gs* *%:S*
The file name modifiers can be used after "%", "#", "#n", "<cfile>", "<sfile>",
"<afile>" or "<abuf>".  They are also used with the |fnamemodify()| function.
These modifiers can be given, in this order:
	:p	Make file name a full path.  Must be the first modifier.  Also
		changes "~/" (and "~user/" for Unix) to the path for the home
		directory.  If the name is a directory a path separator is
		added at the end.  For a file name that does not exist and
		does not have an absolute path the result is unpredictable.
		On MS-Windows an 8.3 filename is expanded to the long name.
	:8	Converts the path to 8.3 short format (currently only on
		MS-Windows).  Will act on as much of a path that is an
		existing path.
	:~	Reduce file name to be relative to the home directory, if
		possible.  File name is unmodified if it is not below the home
		directory.
	:.	Reduce file name to be relative to current directory, if
		possible.  File name is unmodified if it is not below the
		current directory.
		For maximum shortness, use ":~:.".
	:h	Head of the file name (the last component and any separators
		removed).  Cannot be used with :e, :r or :t.
		Can be repeated to remove several components at the end.
		When the file name ends in a path separator, only the path
		separator is removed.  Thus ":p:h" on a directory name results
		on the directory name itself (without trailing slash).
		When the file name is an absolute path (starts with "/" for
		Unix; "x:\"

Title: Vim Ex Command-Line Special Keys and Filename Modifiers
Summary
This section continues listing special keys for use in Vim Ex commands, including <afile> (file name of the buffer being manipulated during autocommands), <abuf> (currently effective buffer number during autocommands), <amatch> (the match for which the autocommand was executed), <sfile> (file name of the sourced file during `:source` commands or call stack when executing a function), <stack> (call stack), <script> (file name of the sourced file or script where a function is defined), <slnum> (line number during `:source` command or relative to the start of the function), and <sflnum> (script line number). It then details filename modifiers that can be used after "%", "#", "#n", "<cfile>", "<sfile>", "<afile>" or "<abuf>", like ':p' (full path), ':8' (8.3 short format on MS-Windows), ':~' (relative to home directory), ':.' (relative to current directory), and ':h' (head of the file name).