==============================================================================
7. Marks *mark-motions* *E20* *E78*
Jumping to a mark can be done in two ways:
1. With ` (backtick): The cursor is positioned at the specified location
and the motion is |exclusive|.
2. With ' (single quote): The cursor is positioned on the first non-blank
character in the line of the specified location and
the motion is linewise.
*mark-view*
3. Apart from the above if 'jumpoptions' contains "view", they will also try to
restore the mark view. This is the number of lines between the cursor position
and the window topline (first buffer line displayed in the window) when it was
set.
*m* *mark* *Mark*
m{a-zA-Z} Set mark {a-zA-Z} at cursor position (does not move
the cursor, this is not a motion command).
*m'* *m`*
m' or m` Set the previous context mark. This can be jumped to
with the "''" or "``" command (does not move the
cursor, this is not a motion command).
*m[* *m]*
m[ or m] Set the |'[| or |']| mark. Useful when an operator is
to be simulated by multiple commands. (does not move
the cursor, this is not a motion command).
*m<* *m>*
m< or m> Set the |'<| or |'>| mark. Useful to change what the
`gv` command selects. (does not move the cursor, this
is not a motion command).
Note that the Visual mode cannot be set, only the
start and end position.
*:ma* *:mark* *E191*
:[range]ma[rk] {a-zA-Z'}
Set mark {a-zA-Z'} at last line number in [range],
column 0. Default is cursor line.
*:k*
:[range]k{a-zA-Z'} Same as :mark, but the space before the mark name can
be omitted.
*'* *'a* *`* *`a*
'{a-z} `{a-z} Jump to the mark {a-z} in the current buffer.
*'A* *'0* *`A* *`0*
'{A-Z0-9} `{A-Z0-9} To the mark {A-Z0-9} in the file where it was set (not
a motion command when in another file).
*g'* *g'a* *g`* *g`a*
g'{mark} g`{mark}
Jump to the {mark}, but don't change the jumplist when
jumping within the current buffer. Example: >
g`"
< jumps to the last known position in a file.
See also |:keepjumps|.
*:marks*
:marks List all the current marks (not a motion command).
The |'(|, |')|, |'{| and |'}| marks are not listed.
The first column has number zero.
*E283*
:marks {arg} List the marks that are mentioned in {arg} (not a
motion command). For example: >
:marks aB
< to list marks 'a' and 'B'.
*:delm* *:delmarks*
:delm[arks] {marks} Delete the specified marks. Marks that can be deleted
include A-Z and 0-9. You cannot delete the ' mark.
They can be specified by giving the list of mark
names, or with a range, separated with a dash. Spaces
are ignored. Examples: >
:delmarks a deletes mark a
:delmarks a b 1 deletes marks a, b and 1
:delmarks Aa deletes marks A and a
:delmarks p-z deletes marks in the range p to z
:delmarks ^.[] deletes marks ^ . [ ]
:delmarks \" deletes mark "
<
:delm[arks]! Delete all marks for the current buffer, but not marks
A-Z or 0-9. Also clear the |changelist|.
A mark is not visible in any way. It is just a position in the file that is
remembered. Do not confuse marks with named registers, they are totally
unrelated.
'a - 'z lowercase marks, valid within one file
'A - 'Z uppercase marks, also called file marks, valid between files
'0 - '9 numbered marks, set from |shada| file
Lowercase marks 'a to 'z are remembered as long as the file remains in the
buffer list. If you remove the file from the buffer list, all its marks are
lost. If you delete a line that contains a mark, that mark is erased.
Lowercase marks can be used in combination with operators. For example: "d't"
deletes the lines from the cursor position to mark 't'. Hint: Use mark 't' for
Top, 'b' for Bottom, etc.. Lowercase marks are restored when using undo and
redo.
Uppercase marks 'A to 'Z