Andrew Channels Dexter Pinion

Wherein I write some stuff that you may like to read. Or not, its up to you really.

June 04, 2003

Python Folding in VIM

I've been playing with the folding for python plugin in Vim again. I'm now officially a fan.

I initially installed the plugin when it was first released but for some reason didn't get on with it. Its probably because all of my program files where quite small and easy to view on screen.

Well, now I've got a couple of monsters and whilst the taglist is useful, in combination with folding my copy of Vim is now practically an IDE.

I took a while figuring out how to switch folding on or off though. Its not obvious from the manual, and this method may not be the best so feel free to correct me in the comments, but with the Python fold script installed folding is by default on.

To switch it off I use;

:set foldmethod=syntax.

Then to switch folding back on I use;

:set foldmethod=expr

Smashing.

Posted by Andy Todd at June 04, 2003 02:21 PM

Comments

The url for the python_fold.py plugin is incorrect. It's http://vim.sourceforge.net/scripts/script.php?script_id=515

(At least, the current vim.org one comes up 404 for me.)

Posted by: Carlos Eberhardt on June 5, 2003 02:49 PM

The link to taglist plugin is also invalid - this script has an ID 273, not 2732

Posted by: Jarek Zgoda on June 6, 2003 08:13 AM

Thanks for the comments guys. Carlos, vim.org is a DNS redirect to vim.sourceforge.net so it was probably a temporary glitch.

Jarek, thanks I've changed the entry.

Posted by: Andy Todd on June 9, 2003 12:27 PM

I think the best way to switch folding on and off is with the "foldenable" option ("fen" for short). ":set fen" to turn folding on, ":set nofen" to turn it off.

Posted by: Steve Reeves on June 10, 2003 08:24 AM