我们可以在VIM中指定多个折叠板吗?
我正在尝试使用 :setfoldmethod=marker
在 vim 中折叠多行我已经完成了 :setfoldmarker={,}
有什么方法可以让我们折叠函数具有起始大括号='['和结束大括号=']',并且还使用起始大括号='{'和结束大括号='}'折叠函数,就像在 vscode 中一样,我们可以使用任何起始和结束大括号折叠任何函数。
I am trying to fold multiple lines in vim with :set foldmethod=marker
I have done :set foldmarker={,}
is there any way such that we can fold function that has starting braces='[' and end braces=']' and also fold a function with starting braces='{' and end braces='}' like in vscode we can fold any function with any starting and ending braces.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自
:helpfolding
:marker
由于:help 'foldmarker'
下给出的原因而无济于事:请参阅
:帮助折叠标记
。diff
无关紧要。参见
:help Fold-diff
。syntax
可能会有所帮助,具体取决于语言以及该语言的语法脚本的编写方式。请参阅
:帮助折叠语法
。expr
是最强大的方法,因为它可以让您准确地决定折叠什么以及如何折叠它。出于显而易见的原因,它也是最难设置的。请参阅
:help Fold-expr
。indent
是一种相当愚蠢的方法,这使得它非常节省内存且用途广泛。您可以尝试一下,因为它根本不关心大括号。请参阅
:帮助折叠缩进
。然后是
手动
方法,它允许您通过动作定义折叠。这可以让您执行诸如
zfi{
或zf12j
之类的操作。请参阅
:帮助折叠手册
。From
:help folding
:marker
won't help for the reason given under:help 'foldmarker'
:See
:help fold-marker
.diff
is irrelevant.See
:help fold-diff
.syntax
may help, depending on the language and how the syntax script for that language was written.See
:help fold-syntax
.expr
is the most powerful method because it lets you decide exactly what to fold and how to fold it.It is also the hardest to set up, for obvious reasons. See
:help fold-expr
.indent
is a pretty dumb method, which makes it very memory efficient and versatile. You could try that one because it doesn't care about braces at all.See
:help fold-indent
.And then there is the
manual
method, which lets you define folds with motions.This lets you do things like
zfi{
orzf12j
.See
:help fold-manual
.