有没有办法或工具来折叠vim中的函数,比如Visual Studio或Eclipse?
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。
是。 VIM具有出色的折叠功能。我不喜欢学习太多的控件,我更喜欢自动化,所以这是我个人使用的:
在我的.vimrc中:
set foldmethod=indent
set foldlevel=1
set foldclose=all
这会自动折叠您打开的文件,基于缩进,对于缩进超过1级的所有内容。折叠关闭选项使折叠自动重新关闭。
文件内控件:
zo - opens folds
zc - closes fold
zm - increases auto fold depth
zr - reduces auto fold depth
如果你对褶皱感到恼火,请使用
: set foldmethod=syntax
或按:
zR
让它们全部消失。
:set foldmethod=syntax
如果您的语言有语法文件,则应自动折叠所有函数和其他块。
Vim具有出色的折叠支撑。 vim帮助系统中有很好的文档。只需打开vim即可
:help usr_28.txt
看完之后你也可以看了
:help folding
了解更多信息。
是的,它被绑定到'z'键,例如zO打开所有折叠。请参阅vim中的“:help fold”以获取更多信息。您可以根据非常简单的规则(如缩进)或根据代码语法进行折叠。