Bookmarks in Vim

More Vim fun! This time looking at bookmarks.

To create a bookmark, simply type ‘m‘ where is any lowercase character. You can then use a backtick (`) followed by the letter to take you to the bookmarked position, or a single quote (‘) followed by the letter to take you to the start of the bookmarked line.

To create a global bookmark, useful for when you have multiple files open, just change the letter to uppercase (for example: ‘mA’)

To see all of your bookmarks type ‘:marks’ and to see info about a bookmark type ‘:marks ‘.

And – it wouldn’t be vim without a few hidden goodies – you can replace the letter with a full-stop to jump to the last edit.

  • ma – Creates a bookmark called a
  • mA – Creates a global bookmark called A
  • `a – Jump to the exact location (line and column) of the bookmark a
  • ‘a – Jump to the beginning of the line of the bookmark a
  • :marks – Display all the bookmarks
  • :marks a – Display the details of the bookmark with name a
  • `. – Jump to the exact location (line and column) where the last change was performed
  • ‘. – Jump to the beginning of the line where the last change was performed

Leave a Reply