4 ms·
I have one question about terminal input that I cannot work out how to work out. The setup: I'm on a Mac, I use iTerm for my terminal, Fish for my shell, and m
by drcongo 4y ago
I have one question about terminal input that I cannot work out how to work out.
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?
- theblazehen 4y ago> 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
- drcongo 4y agoThanks, 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.
- fratajcz 4y agoThat 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/64e32421a43d3b8194d0409ce300518a https://gist.github.com/fratajczak/64e32421a43d3b8194d0409ce... [1]: https://github.com/prompt-toolkit/python-prompt-toolkit/blob/65c3d0607c69c19d80abb052a18569a2546280e5/src/prompt_toolkit/key_binding/bindings/named_commands.py#L386 https://github.com/prompt-toolkit/python-prompt-toolkit/blob...
- drcongo 4y agoOh you are a star, thank you so much!