tags:

views:

45

answers:

1

I use do auto indenting follow lines that begin with python keywords in Vim using this command.

autocmd BufRead *.py  set smartindent cinwords=if,elif,else,for,...

Is there a way to do a "smartoutdent" for keywords like return or break?

Thanks.

+1  A: 

I use:

filetype indent on
filetype plugin indent on
set autoindent

and it automatically back-indents after statements such as return, break and continue.

I'm not sure if all are necessary, or if it meets your requirements of "smartoutdent", but perhaps it will help.

Peter Gibson
The first line isn't necessary. The second line turns `filetype indent` on too. You're also not using autoindent if you're using filetype indent. Summary: use only the second line and you'll be good for all filetypes `vim` knows about.
Jefromi