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?
You can define a custom command like this, that will only show the lowercase marks a
-z
:
:com :MyMarks :sil! marks abcdefghijklmnopqrstuvwxyz
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.
:marks a-z
should work:marks
: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