[IPython-User] Getting a clean prompt without Ctrl-C

Thomas Wiecki thomas.wiecki@googlemail....
Sat Jan 14 10:13:00 CST 2012


+1 on the Shift-Enter.

I don't really see why this should be inconsistent to the ipython text
console (which allows multiline with strg+enter).

Sorry for hijacking this thread.

On Sat, Jan 14, 2012 at 4:06 PM, Aaron Meurer <asmeurer@gmail.com> wrote:
> This is probably the most annoying default in IPython (unless we're
> counting the notebook, in which case I have to vote for Shift-Enter
> for execute).
>
> I put the following in my
> c.TerminalInteractiveShell.readline_parse_and_bind in my IPython
> profile.
>
> '"\\M-p": history-search-backward','"\\M-P": history-search-forward',
> '"\\C-p": history-search-backward', '"\\C-n": history-search-forward',
>
> The second two fix it to work like it does in bash.  I think this also
> changes the behavior of the arrow keys, but I could be wrong.  The
> first two set Alt-p and Alt-Shift-p to do search like it does now in
> IPython, based on the substring where the cursor is at.  I also put
> similar lines in my .inputrc to get this behavior in bash.
>
> Let me know if this doesn't work for you, because that means that
> there is something else in my IPython profile that is fixing this for
> me (you can see the whole thing at
> https://github.com/asmeurer/dotfiles/blob/master/.ipython/profile_default/ipython_config.py).
>
> Aaron Meurer
>
> On Sat, Jan 14, 2012 at 12:05 AM, Paul Ivanov <pivanov314@gmail.com> wrote:
>> Fernando Perez, on 2012-01-13 19:09,  wrote:
>>> On Fri, Jan 13, 2012 at 4:51 PM, Nikolaus Rath <Nikolaus@rath.org> wrote:
>>> > Is there a way to get a clean prompt using a different key combination
>>> > than Ctrl-C? Note that I don't want to interrupt any computations, I'm
>>> > talking about the case where I have lots of input in the prompt and want
>>> > to discard it all at once.
>>>
>>> Well, there's always C-a, C-k: go to beginning of line, kill line.
>>> That's actually what I use...
>>>
>>> It may be possible to hook up something with the python readline
>>> module and a readline configuration file (~/.inputrc), but you'd have
>>> to check the readline docs for that, it's not something IPython
>>> specific.
>>
>> Ctrl-U works under both emacs and vim modes for readline, and
>> Evan Patterson fulfilled my request that it be added to the QtConsole a
>> while back. It actually works in a lot of other places, too -
>> xchat, firefox and chrome inside location bar, as well as text
>> input boxes, etc.
>>
>> best,
>> --
>> Paul Ivanov
>> 314 address only used for lists,  off-list direct email at:
>> http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7
>> _______________________________________________
>> IPython-User mailing list
>> IPython-User@scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-user
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user


More information about the IPython-User mailing list