Basics: Folding?

This commit is contained in:
Marco Hinz 2016-01-12 14:12:27 +01:00
parent b8a326e6c3
commit 13d8933fc2
2 changed files with 27 additions and 0 deletions

View File

@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
- Basics: [Changelist?](README.md#changelist)
- Basics: [Changelist? Jumplist?](README.md#changelist-jumplist)
- Basics: [Sessions?](README.md#sessions)
- Basics: [Folding?](README.md#folding)
- Tips: [Saner command-line history](README.md#saner-command-line-history)
- Usage: [Editing remote files](README.md#editing-remote-files)
- Usage: [Restore cursor position when opening file](#restore-cursor-position-when-opening-file)

View File

@ -21,6 +21,7 @@ added every day. Things about to be added can be found here:
- [Changelist? Jumplist?](#changelist-jumplist)
- [Quickfix and location lists?](#quickfix-and-location-lists)
- [Colorschemes?](#colorschemes)
- [Folding?](#folding)
- [Sessions?](#sessions)
- [Locality?](#locality)
@ -517,6 +518,31 @@ I use [gruvbox](https://github.com/morhetz/gruvbox) for the GUI and
More colorschemes: [here](#list-of-colorschemes-1)
#### Folding?
Every text (or source code) has a certain structure. If you have a structure, it
means you have regions of logically separated text. Folding allows to "fold"
such a region into a single line and displaying a short description. There are
many commands that act on these regions called _folds_. Folds can be nested.
Vim distinguishes between several types of fold methods:
| 'foldmethod' | Usage |
|--------------|-------|
| diff | Used in diff windows to fold unchanged text. |
| expr | Uses `'foldexpr'` to basically create a new fold method. |
| indent | Folds based on indentation. |
| manual | Create folds yourself via `zf, `zF`, and `:fold`. |
| marker | Folds based on markers in the text (often in comments). |
| syntax | Folds based on syntax, e.g. folding `if` blocks. |
Related help:
```
:h usr_28
:h folds
```
#### Sessions?
If you save a **view** (`:h :mkview`), the current state of the window (and