[Tutor] Thanks

dman dsh8290@rit.edu
Thu, 8 Nov 2001 13:27:41 -0500


On Thu, Nov 08, 2001 at 10:49:17AM +0000, John Precedo wrote:
| Edy Lie asked:
| > I was wondering anyone use vi or vim to code in
| > python. It would cool if
| > there is a .vimrc which could do automatic indentation.
| 
| If you are on a PC, you can use gvim.
| 
| According to one of the guys in my office (who is a big fan), it does syntax
| colorizing and all kinds of cool stuff. You can even use Python as the macro
| language (extension language?) for it. And I _think_ it does indentation as
| well.

Yes, it does all of this.  I use (g)vim exclusively for all coding
(python and otherwise).  Version 6 is out now and has a lot of neat
new features including filetype plugins.  A piece of my vimrc looks
like :

" enable the new filetype plugins and the indent plugins
filetype on
filetype plugin on
filetype indent on

" this takes effect when the syntax file is loaded
let python_highlight_all = 1

augroup Python
    au!
    au BufNewFile *.py 0read ~/util/templates/Python.py

    " see also :help smartindent , cinwords
    au FileType python set autoindent smartindent sts=4 sw=4 tw=80 fo=croq

    " turn off the C preprocessor indenting
    " (allow comments in Python to be indented properly)
    au FileType python inoremap # X^H#

    au FileType python set foldenable foldmethod=indent
augroup END


Vim has lots of awesome features that make coding really pleasant.  If
you want more details on them (or even my entire .vimrc) just ask.

-D