L’editor vim

Una de les moltes possibilitats per a programar en Python és convertir l’editor de text vim en un entorn de programació més adequat a aquest llenguatge, un IDE que es diu.

No cal fer gran coses per aconseguir-ho.

Tan sols crear el següent fitxer al teu directori personal:

$ cat .vimrc
” .vimrc

” Created by Jeff Elkner 23 January 2006
Last modified 2 February 2006

Turn on syntax highlighting and autoindenting
syntax enable
filetype indent on
” set autoindent width to 4 spaces (see
http://www.vim.org/tips/tip.php?tip_id=83)
set et
set sw=4
set smarttab
” Bind <f2> key to running the python interpreter on the current active
file. (curtesy of Steve Howell from email dated 1 Feb 2006).
map <f2> :w\|!python %<cr>

I ja està! Aconseguim que l’editor vim indente amb quatre espais i acolore un poc el codi per a fer-lo més entenible. També permet executar el programa prement la tecla F2 sense eixir de l’editor.

Referència: http://www.ibiblio.org/obp/pyBiblio/tips/elkner/vim4python.php

Captures de pantalla: http://pygtk.vcubells.net/captures/vim/

Fitxers: http://pygtk.vcubells.net/fitxers/