Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting a VIM bookmark

Tags:

vim

vi

bookmarks

How you can set a bookmark in vim? I want to bookmark some lines and functions. How do you make a bookmark on the code? My code is written in C.

like image 352
alex Avatar asked Jul 05 '14 18:07

alex


People also ask

Why marks are used in Vim?

A mark allows you to record your current position so you can return to it later. There is no visible indication of where marks are set. Each file has a set of marks identified by lowercase letters (a-z).

How do I remove a mark in Vim?

viminfo contains histories and marks, if you don't want them any more, you can delete this file. Vim will recreate it next time. This does not clear marks on "<> and ' . The first three are removed via delm \"<> .


1 Answers

If you type ma , it will create bookmark on the current line at the current location with name a.

for example, typing ma has created a bookmark at the exact location where the cursor is highlighted

enter image description here

To Access Bookmarked Line Inside Vi you can use - {macro-name}

backtick followed by the macro name. Move to the exact bookmark location. This will jump to the exact character location within the line from where it was bookmarked earlier.

For example, if you type `a , it will take you to the bookmark with name “a”. i.e It will take you to the place where the cursor is high-lighted in the above Fig 1.

`a 

source

like image 147
Nidal Avatar answered Sep 18 '22 16:09

Nidal