- Mastering Vim
- Ruslan Osipov
- 292字
- 2021-06-10 18:51:29
Folding Python code
Since we're working with Python code throughout this book, let's play with some folds in our code. First, you'll need to change a setting called foldmethod to indent in your .vimrc file:
set foldmethod=indent
This will tell Vim to fold based on indentation (there are multiple ways to work with folds; see the following section, Types of folds, for more information).
Open animal_farm.py and you will see portions of our file folded away:

Navigate your cursor to one of the folded lines. Hitting zo will open the current fold:
Whenever your cursor is over a potential fold (an indented chunk of code in this example), zc will close the fold.
You can also use za to toggle folds (open closed folds and close open folds).
You can open and close all folds in the file at the same time using zR and zM, respectively.
- Vue 3移動Web開發與性能調優實戰
- Learn Type:Driven Development
- C語言程序設計立體化案例教程
- YARN Essentials
- C/C++數據結構與算法速學速用大辭典
- SQL Server 2016 從入門到實戰(視頻教學版)
- Python開發基礎
- ArcPy and ArcGIS(Second Edition)
- Mastering ArcGIS Server Development with JavaScript
- Three.js Essentials
- Learning RSLogix 5000 Programming
- Ionic Framework By Example
- Building an E-Commerce Application with MEAN
- 亮劍ASP.NET項目開發案例導航
- Metasploit for Beginners