Re:Why is the terminal input so weird?
by theblazehen on Wednesday November 16, 2022 @02:31PM
(#33629140)
> I'm guessing that the rough flow of the delete word signal is iTerm -> Fish -> iPython and that iPython is the thing that's being overzealous?
Almost correct. Once you launch iPython, Fish is out of the picture until you quit iPython. However yes iPython does handle Ctrl-W differently from your shell
Re:Why is the terminal input so weird?
by drcongo on Wednesday November 16, 2022 @02:41PM
(#33629353)
Thanks, that helps narrow it down. Next to work out how to make it behave more like fish, as Ctrl+w deleting the entire string `test.func('param1',` seems like madness to me.
Re:Why is the terminal input so weird?
by fratajcz on Wednesday November 16, 2022 @06:44PM
(#33632691)
That bothered me too, the default function for Ctrl-W in ipython is unix-word-rubout from python-prompt-toolkit [1], which uses spaces for word boundaries. You can rebind it to backward-kill-word so it uses "not a letter nor a digit" as a word boundary.
Here's a gist with my config (also binds shift-left/right arrow to move to previous space instead of visual select): https://gist.github.com/fratajczak/64e32421a43d3b8194d0409ce...
[1]: https://github.com/prompt-toolkit/python-prompt-toolkit/blob...
The setup: I'm on a Mac, I use iTerm for my terminal, Fish for my shell, and most often I'm inside a docker container also running Fish and using iPython.
The question: When I Ctrl+W to delete a word in a Fish prompt, what counts as a word is different to what counts as a word in iPython. For instance, Ctrl+w at the end of this string `test.func('param1', 'param2')` produces...
Fish: test.func('param1', 'param2'
iPython: test.func('param1',
Hit Ctrl+w again, and you get...
Fish: test.func('param1', '
iPython: all gone.
This causes me to over delete in iPython many, many times per day. I'm guessing that the rough flow of the delete word signal is iTerm -> Fish -> iPython and that iPython is the thing that's being overzealous?