Distinguish "Natural Text Editing" key preset between bash and zshell?
Today I pressed ⌘+Backspace and expected to delete the line from cursor until the beginning. Instead it deleted the whole line. This used to work, and I quickly found out why: I'm using the key preset "Natural Text Editing" which maps ⌘+Backspace to Hex Code
0x15. This, apparently corresponds to ⌃U which in bash means "delete from cursor to beginning of line.
However now that
zsh is the default shell in macOS Catalina, ⌃U is actually mapped to "kill-whole-line" instead (as evidenced by running command
bindkey in terminal). I have fixed this by adding this to by .zsh config file:
bindkey -e bindkey \^U backward-kill-line
However this made me think: Can / should this be solved by iTerm automatically? One problem is that, as far as I can see, there is no default shortcut for
backward-kill-line, which means that iTerm 2 simply can't offer two versions (bash / zsh) of the "Natural Text Editing" key preset. But some solution would be nice.