A feature I often use in Vim is m
ark and jump-to-mark ('
)… But they only work within a file.
Is there any way to create a mark which works across files? For example, so I can create mark a
on line 42 of foo.py
, then jump to that mark while I'm editing bar.py
?
Setting marks To set a mark, type m followed by a letter. For example, ma sets mark a at the current position (line and column). If you set mark a, any mark in the current file that was previously identified as a is removed. If you set mark A, any previous mark A (in any file) is removed.
Marks are stored in viminfo not in a session and the viminfo file is only written when exiting vim.
You can delete marks with the :delm command. To delete marks `a , `e , and `G , you would type :delm aeG . You can delete all local marks with :delm! .
Yes. Use capital letters for the mark.
http://vim.wikia.com/wiki/Using_marks
Marks can span across files. To use such marks one has to use upper-case registers i.e. A-Z. Lower-case registers are used only within files and do not span files. That's to say, if you were to set a mark in a file foo.c in register "a" and then move to another file and hit 'a, the cursor will not jump back to the previous location. If you want a mark which will take you to a different file then you will need to use an upper-case register. For example, use mA instead of ma.
Use the A-Z
marks, they are available across files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With