Vim Tips Wiki
Advertisement
Tip 42 Printable Monobook Previous Next

created March 9, 2001 · complexity basic · author Anon · version 5.7


Use the mark command to record your current position so you can return to it later. You can use the lowercase letters (a-z) for marks in each file, and the uppercase letters (A-Z) for global marks. In addition, there are various special marks.

Some examples:

ma        set mark '''a''' at current cursor location
'a        jump to line of mark a (beginning of line)
`a        jump to position of mark a
d'a       delete from current line to line of mark a
d`a       delete from current cursor position to position of mark a
c'a       change text from current line to line of mark a
y`a       yank text to unnamed buffer from cursor to position of mark a
''        jump back (to line where jumped from)
`0        jump to position in last file edited (when exited Vim)
``        jump back (to position where jumped from)
:marks    list all the current marks

Each file you edit can have mark a (or any lowercase letter) — use a lowercase mark to jump within a file.

There is only one file mark A (or any uppercase letter) — use an uppercase mark if you want to jump between files.

References

Comments

Advertisement