Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

opening a fold and jumping to end of it in vim

Tags:

vim

folding

When I open a fold in vim by zo, I am at starting of opening fold. Then I need to usually jump to end of fold by ]z. Is there any single command for it?

like image 516
shampa Avatar asked Oct 06 '11 02:10

shampa


People also ask

How do I unfold a line in Vim?

The zr command will open all first-level folds in Vim, and zR will open all of the folds in the file. The zm command will re-fold the first-level folds, and zM will close all open folds in a file.

How to save folds in Vim?

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.

How do I navigate back in Vim?

Vim makes it easy to navigate previous locations: Ctrl + o navigate to the previous location in the jump list (think o as old) Ctrl + i navigate to the next location in the jump list ( i and o are usually next to each other) g; go to the previous change location.


1 Answers

No, but you can create a keymapping if you like.

nmap z] zo]z

nmap z[ zo[z

like image 87
Jin Avatar answered Oct 12 '22 22:10

Jin