0

I have my iTerm2 configured with a shortcut to delete a word (keyboard mapping of Hex code 0x17). However, I want it to delete until reaching a whitespace:

Current: cd hello-world -> cd hello-

Wanted: cd hello-world -> cd

Is there a way to configure the non-word separators somehow? Or to achieve this by other means?

  • You are using `zsh`, right? I believe that is the default on macOS these days. Please edit your question adn add that in (if you don't know, look at the output of `ps -p $$`, does it mention `bash` or `zsh`? – terdon Jan 29 '23 at 15:33
  • Does this answer you question? [zsh keybindings: make backward-kill-word act on whole quoted string](https://unix.stackexchange.com/q/665461) – Kusalananda Jan 29 '23 at 17:18
  • Also tangentally related: [What's the shortcut to delete a word "forward" in a unix terminal?](https://unix.stackexchange.com/a/394418) – Kusalananda Jan 29 '23 at 17:19
  • Thanks! I added `zsh` tag - also, @Kusalananda - the link you provided seemed to solve it! – Yaron Budowski Jan 29 '23 at 21:05

1 Answers1

1

Thanks to @Kusalananda - This answer seems to do it: Adding the following to the .zshrc file:

autoload -U select-word-style
select-word-style whitespace