Closed andreaemonti closed 1 year ago
ZSH already uses Alt+Backspace to delete the previous word, so having Ctrl+Backspace is redundant. We should remove that and add Alt+Del for deleting the next word:
bindkey '^[Od' backward-word #
bindkey '^[[1;5D' backward-word #
bindkey '^[[1;5C' forward-word #
-bindkey '^H' backward-kill-word # delete previous word with ctrl+backspace
+bindkey '^[[3;3~' kill-word # delete next word with Alt+Del
bindkey '^[[Z' undo # Shift+tab undo last action
ZSH also already uses ctrl+D
to delete next word, then alt+del
would be redundant as well...
I thought that the point was not to add functionality, but rather bind to some key combinations not used by ZSH, the expected behaviour people are used to in (almost?) any text input field on linux.
In addition, I don't know why, but it seems (at least on my system) that both sh and bash has
ctrl + del
to delete next word
alt + backspace
to delete previous word
Then if you prefer, it would still makes sense to remove ctrl+backspace
and expect people to be used to alt+backspace
but still add ctrl+del
. I would understand that option, but I would still prefer (and will add to my .zshrc) the bindkey with ctrl.
ctrl+D
That deletes the next letter
Maybe we could do this instead to use Bash style bindkeys:
# Use bash-like word definitions for navigation and operations
autoload -Uz select-word-style
select-word-style bash
Lol, sorry, I meant alt+D to delete next word.
However it is a matter of habit I guess. I thought that the ctrl + backspace/del were more user friendly, as one can deduce them from the general usage of ctrl + arrows/end/home for navigation in text editors. But I recognize that no other shell does that, so sticking to other shells' bindkeys also makes sense, maybe
Since there is ctrl+backspace, it feels natural to add ctrl+del