[Tutor] command line

dman dman@dman.ddts.net
Sun, 31 Mar 2002 15:45:09 -0600


On Sun, Mar 31, 2002 at 11:09:31AM -0500, Erik Price wrote:
| 
| On Sunday, March 31, 2002, at 05:14  AM, Andrei Kulakov wrote:
| 
| >I like to use vim commands to edit any substantial amount of code - hjkl
| >and the like for movement, I can't stand cursor keys.
| >
| >No place like home (row) :-).
| >
| >Python interpreter is plenty enough for me to look things up quickly.
| 
| Similarly, but differently, I can't stand cursor keys -- but I prefer 
| the emacs bindings (nkpf).  I use the interpreter/shell (IOW call python 
| from the command line with no args), but I've noticed that I can't use 
| the typical emacs key bindings to move backward and forward through my 
| history.  Is this the way it is, or is there some way I can configure 
| the interpreter to return lines from my command history using these 
| bindings?

Depends on how it was compiled.

| I have my bash shell environment variable 
| EDITOR=/usr/bin/emacs and this works for all of my other programs,

That is for programs that want to invoke an editor on a temporary file
and then read that data back in.  For example 'cvs' uses this.

| but not for Python.

Python doesn't invoke editors at all,

| Does anyone know if this feature exists?

I see you're using "Apple Mail".  Are you on OSX?  If so fire up a
shell and try 
    ldd `which python`

and see if "libreadline" is mentioned anywhere in the output.  My
guess is that it won't be.  GNU readline is a library (made by the GNU
folks) for reading a lines of input from a terminal.  bash uses it and
python _can_ use it if it was compiled with it.  This is what gives
command history and line editing with emacs or vi style keybindings.
The default for readline is 'emacs' style.

-D

-- 

The righteous hate what is false,
but the wicked bring shame and disgrace.
        Proverbs 13:5