2

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
    Nov 19 '20 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
    Nov 19 '20 at 16:58
  • 1
    @BLayer Added in 8.2.0861 on 31st May. Still not present in Neovim.
    – Matt
    Nov 19 '20 at 17:04
  • @Matt Looks like I pulled source about three weeks too early. :)
    – B Layer
    Nov 19 '20 at 17:07
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

0

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, privacy policy and cookie policy

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