From 13d8933fc220949155b5be339e4479e56e45476c Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Tue, 12 Jan 2016 14:12:27 +0100 Subject: [PATCH] Basics: Folding? --- CHANGELOG.md | 1 + README.md | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c13565..9716322 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/README.md b/README.md index 858b615..6a72dc0 100644 --- a/README.md +++ b/README.md @@ -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