Fwd: Re: [IPython-user] readline configuration + 4

Jerry McRae qrs0xyc02 at sneakemail.com
Tue Jun 21 13:24:55 CDT 2005


Somehow this did not get sent to the list.  Other Windows users can
improve their IPython experience with what I found.

(I vote for your list server software to default the reply address to
the mailing list so we all can benefit from the solutions to our
queries, and not just the person asking the question.)

Hi Scott,

You <> wrote on Monday (6/20/2005 at 4:31 PM) thus about [IPython-user] readline configuration + 4:
> Hi Jerry,
> I found most of what you might need at 
> http://cnswww.cns.cwru.edu/php/chet/readline/readline.html#SEC13

> - ESC for clearing a line is unusual for me.
> - For Word Left, Word right it's Alt-b, Alt-f but you could redifine as
> Ctrl-Left, Ctrl-Right I suppose, my guess is that it would be for backward
> word:

> readline_parser_and_bind "\C\e[D":  backward-word

> readline_parser_and_bind "\C\e[C":  forward-word

> But I haven't tested it.
> - There's "yank" command and which is really a paste

> I'm not sure how you would change what a 'word' is, there probably is a way
> but a quick look through the documentation didn't show up anything obvious.

> -Scott

thanks.  ESC clear the command in in Windows command prompt, DOS, Python,
and PythonWin, so I guess I'm used to it.

The 'yank' is a copy/paste within the current line.  I rarely use this
in linux, but I was just wondering.

And I assume you meant readline_parse_and_bind.  ;)

I tried this and it did not work either :(   but the following DOES
work in Windows AND it is easy to read! (note there is NOT quotes):

readline_parse_and_bind control-left:  backward-word
readline_parse_and_bind control-right:  forward-word

Also, I fixed readline to stop on WORDS like Linux/Cygwin with the
following simple changes in readline\PyReadlin.py:

in def forward_word:
365-      if self.line_buffer[self.line_cursor] not in string.letters + string.digits:
365+      if self.line_buffer[self.line_cursor] not in string.letters + string.digits \
              and self.line_buffer[self.line_cursor-1] in string.letters + string.digits :

in def backward_word:
374-      if self.line_buffer[self.line_cursor] not in string.letters + string.digits:
375+      if self.line_cursor and self.line_buffer[self.line_cursor-1] not in string.letters + string.digits\
              and self.line_buffer[self.line_cursor] in string.letters + string.digits :


Fernando: I agree with your reluctance to add a bunch of readline
bindings, AND I agree with your decision to put Scots bindings for clear-to
start/end as standard.
-- 
Jerry
___________________________
Office of the Naval Inspector General motto:
Yes.  We've Heard that.  No.  We Don't Think It's Funny.


=================
(Python 2.3.5, IPython 0.6.13, Windows XP)
===8<===========End of original message text===========




More information about the IPython-user mailing list