Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In many cases it would be useful to search for text only in the currently visible fold titles, instead of having Vim automatically opening lots of different folds along the way. Is there a way to do that?

share|improve this question
up vote 3 down vote accepted

I don't know of a way to only search in the fold text (which is usually just the first line of the fold, plus a little extra information), but you can control what actions open folds by setting the 'foldopen' option. For example:

:set foldopen-=search

See ":help 'foldopen'" (the single quotes are meant to be typed).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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