Home Explore Blog CI



neovim

18th chunk of `runtime/doc/change.txt`
28959c33425291bb5719b14d06792c768935f839798f45880000000100000fa2
 works a bit
		differently, like inserting the text instead of putting it
		('textwidth' and other options affect what is inserted).
							*quote_%* *quote%*
	"%	Contains the name of the current file.
						*quote_:* *quote:* *E30*
	":	Contains the most recent executed command-line.  Example: Use
		"@:" to repeat the previous command-line command.
		The command-line is only stored in this register when at least
		one character of it was typed.  Thus it remains unchanged if
		the command was completely from a mapping.

							*quote_#* *quote#*
6. Alternate file register "#
Contains the name of the alternate file for the current window.  It will
change how the |CTRL-^| command works.
This register is writable, mainly to allow for restoring it after a plugin has
changed it.  It accepts buffer number: >
    let altbuf = bufnr(@#)
    ...
    let @# = altbuf
It will give error |E86| if you pass buffer number and this buffer does not
exist.
It can also accept a match with an existing buffer name: >
    let @# = 'buffer_name'
Error |E93| if there is more than one buffer matching the given name or |E94|
if none of buffers matches the given name.

7. Expression register "=			*quote_=* *quote=* *@=*
This is not really a register that stores text, but is a way to use an
expression in commands which use a register.  The expression register is
read-write.

When typing the '=' after " or CTRL-R the cursor moves to the command-line,
where you can enter any expression (see |expression|).  All normal
command-line editing commands are available, including a special history for
expressions.  When you end the command-line by typing <CR>, Vim computes the
result of the expression.  If you end it with <Esc>, Vim abandons the
expression.  If you do not enter an expression, Vim uses the previous
expression (like with the "/" command).

The expression must evaluate to a String.  A Number is always automatically
converted to a String.  For the "p" and ":put" command, if the result is a
Float it's converted into a String.  If the result is a List each element is
turned into a String and used as a line.  A Dictionary is converted into a
String.  A Funcref results in an error message (use string() to convert).

If the "= register is used for the "p" command, the String is split up at <NL>
characters.  If the String ends in a <NL>, it is regarded as a linewise
register.

8. Selection registers "* and "+
Use these registers for storing and retrieving the selected text for the GUI.
See |quotestar| and |quoteplus|.  When the clipboard is not available or not
working, the unnamed register is used instead.  For Unix systems and Mac OS X,
see |primary-selection|.

9. Black hole register "_				*quote_*
When writing to this register, nothing happens.  This can be used to delete
text without affecting the normal registers.  When reading from this register,
nothing is returned.

10. Last search pattern register	"/		*quote_/* *quote/*
Contains the most recent search-pattern.  This is used for "n" and 'hlsearch'.
It is writable with `:let`, you can change it to have 'hlsearch' highlight
other matches without actually searching.  You can't yank or delete into this
register.  The search direction is available in |v:searchforward|.
Note that the value is restored when returning from a function
|function-search-undo|.

							*@/*
You can write to a register with a `:let` command |:let-@|.  Example: >
	:let @/ = "the"

If you use a put command without specifying a register, Vim uses the register
that was last filled (this is also the contents of the unnamed register).  If
you are confused, use the `:dis` command to find out what Vim will put (this
command displays all named and numbered registers; the unnamed register is
labelled '"').

The next three commands always work on whole lines.

:[range]co[py] {address}				*:co* *:copy*
			Copy the lines given by [range] to below the line
			given by {address}.

							*:t*
:t			Synonym for copy.

:[range]m[ove] {address}			*:m*

Title: Vim Registers: Alternate File, Expression, Selection, Black Hole, and Last Search Pattern Registers
Summary
This section covers several special Vim registers, including the alternate file register ('#') for the current window's alternate file, which is writable and impacts the |CTRL-^| command. It explains the expression register ('=') for using expressions in commands that utilize registers. It details the selection registers ('*' and '+') for storing and retrieving GUI selected text. The black hole register ('_') is used to discard text without affecting normal registers. Finally, it describes the last search pattern register ('/') for storing the most recent search pattern, influencing 'n' and 'hlsearch'. It concludes with a note on how the :co and :m commands operate on whole lines.