You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With ipython 5.1.0/prompt-toolkit 1.0.9 using the vi keybindings, Esc-/ initiates a forward search. What exactly is the use case for that, and in what situation would such a search find anything? This is not the readline behavior, and therefore this is completely unlike the behavior in bash, prior versions of ipython, or pretty much any other REPL anyone would have used.
I actually thought the search was broken until I discovered that Esc-? initiates a backward search, which is what I really want. It just happens to be that's a more awkward keystroke and it's going against many years of habit.
I can't imagine other people don't find this super frustrating as well, so I'm surprised I didn't find mention of this in any other issue. Unless there's a really compelling case for the current behavior, I suggest that it be reverted.
At the very least, I would like to know if there's a way to rebind the key strokes locally so I can fix this at least on my present installation.
You can customise the keyboard shortcuts as described here, but for now you'll need to search through prompt_toolkit source code to find what function it needs to call.
I don't think IPython defines any shortcuts specific to vim mode, so this is probably in prompt_toolkit. Jonathan often responds quickly when we ping him, though. So I'd suggest you give it a day or two, and if he doesn't say anything, re-file it on PT.
For this, I copied the behaviour of Vi. The reason is that we support multiline editing. So, if you're at the start of a multiline buffer, then you could use forward search to jump forward. In a block of multiline text, you'll get more of the Vi feel, rather than a readline feeling.
But maybe you're right. It could make sense to follow GNU readline, and use question mark to search forward.
Could you open an issue in prompt_toolkit? Maybe I could make this easier to configure, or if I feel that everyone thinks it should be like readline, then I could reverse it.
Multiline editing is a very nice feature. As a longtime vim and bash user, though, the switch to IPython 5.x and prompt_toolkit has been jarring. I would much prefer that vi-mode in prompt_toolkit behaved like it does in GNU readline.
I see that this has been changed in prompt_toolkit, so when PT 1.0.10 or greater is released, it should be fixed in IPython without needing any change from us.
Activity
takluyver commentedon Dec 5, 2016
@jonathanslenders ? It might just be an oversight.
You can customise the keyboard shortcuts as described here, but for now you'll need to search through prompt_toolkit source code to find what function it needs to call.
altaurog commentedon Dec 5, 2016
Thanks. I see. That was what I needed to get me pointed in the right direction. Shall I move this issue to the prompt_toolkit repo?
takluyver commentedon Dec 5, 2016
I don't think IPython defines any shortcuts specific to vim mode, so this is probably in prompt_toolkit. Jonathan often responds quickly when we ping him, though. So I'd suggest you give it a day or two, and if he doesn't say anything, re-file it on PT.
altaurog commentedon Dec 5, 2016
This seems to do the trick. It retrieves the bound functions for '/' and '?' and switches them.
jonathanslenders commentedon Dec 5, 2016
Hi @altaurog,
For this, I copied the behaviour of Vi. The reason is that we support multiline editing. So, if you're at the start of a multiline buffer, then you could use forward search to jump forward. In a block of multiline text, you'll get more of the Vi feel, rather than a readline feeling.
But maybe you're right. It could make sense to follow GNU readline, and use question mark to search forward.
Could you open an issue in prompt_toolkit? Maybe I could make this easier to configure, or if I feel that everyone thinks it should be like readline, then I could reverse it.
ndronen commentedon Dec 10, 2016
Multiline editing is a very nice feature. As a longtime vim and bash user, though, the switch to IPython 5.x and prompt_toolkit has been jarring. I would much prefer that vi-mode in prompt_toolkit behaved like it does in GNU readline.
I've opened prompt-toolkit/python-prompt-toolkit#431 to move the discussion over there.
jonathanslenders commentedon Dec 11, 2016
@ndronen. I completely understand it. Thanks a lot for opening the issue!
takluyver commentedon Jan 12, 2017
I see that this has been changed in prompt_toolkit, so when PT 1.0.10 or greater is released, it should be fixed in IPython without needing any change from us.
ivanov commentedon May 17, 2017
I just want to mention that if you would like the old (IPython <= 4.x) readline interface, it is now available separately as rlipython.
Right now, it only works in IPython 6.0 (Python 3), but it will also work in Python 2 with the next IPython 5 release (5.4).