Vim Tips Wiki
m (Added to Usage Category + help links set)
(Uploaded by JohnBot from a locally edited file)
Line 1: Line 1:
  +
{{TipImported
[[Category:Usage]]
 
{{Tip
 
 
|id=42
 
|id=42
  +
|previous=41
|title=Using marks
 
  +
|next=43
|created=March 9, 2001 2:20
+
|created=March 9, 2001
 
|complexity=basic
 
|complexity=basic
|author=Anonymous
+
|author=Anon
 
|version=5.7
 
|version=5.7
 
|rating=43/22
 
|rating=43/22
 
}}
|text=
 
 
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.
 
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:
 
Some examples:
  +
<pre>
 
ma set mark '''a''' at current cursor location
+
ma set mark '''a''' at current cursor location
'a jump to line of mark a (beginning of line)
+
'a jump to line of mark a (beginning of line)
`a jump to position of mark a
+
`a jump to position of mark a
d'a delete from current line to line 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
+
d`a delete from current cursor position to position of mark a
c'a change text from current line to line 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
+
y`a yank text to unnamed buffer from cursor to position of mark a
<nowiki>''</nowiki> jump back (to line where jumped from)
+
'' jump back (to line where jumped from)
`0 jump to position in last file edited (when exited Vim)
+
`0 jump to position in last file edited (when exited Vim)
`` jump back (to position where jumped from)
+
`` jump back (to position where jumped from)
:marks list all the current marks
+
:marks list all the current marks
  +
</pre>
   
 
Each file you edit can have mark '''a''' (or any lowercase letter) &mdash; use a lowercase mark to jump within a file.
 
Each file you edit can have mark '''a''' (or any lowercase letter) &mdash; use a lowercase mark to jump within a file.
Line 29: Line 30:
 
There is only one file mark '''A''' (or any uppercase letter) &mdash; use an uppercase mark if you want to jump between files.
 
There is only one file mark '''A''' (or any uppercase letter) &mdash; use an uppercase mark if you want to jump between files.
   
  +
==References==
See:
 
 
*{{help|mark}}
 
*{{help|mark}}
 
*{{help|various-motions}}
 
*{{help|various-motions}}
   
 
==Comments==
}}
 
   
  +
----
== Comments ==
 
 
[[Category:Usage]]

Revision as of 05:07, 28 October 2007

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