Folding in vim

Bill Mill bill.mill at gmail.com
Wed Jul 6 16:10:38 EDT 2005


On 7/6/05, Terry Hancock <hancock at anansispaceworks.com> wrote:
> On Tuesday 05 July 2005 03:53 pm, Renato Ramonda wrote:
> > Why not use just spaces? Vim simplifies this immensely:
> >
> > set tabstop=4
> > set shiftwidth=4
> > set expandtab
> > set smarttab
> > set autoindent
> >
> > AFAICT this gives me all spaces, 4 spaces indent, tab inserts spaces and
> > backspace over a block of 4 spaces deletes all of them (just like
> > deleting a tab).
> 
> Yep, this is what I just set up in my .vimrc.  Works beautifully.
> 

I don't use any of the fancy indenters; instead, I just add

set foldmethod=indent

to my .vimrc (_vimrc on windows), along with most of the
aforementioned options (I don't like smarttab); it works nearly
perfectly. Then zo opens the fold under the cursor one level, zO opens
it recursively, zc and zC close it non- and recursively. zr opens all
folds one level, zR opens them all recursively, zm closes them all one
level, and zM closes them all recursively.

It's pretty sweet. Maybe we should have a big Vim-python tip-a-thon thread?

Peace
Bill Mill
bill.mill at gmail.com



More information about the Python-list mailing list