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* *:mo* *:move* *E134*
Move the lines given by [range] to below the line
given by {address}.
==============================================================================
6. Formatting text *formatting*
:[range]ce[nter] [width] *:ce* *:center*
Center lines in [range] between [width] columns
(default 'textwidth' or 80 when 'textwidth' is 0).
:[range]ri[ght] [width] *:ri* *:right*
Right-align lines in [range] at [width] columns
(default 'textwidth' or 80 when 'textwidth' is 0).
*:le* *:left*
:[range]le[ft] [indent]
Left-align lines in [range]. Sets the indent in the
lines to [indent] (default 0).
*gq*
gq{motion} Format the lines that {motion} moves over.
Formatting is done with one of three methods:
1. If 'formatexpr' is not empty the expression is
evaluated. This can differ for each buffer.
2. If 'formatprg' is not empty an external program
is used.
3. Otherwise formatting is done internally.
In the third case the 'textwidth' option controls the
length of each formatted line (see below).
If the 'textwidth' option is 0, the formatted line
length is the screen width (with a maximum width of
79).
The 'formatoptions' option controls the type of
formatting |fo-table|.
The cursor is left on the first non-blank of the last
formatted line.
NOTE: The "Q" command formerly performed this
function. If you still want to use "Q" for
formatting, use this mapping: >
:nnoremap Q gq
gqgq *gqgq* *gqq*
gqq Format the current line. With a count format that
many lines.
*v_gq*
{Visual}gq Format the highlighted text. (for {Visual} see
|Visual-mode|).
*gw*
gw{motion} Format the lines that {motion} moves over. Similar to
|gq| but puts the cursor back at the same position in
the text. However, 'formatprg' and 'formatexpr' are
not used.
gwgw *gwgw* *gww*
gww Format the current line as with "gw".
*v_gw*
{Visual}gw Format the highlighted text as with "gw". (for
{Visual} see |Visual-mode|).
Example: To format the current paragraph use: *gqap* >
gqap
The "gq" command leaves the cursor in the line where the motion command takes
the cursor. This allows you to repeat formatting repeated with ".". This
works well with "gqj" (format current and next line) and "gq}" (format until
end of paragraph). Note: When 'formatprg' is set, "gq" leaves the cursor on
the first formatted line (as with using a filter command).
If you want to format the current paragraph and continue where you were, use: >
gwap
If you always want to keep paragraphs formatted you may want to add the 'a'
flag to 'formatoptions'. See |auto-format|.
If the 'autoindent' option is on, Vim uses the indent of the first line for
the following lines.
Formatting does not change empty lines (but it does change lines with only
white space!).
The 'joinspaces' option is used when lines are joined together.
You can set the 'formatexpr'