I usually jump to next mark in file using ]' and [' commands. But I am not able to find a way to discover whether there are any marks set on current line.

  • You could use m'. – romainl Mar 13 '15 at 8:11
  • Sorry if my question is not clear. I want to know which mark is set on the current line. Is there a command through which Vim will display mark set on the current line? – vimKoans44 Mar 13 '15 at 9:01

There is no way to make marks visible in vim proper.

If it is however enough to just list them you can issue the :marks normal-mode command, which will give you a list of all marks in the current buffer and all global marks (the one with capitalized letters).

Additionally there is a plugin called showmarks that will do the job. It displays a column left to the linenumbers-column which will contain the names of the marks on a specific line. This includes global marks.

A few versions of this plugin exist, i've found that Jacques Bodin-Hullin's version is the only one that seems to work without problems in any current version of vim (greater or equal than 7.4). It is located on github: jacquesbh/vim-showmarks.

If you are using Vundle as your plugin manager you can register it with the following line in your .vimrc, after doing a :PluginInstall jacquesbh/vim-showmarks.

call vundle#begin()
" ... other plugins
Plugin 'jacquesbh/vim-showmarks'
call vundle#end()

After you've installed showmarks you can make the marks visible with :DoShowMarks and hide them again with :NoShowMarks - an ! at the end will execute the command for all buffers.

| improve this answer | |
  • Why Vim out of the box do now show marks? Why we need a plugin for that? – Vitaly Zdanevich Jun 6 '19 at 7:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.