- Mastering Vim
- Ruslan Osipov
- 229字
- 2021-06-10 18:51:29
Types of folds
Vim is somewhat intelligent when it comes to folding code, and supports multiple ways to fold code. The folding method is guarded by a foldmethod option in your .vimrc file. Supported fold methods are as follows:
- manual allows you to manually define folds. This becomes unrealistic when working with any substantial body of text.
- indent supports indentation-based folding, which is perfect for languages and code bases where indentation matters (regardless of the language you're working with, a standardized code base is likely to have some consistent indentation, making indent a quick and easy way to fold away bits you don't care for).
- expr allows for a regular-expression based folding. This is an extremely powerful tool if you have complex custom rules you'd like to use for defining folds.
- marker uses special markup in the text, such as {{{ and }}}. This is useful for managing long .vimrc files, but has little use outside of the Vim world since it requires modifying file content.
- syntax provides syntax-aware folds. However, not every language is supported out of the box (Python isn't).
- diff is automatically used when Vim operates in a diff mode, displaying the difference between two files (see Vimdiff in Chapter 5, Build, Test, and Execute).
Reminder: you can set an option in your .vimrc file by adding the following line: set foldmethod=<method>.
推薦閱讀
- Implementing VMware Horizon 7(Second Edition)
- SQL Server 2012數(shù)據(jù)庫(kù)技術(shù)及應(yīng)用(微課版·第5版)
- 神經(jīng)網(wǎng)絡(luò)編程實(shí)戰(zhàn):Java語(yǔ)言實(shí)現(xiàn)(原書(shū)第2版)
- Nexus規(guī)模化Scrum框架
- Highcharts Cookbook
- Geospatial Development By Example with Python
- Visual FoxPro 6.0程序設(shè)計(jì)
- Unity 5.X從入門(mén)到精通
- Julia High Performance(Second Edition)
- Modular Programming with JavaScript
- Functional Python Programming
- Clojure Data Structures and Algorithms Cookbook
- 計(jì)算機(jī)應(yīng)用基礎(chǔ)(Windows 7+Office 2010)
- Microsoft XNA 4.0 Game Development Cookbook
- Flink原理深入與編程實(shí)戰(zhàn):Scala+Java(微課視頻版)