Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ideavim Folding and Expanding Code Blocks

What is the key binding for folding and expanding code blocks in ideavim plugin ?

(za works in vrapper for eclipse , but not in ideavim )

like image 594
amin Avatar asked Jul 04 '14 09:07

amin


People also ask

How do you fold codes in PyCharm?

To fold or unfold a code fragment, press Ctrl+NumPad - / Ctrl+NumPad + . PyCharm folds or unfolds the current code fragment, for example, a single method. To collapse or expand all code fragments, press Ctrl+Shift+NumPad - / Ctrl+Shift+NumPad + .

What is code folding in IntelliJ?

endregion comments depending on the style you need, and name the created custom region. Now, when you select the Custom folding regions option, IntelliJ IDEA will fold such regions when you open your file in the editor. Before. After. Android - language-specific code fragments in Android.


2 Answers

source : ideavim help: fold

zo Open one fold under the cursor. When a count is given, that many folds deep will be opened. In Visual mode one level of folds is opened for all lines in the selected area.

zc Close one fold under the cursor. When a count is given, that many folds deep are closed. In Visual mode one level of folds is closed for all lines in the selected area. 'foldenable' will be set.

zM Close all folds: set 'foldlevel' to 0. 'foldenable' will be set.

zR Open all folds. This sets 'foldlevel' to highest fold level.

like image 136
amin Avatar answered Nov 16 '22 02:11

amin


Adding these lines to your ~/.ideavimrc allows the zO and zC commands, which recursively open and close the folds under the cursor:

nnoremap zC :action CollapseRegionRecursively<CR>
nnoremap zO :action ExpandRegionRecursively<CR>

I find these to be super-helpful in vim, and was missing them when using PyCharm with IdeaVim. (HT: https://github.com/JetBrains/ideavim/pull/97 )

like image 27
batguano Avatar answered Nov 16 '22 01:11

batguano