[Tutor] IDLE Usage - was Interpreter Restarts

bhaaluu bhaaluu at gmail.com
Tue Jul 17 14:16:18 CEST 2007


Greetings,

I use an editor called 'vim' on GNU/Linux.
I invoke vim on the command-line by typing: vi
(vi is a link to /usr/bin/vim)
In my home directory I have a vim config file
named .vimrc (that is: dot_vimrc [the dot makes it hidden]).
The .vimrc file has some things in it that do some nice stuff
for editing Python files; such as syntax highlighting, line numbers,
indenting, and also runs Python when I press the F2 function key.
I run vim in an X ternminal called Konsole. I can also run it
from the command-line in any tty.

Okay, here it is. Just copy/paste this into an editor, and save it as:
.vimrc

-------------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 nu
set et
set sw=4
set smarttab
" Bind <f2> key to running the python interpreter on the currently active
" file.  (curtesy of Steve Howell from email dated 1 Feb 2006).
map <f2> :w\|!python %<cr>
-------------8<------Cut Here-------->8---------------

To use it, just type: vi myCode.py
(If you don't have a link named vi that points to /usr/bin/vim,
you'll have to type vim or /usr/bin/vim to get it going...
since I don't have any idea what you're working at, I can't say.)

Once you're in vim, looking at your code, press F2 to run it.

I understand that Emacs also does Python! =)
But I won't go there... I don't do Emacs.
-- 
bhaaluu at gmail dot com

On 7/17/07, Luke Paireepinart <rabidpoobear at gmail.com> wrote:
> A lot of Python programmers
> use Vi for writing their code.  do you have access to that through SSH?
> I'm not quite sure what you mean by "SSH editor."
> -Luke
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list