[Tutor] OT: Vim was: free IDE for Python?

William O'Higgins Witteman hmm at woolgathering.cx
Fri Nov 17 18:17:22 CET 2006

On Fri, Nov 17, 2006 at 11:02:18AM +0530, Senthil_OR at Dell.com wrote:

>What the settings of ppl using vim for python?

A few Python-specific things that I have in my .vimrc are as follows:

set autoindent
set ts=2
set shiftwidth=2
set expandtab
set shiftround
set smarttab
filetype plugin on
syntax on
:inoremap ( ()<ESC>i
:inoremap [ []<ESC>i
:inoremap " ""<ESC>i
:inoremap { {}<ESC>i
:inoremap < <><ESC>i
autocmd BufNewFile *.py 0r ~/.vim/skel/skel.py

The python skeleton file looks like this:



Finally, my Python filetype file looks like this (just my changes):

:inoremap ' ''<ESC>i
abbr dd #debug
set spell!
" Code Macros

" Define a class in Python, with docstring
inoremap class class :<cr><tab>""""""<up><left>

" Define a function in Python, with docstring
inoremap def def ():<cr><tab>""""""<up><left><left><left>

" This is to create blocks when coding in Python
im :<cr> :<cr><tab>

That's about it.  I'm just a vim novice - there are lots of things I
haven't learned or don't use enough and forget.



More information about the Tutor mailing list