1

I have set foldtext like this:

set foldtext=NeatFoldText()

Is there a way to:

  1. view what the default value is for a option?
  2. reset option to its default value (without having to exit/re-enter vim)
4
  1. reset option to its default value (without having to exit/re-enter vim)

There is :set-&vim, but it will really reset to default value, not to the value that could have been set from a standard indent plugin.

:set foldtext&vim

1.view what the default value is for a option?

I'm not aware of any simple way, except :h '{optionname}'.

You can always display an option value with :echo &{theoptioname}, or set {theoptionname}?

This means that programmatically it's possible to save the old value, reset it, extract the current value, and restore the changed value. But, option scope shall be taken into account, and I'm not sure there is a simple way to handle some dual options that can be global or local.

In all cases, don't forget that true default may not be the default observed once all plugin, ftplugin, and indent plugins have been loaded.

PS: 'foldtext' and 'foldlevel' are two different options.

| improve this answer | |
  • I see thanks for the explanation. Yes, that was a typo, thanks for pointing out. – David542 Jun 26 at 23:46
  • could you please clarify what you mean by :h '{optionname}'. For example, where does it show the default value for an option? – David542 Jun 27 at 3:35
  • 2
    @David542 The first line of the help for foldlevel (:h 'foldlevel') reads: 'foldlevel' 'fdl' number (default: 0). So the default is documented. – Ralf Jun 27 at 5:38

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.