Vim 向下滚动时禁用自动折叠?

Vim disable autofold when I scroll down?

我在 vim 中启用了折叠,这里是 .vimrc snipet。

set foldmethod=syntax
set foldnestmax=1
set foldlevel=0
set foldclose=all

它工作正常,但是当我向下滚动一个 c 函数时它会自动折叠,知道如何打开折叠吗?

Vim 只是按照您的指示去做;特别是您选择的 'foldclose''foldlevel' 的组合。来自 :help 'foldclose':

'foldclose' 'fcl'   string (default "")
        When set to "all", a fold is closed when the cursor isn't in it and
        its level is higher than 'foldlevel'.  Useful if you want folds to
        automatically close when moving out of them.

如果您不喜欢这种行为,只需删除 set foldclose=all