Lets learn something about “bookmarks” in vim.
You all are comfortable working with vim and used this wonderful editor for galore of purposes, umpteen times during your Red Hat Linux Training.
Now lets suppose you are editing a large file and you need to move to certain locations, frequently. One way of jumping to particular line / location is by remembering the line numbers and then using :n (where n is the line number) to hop around.
Follow these steps:
1. Go to the location you want to bookmark. Then do a ESC+m+<bookmark name>. Suppose I want to create a bookmark with the name “a” so I will type ESC+ma.
2. You can then go to another location and create second bookmark with ESC+mb.
3. Now once the bookmarks are created you can move around them using “backtick” followed by bookmark name. So in my case I can use – `a
to go to bookmark a and `b to go to bookmark b.
4. You have the freedom to use single-quote ‘ also to hop around the bookmarks – ‘a for going to bookmark a and ‘b for bookmark b.
5. For getting information about the bookmarks you have just created just type :marks within the vim
Here is a illustration from my machine.