首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >vim中的Fold函数

vim中的Fold函数
EN

Stack Overflow用户
提问于 2010-03-02 20:03:14
回答 5查看 42.7K关注 0票数 64

有没有像Visual Studio或Eclipse这样的方法或工具来折叠vim中的功能?

EN

回答 5

Stack Overflow用户

回答已采纳

发布于 2010-03-02 20:07:34

代码语言:javascript
复制
    Vim folding commands
---------------------------------
zf#j creates a fold from the cursor down # lines.
zf/ string creates a fold from the cursor to string .
zj moves the cursor to the next fold.
zk moves the cursor to the previous fold.
za toggle a fold at the cursor.
zo opens a fold at the cursor.
zO opens all folds at the cursor.
zc closes a fold under cursor. 
zm increases the foldlevel by one.
zM closes all open folds.
zr decreases the foldlevel by one.
zR decreases the foldlevel to zero -- all folds will be open.
zd deletes the fold at the cursor.
zE deletes all folds.
[z move to start of open fold.
]z move to end of open fold.

来源: vim docs。

票数 129
EN

Stack Overflow用户

发布于 2013-05-25 04:36:56

是。VIM具有出色的折叠功能。我不喜欢学习太多的控件,我更喜欢自动化,所以这是我个人使用的:

在我的.vimrc中:

代码语言:javascript
复制
set foldmethod=indent
set foldlevel=1
set foldclose=all

对于缩进超过1级的所有内容,这会根据缩进自动折叠您打开的文件。foldclose选项使文件夹在我导航出文件夹后自动重新关闭。

文件内控件:

代码语言:javascript
复制
zo - opens folds
zc - closes fold
zm - increases auto fold depth
zr - reduces auto fold depth

如果您对折叠感到厌烦,请使用

代码语言:javascript
复制
: set foldmethod=syntax

或按:

代码语言:javascript
复制
zR

把他们都赶走。

票数 70
EN

Stack Overflow用户

发布于 2010-03-02 20:11:14

代码语言:javascript
复制
:set foldmethod=syntax

应该自动折叠所有函数和其他块,如果你有你的语言的语法文件。

票数 24
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2362914

复制
相关文章

相似问题

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