Summary of VIM folding code skills

Source: Internet
Author: User

Enter the following command:

For example, the Zo command First presses the z key, releases it, And then presses the O key to expand and collapse.

1. Enable and disable folding

Zo

Expand and collapse. Only the outer layers are folded.
Zo

Expand All nested collapse points in the range, including nested collapse.

ZC

Fold: only fold the outermost layer
ZC

Fold all nested fold points in the range, including all nested folds.

ZM

This will fold more (m-ore ). You can repeat "ZR" and "ZM" to open and close several layers of nested folding. Otherwise, you have to fold them one by one using ZC.

If you have a deep fold nested with several layers, you can use this command to open them all:

ZM

This will increase the fold until all folds are closed.

ZR

This will reduce the number of folds until there is no left. With the following command, you can disable all folds:

 

2. move the cursor in folding units

[Z

To the start of the current fold.
] Z

To the end of the currently opened fold.
ZJ

Move down. To the start of the next fold. The closed folding is also included.
ZK

Move up to the end of the previous fold. The closed folding is also

Iii. Fold Management
ZD

Delete the folding of the cursor. Valid only when 'foldmethod' is set to manual or marker.
ZD

Click Delete to collapse the cursor.
Valid only when 'foldmethod' is set to manual or marker.
Ze

Remove all folds in the (eliminate) window.
Valid only when 'foldmethod' is set to manual or marker.


Zfap

Move the cursor to the section, and then press zfap to automatically add a tab for the entire section.

Iv. Folding

Suppose you have created several folds, and now you need to read all the text. You can move to each fold and type "zo ". To make it faster, run the following command: Zr.

Zn

The quick Hide feature is disabled.

Zn

Restore original fold

Zi

Switch on and off the folding Function

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.