3

some time ago, I wrote a small plugin in vimscript that was using builtin function getmarklist. Recently I reinstalled Vim and was surprissed that this plugin no longer worked because Vim couldn't find getmarklist. I don't know if this function was removed or this has something to do with build architecture. My old Vim was 64bit, this one is 32bit. So my question is, is there some other way to get list of all marks in vimscript?

Thanks

4
  • Check :version? My vim (8.2.1800) has this function
    – D. Ben Knoble
    Commented Nov 19, 2020 at 16:52
  • 1
    I don't have it in my build from May of this year. So it was there, removed some time ago, and added back very recently? I don't recall this function at all. Worst case I suppose you could redir the :marks command...if it contains what you need.
    – B Layer
    Commented Nov 19, 2020 at 16:58
  • 1
    @BLayer Added in 8.2.0861 on 31st May. Still not present in Neovim.
    – Matt
    Commented Nov 19, 2020 at 17:04
  • @Matt Looks like I pulled source about three weeks too early. :)
    – B Layer
    Commented Nov 19, 2020 at 17:07

2 Answers 2

1

To get a list of marks in vimscript just use the following command:

:marks

I would also recommend the plugin called: vim-signature. This plugin will automatically display marks in vim. Here is a screen shot:

enter image description here

1

you can write the output of :marks to a string called str like this:

fun! Marklist() abort
  redir => str
  :silent marks
  redir END
  return str
endfun

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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