vnoremap h :<c-u>1,'<lt>-fold<bar>'>+,$fold<cr>
That, combined with foldmethod=manual, is perfect. Thanks, Tim and Charles.

Sooo...

vnoremap h set foldmethod=manual | :<c-u>1,'<lt>-fold<bar>'>+,$fold<cr>

doesn't work :)

I think you want

vnoremap h :<c-u>set foldmethod=manual<bar> 1,'<lt>-fold<bar>'>+,$fold<cr>

(on one line in case mailers decide to bung it)

You might also want to add in

        exec "norm zE"

in there after the "foldmethod=manual" to clear out any existing folds, as switching foldmethod to manual (having been something else previously) will keep those folds. Funky things happen when folds overlap (as in "well-formed XML") so Vim tries to do the smart thing with them, but it may not be what you expect...thus you may want to use "zE" to clear out previously existing folds.

-tim



Reply via email to