首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >离开折叠时自动折叠

离开折叠时自动折叠
EN

Stack Overflow用户
提问于 2014-07-12 08:41:11
回答 1查看 646关注 0票数 2

我想让我离开时自动关闭我的折叠。意思是当我的光标在折叠中时,应该显示折叠,但当它(比如说)在折页下方5行时,它应该再次关闭。

这些是我的折叠设置:

代码语言:javascript
运行
复制
set foldenable
set foldlevel=0
set foldnestmax=1
set foldmethod=indent
set foldtext=FoldText()

function FoldText()
    return '...'
endfunction

完整的源代码可以找到这里

我该怎么做?据我所知,vim没有为这个特性提供任何选项,所以必须有一些autocmd**?**

博多

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-07-12 10:56:49

Vim提供了这样做的选项,它被称为'foldclose',为了这样的行为,将它设置为all

有关详细信息,请参阅它的帮助:

代码语言:javascript
运行
复制
'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.
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24711212

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档