我想让vim在离开时自动关闭折叠。意味着当我的光标处于折叠状态时,应该显示折叠,但是当光标位于折叠状态以下5行时(应该说),它应该再次关闭。
这些是我的折叠设置:
set foldenable
set foldlevel=0
set foldnestmax=1
set foldmethod=indent
set foldtext=FoldText()
function FoldText()
return '...'
endfunction
完整的资料可以在这里找到
我该怎么做呢?据我所知,vim没有为此功能提供任何选择,因此必须有一些选择autocmd
吗?
博多
Vim提供了执行此操作的选项,它被调用'foldclose'
并具有如下行为,将其设置为all
。
有关更多详细信息,请参见它的帮助:
'foldclose' 'fcl' string (default "")
global
{not in Vi}
{not available when compiled without the |+folding|
feature}
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.
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句