我想让我离开时自动关闭我的折叠。意思是当我的光标在折叠中时,应该显示折叠,但当它(比如说)在折页下方5行时,它应该再次关闭。
这些是我的折叠设置:
set foldenable
set foldlevel=0
set foldnestmax=1
set foldmethod=indent
set foldtext=FoldText()
function FoldText()
return '...'
endfunction
完整的源代码可以找到这里
我该怎么做?据我所知,vim没有为这个特性提供任何选项,所以必须有一些autocmd
**?** 。
博多
发布于 2014-07-12 10:56:49
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.
https://stackoverflow.com/questions/24711212
复制相似问题