(Move categories to tip template) |
(Change <tt> to <code>, perhaps also minor tweak.) |
||
Line 4: | Line 4: | ||
|previous=1193 |
|previous=1193 |
||
|next=1195 |
|next=1195 |
||
− | |created= |
+ | |created=2006 |
|complexity=basic |
|complexity=basic |
||
|author=Ethan Mallove |
|author=Ethan Mallove |
||
Line 12: | Line 12: | ||
|category2= |
|category2= |
||
}} |
}} |
||
− | I think it makes more sense for < |
+ | I think it makes more sense for <code>]z</code> and <code>[z</code> to navigate to the next/previous open fold, so I added the following to my vimrc: |
<pre> |
<pre> |
Latest revision as of 06:12, 13 July 2012
Tip 1194 Printable Monobook Previous Next
created 2006 · complexity basic · author Ethan Mallove · version 6.0
I think it makes more sense for ]z
and [z
to navigate to the next/previous open fold, so I added the following to my vimrc:
function! GoToOpenFold(direction) let start = line('.') if (a:direction == "next") while (foldclosed(start) != -1) let start = start + 1 endwhile else while (foldclosed(start) != -1) let start = start - 1 endwhile endif call cursor(start, 0) endfunction nmap ]z :cal GoToOpenFold("next") nmap [z :cal GoToOpenFold("prev")
Comments[]
Add the normal command "zj/zk" if you'd prefer to have the mapping jump out of the current open fold and into the next open fold.
" set ]z and [z go to find open folds function! GoToOpenFold(direction) if (a:direction == "next") normal zj let start = line('.') while foldclosed(start) != -1 let start = start + 1 endwhile else normal zk let start = line('.') while foldclosed(start) != -1 let start = start - 1 endwhile endif call cursor(start, 0) endfunction