I'm using the accepted answer in this post, and as such, tried using the character * in my .vimrc, but it seems to generate E20: Mark not set as error, which i want to ignore (only for the instance when the * is used).

I'm aware of the silent! command, which ignore errors on a specific command, but i believe this might not work in this case.

Any way to do this?

  • Er, comment it out? (Double quote starts a comment)
    – D. Ben Knoble
    Sep 18, 2020 at 0:43
  • I would, but i need it as it is (as what the intended purpose of the post i linked explain) if it's commented, then it wouldn't be useful :) @D.BenKnoble Sep 18, 2020 at 0:46
  • For clarification on why i want this not commented: this post should explain it. @D.BenKnoble Sep 18, 2020 at 2:34

1 Answer 1


You can't just start lines with * in your vimrc and have Vim ignore them. * is not really a comment character, it's a valid command.

Under 'nocompatible' (which is most surely the mode under which everyone is using Vim these days), :* is a shortcut to :'<,'>, which is the range of lines comprising the last Visual selection. (See :help cpo-*, keeping in mind that under 'nocompatible' this option is not set.)

Instead of trying to get Vim to accept your special syntax, just adapt it so that it will work inside comments (actual Vimscript comments.)

You can do that by changing your matching pattern to:


This will accept an optional " (plus whitespace) before the stars.

In that case, you would write:

" * first header
(Some Vimscript here.)
" ** second header
(More text.)
" *** third header

But then, consider whether this is actually that much of an enhancement over the default foldmethod=marker settings, under which you would write the following to accomplish the same folding configuration:

" first header {{{1
(Some Vimscript here.)
" second header {{{2
(More text.)
" third header {{{3
  • so does that mean there no way to truly change/disable the shortcut cpo-star? at least on specific filetype... (I don't mind using your proposed solution, but being able to do this would be really nice). Sep 18, 2020 at 4:23
  • So i tried doing this but it seems that, while it worked (for removing the star from cpoptions) the previously mentioned error Mark not set still occur... Sep 18, 2020 at 6:07
  • Uhhh... It's actually set cpo+=* with a literal * and not s or the letters in star. :help cpo-s will tell you it's about setting options on buffers. But if you have set cpo+=* then :* behaves the same as :@ which is to execute a register as an Ex command, e.g. :@" for the default register. So a * by itself will complain about no register instead of no mark... But it will still complain.
    – filbranden
    Sep 18, 2020 at 6:26

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.