Vim: Fold top level folds only

前端 未结 3 1017
花落未央
花落未央 2021-01-31 03:14

I have a long code file with syntax folding in Vim.

I know how to open all folds (zR) or close all folds (zM), and I know how to increase or decrease the foldlevel (zm,

相关标签:
3条回答
  • 2021-01-31 03:43

    Yes, you can type

    :%foldc
    

    Which closes one level of folds (outside in).

    0 讨论(0)
  • 2021-01-31 03:48

    I think you want to add set foldnestmax=1 to your $MYVIMRC.

    0 讨论(0)
  • 2021-01-31 03:55

    As Karl says, the foldnestmax setting is probably what you want.

    zO (i.e., capital-letter-o) opens all nested folds.

    I also find zx and zv very helpful.

    When I use foldmethod=expr with a custom fold expression, I'll often modify the expression so that it only folds what I want it to fold.

    0 讨论(0)
提交回复
热议问题