- Vim - Conclusion
- Vim - Personalization
- Vim - Tips & Tricks
- Vim - Remote File Editing
- Vim - Using Vim as IDE
- Vim - Plug-ins
- Vim - Diff
- Vim - Folding
- Vim - Registers
- Vim - Macros
- Vim - Markers
- Vim - Working With Multiple Things
- Vim - Searching
- Vim - Revisiting Editing
- Vim - Navigating
- Vim - Editing
- Vim - Getting help
- Vim - Getting familiar
- Vim - It’s friends
- Vim - Installation & Configuration
- Vim - Introduction
- Vim - Home
Vim Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Vim - Folding
Fold functionapty will be useful when file contents large text. Using this feature we can only show selected potion of file. This feature is particularly useful while working with programming languages. In this chapter, we will discuss following items −
Activate and deactivate fold functionapty
Various fold actions
Fold activation and deactivation
To activate fold use following command −
:set foldenable :set foldmethod = indent
To deactivate fold use following command
:set nofoldenable
Fold actions
Close fold
To fold code, go to any method and execute following command −
zc
For example below image shows the result of this action −
Open fold
To open fold use following command −
zo
Below image shows the result of this action −
Close all folds
To close all folds execute following command
zM
Below image shows the result of this action
Unfold all
To unfold all execute following −
zR
Below image shows the result of this action −
Advertisements