I recently downloaded Python-Mode. When I open a python script, my functions are folded. I can unfold easily (it's one of the movement keys when you're on top the function definition). However, I can't figure out how to re-fold the function.
Moreover, and perhaps most importantly, :help pymode
returns an error ('E149: Sorry, no help for pymode'). So I can't even look up the documentation.
Any help would be appreciated.
It maps alt+1 to fold the first python indent level (class definitions and functions), alt+2 to fold the second level (class methods), and alt+0 to unfold everything. It makes sure it only folds one level and doesn't fold any of the nested sub levels. You can still use za to toggle folding for the current block.
z Shift + o opens all folds at the cursor. z c closes a fold at the cursor. z m increases the foldlevel by one. z Shift + m closes all open folds.
Yanis. March 15, 2020. Folding is a way to hide a chunk of text, and thus unclutter the view. That comes handy when you need to focus on some other part of code, or if you want to get a quick overview of the whole file.
The problem is that when you close Vim, your artfully folded code returns to its unfolded state. The solution is quite simple - when you are ready to save your folds run the :mkview command. This will save your folds in the current buffer to your viewdir ( :h viewdir ) depending on your environment.
Here a list of folding commands:
zf#j creates a fold from the cursor down # lines.
zf/string creates a fold from the cursor to string .
zj moves the cursor to the next fold.
zk moves the cursor to the previous fold.
zo opens a fold at the cursor.
zO opens all folds at the cursor.
zc close a fold at the cursor.
zm increases the foldlevel by one.
zM closes all open folds.
zr decreases the foldlevel by one.
zR decreases the foldlevel to zero -- all folds will be open.
zd deletes the fold at the cursor.
zE deletes all folds.
[z move to start of open fold.
]z move to end of open fold.
What you are looking for is zc
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With