[Tutor] new on the list
bhaaluu
bhaaluu at gmail.com
Thu Feb 28 14:04:47 CET 2008
On Thu, Feb 28, 2008 at 4:51 AM, Alan Gauld <alan.gauld at btinternet.com> wrote:
> <tonytraductor at linguasos.org> wrote
>
> > (I wrote these using a simple text editor that I made with Tcl,
> > too, http://www.linguasos.org/tcltext.html )
>
> Fine but it will be easier to use a syntax aware full featured
> editor like vim or Idle or emacs or Scite
>
> But overall you are on the right lines.
>
>
> --
> Alan Gauld
> Author of the Learn to Program web site
> Temorarily at:
> http://uk.geocities.com/alan.gauld@btinternet.com/
> Normally:
> http://www.freenetpages.co.uk/hp/alan.gauld
I also run Python on Linux. I've tried several of the Python IDEs
(Integrated Development Environments), such as IDLE, Eric, and
so forth, but the best (for me) has been vim. I use the following
.vimrc file:
-------------8<-----Cut Here----->8-------------------
" .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
" set line number (added by bhaaluu)
set nu
" Bind <f2> key to running the python interpreter on the currently active
" file. (courtesy of Steve Howell from email dated 1 Feb 2006).
map <f2> :w\|!python %<cr>
-------------8<-----Cut Here----->8-------------------
I run vim in Konsole, but any Xterm works, AFAIK.
Since the Traceback exceptions in Python usually have a line number,
I added that 'feature' to the .vimrc file.
Note the last line that starts with 'map'. That allows you to run your
typed-in Python program from within vim by simply pressing the F2 function key.
At the end of the run, you'll be prompted to press <Enter> to return to editing
your program in the vim editor.
Since I have vim linked to the 'vi' command, all I have to do to start editing
a new program is to enter a command similar to this at the bash prompt:
$ vi myNewPythonProgram.py
Then, I stay in vim to edit the program, run it, modify it, debug it, etc.
The syntax highlighting and autoindent features enabled in the .vimrc file
make programming in Python a fun and enjoyable experience.
Happy Programming!
--
b h a a l u u at g m a i l dot c o m
"You assist an evil system most effectively by obeying its
orders and decrees. An evil system never deserves such
allegiance. Allegiance to it means partaking of the evil.
A good person will resist an evil system with his or her
whole soul." [Mahatma Gandhi]
More information about the Tutor
mailing list