3

When I run :marks it lists all the marks including the standard Vim marks. This is somehow distracting.

Is there a way to list only my marks that I created using m-X for example?

Vivian De Smedt
  • 16,336
  • 3
  • 18
  • 37
Salahuddin Ahmed
  • 441
  • 3
  • 14
  • 1
    :marks a-z should work – Christian Brabandt Oct 08 '20 at 11:03
  • 1
    For me it doesn't work. It just shows 'a' mark and doesn't show 'b' and 'c'. Although they are shown by just :marks – Salahuddin Ahmed Oct 08 '20 at 11:59
  • 1
    I found that :marks a-b will show 'a' and 'b'. :marks a-c will show 'a' and 'c'. :marks a-d will only show 'a'. As far as I read, this should list marks from a to d. If I run :marks abcd it will list 'a', 'b', and 'c' which all I have. So it looks like this is the best solution – Salahuddin Ahmed Oct 08 '20 at 12:05
  • it would be amazing if someone showed how to do this using FuzzyFinder (which would list the marks, by providing an interactive menu to choose one of them to go to, which one could shortcut by typing the mark character and hitting enter.) Although on reflection I guess Salahuddin Ahmed's answer is just as good. – Jonathan Hartley Jan 11 '23 at 15:52

2 Answers2

4

You can define a custom command like this, that will only show the lowercase marks a-z:

:com :MyMarks :sil! marks abcdefghijklmnopqrstuvwxyz
Christian Brabandt
  • 25,820
  • 1
  • 52
  • 77
2

I end up having this in my vimrc

nnoremap <silent> ,m :marks abcdefghijklmnopqrstuvwxyz<CR>:normal! `

With this, ,m vim lists all my marks and then I only have to type the mark that I want to jump to, and hit enter.

The 'normal' command executes its command-line args as if you had pressed those keys in normal mode. We deliberately don't add a <CR> to this, part so that the user is presented with a half-typed command:

:normal! '

The ' at the end is the start of a 'go to mark' command, hence the user can just press 'A' (or whatever) and then enter.

Salahuddin Ahmed
  • 441
  • 3
  • 14