回答
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。
肯定的,它被綁定到 'Z' 鍵,例如zO打開所有摺疊。有關更多信息,請參閱vim中的「:help fold」。您可以根據非常簡單的規則進行摺疊,例如縮進或根據代碼語法。
:set foldmethod=syntax
應該自動摺疊所有函數和其他塊,如果您有語言的語法文件。
Vim具有出色的摺疊支持。 vim幫助系統中有很好的文檔。只需打開VIM並做
:幫助usr_28.txt
閱讀,您也可以閱讀
後:幫助摺疊
一些更多的信息。
是的。 VIM具有卓越的摺疊功能。我不喜歡學習的太多的控制,我更喜歡自動化,所以這裏是我個人使用:
在我的.vimrc:
set foldmethod=indent
set foldlevel=1
set foldclose=all
這會自動摺疊,你打開文件,基於縮進,一切縮進超過1級。 foldclose選項可以讓我在退出摺疊後自動重新關閉摺疊。
在文件控制:
zo - opens folds
zc - closes fold
zm - increases auto fold depth
zr - reduces auto fold depth
如果你曾經得到惱火的褶皺,使用
: set foldmethod=syntax
或按:
zR
,使他們都趕不走。
這是最實際的答案,thks @bhekman – 2016-12-14 01:50:38
我覺得有用的有: 'set nofoldenable' 'set foldlevel = 99' 也是。它禁用自動摺疊打開文件和摺疊只有外部功能(不加入和摺疊「fors」和「ifs」,什麼不是) 儘管我的配置基於你的答案,謝謝。 – merinoff 2017-07-06 16:43:54
- 1. A和在vim摺疊的bash功能
- 2. netbeans中的摺疊功能
- 3. Vim Markdown摺疊?
- 4. VIM中的摺疊代碼
- 5. 導出Vim摺疊?
- 6. 目錄在Vim中摺疊
- 7. Javascript摺疊延遲功能
- 8. 球拍摺疊功能
- 9. vim的定製摺疊
- 10. 如何摺疊(摺疊)Doxygen默認在vim中註釋?
- 11. Vim代碼摺疊爲Scilab
- 12. vim摺疊scss語法
- 13. 在vim中摺疊重複的行
- 14. 自動摺疊vim中的#defines
- 15. 如何摺疊Vim中的類塊?
- 16. vim中的自動ruby摺疊
- 17. 使用Vim,實現只摺疊功能塊的PHP代碼摺疊的最佳方式是什麼?
- 18. 功能上面的摺疊 - 單撇子
- 19. Scala的摺疊式咖喱功能
- 20. 是摺疊的嗎? - 如何檢查在VIM摺疊
- 21. 在Vim中爲CSS定製摺疊
- 22. 是否有可能跳到Vim中的關閉摺疊?
- 23. VIM語法摺疊:禁用摺疊多行註釋
- 24. vim語法摺疊(無意)創建嵌套摺疊
- 25. 使用摺疊使功能更優雅
- 26. 使用jquery展開,摺疊功能
- 27. 在vim摺疊線中更改折線nr顏色
- 28. Vim摺疊使用新標記擴展
- 29. vim - 如何獲取摺疊文件
- 30. Vim:在特定行上關閉摺疊
如果你的意思是「自動摺疊類和功能」,那麼你應該明確地在你的問題澄清。 – 2010-03-02 12:10:10
不是自動的,用戶可以選擇他想要摺疊的部分 – 2010-03-02 12:17:38
vim有很好的文檔。試試:help fold – 2010-03-02 14:07:15