2

If I navigate the first line of a folded function with h,l, etc it will open the fold. Navigating search matches with n will also open a fold if there is a match inside the fold.

Can you configure folds to only open when you explicitly open them with z commands?

5

You can set the 'foldopen' option to control which commands or movements will open folds.

The specific cases you mentioned:

  • h or l: these are horizontal movements, controlled by the hor setting.
  • search or n: these are controlled by the search setting.

So you might want to remove these two specific cases, which you can do with:

set foldopen-=hor foldopen-=search

Or maybe you want to disable all of them and just set 'foldopen' to be empty:

set foldopen=

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.