5

I set up my iTerm to work a lot like OSX does in other text fields, eg ⌘ Command+Delete = delete line backward, ⌥ Option+left arrow = "move cursor back one word" and ⌥ Option+Delete = delete word backward, but the way I have it, ⌥ Option+Delete in bash/iTerm doesn't count / as a word separator, so if I have cd a/path/to/a/folder and I hit ⌥ Option+Delete it deletes the whole path, instead of just folder.

How can I set it up so that ⌥ Option+Delete only gets rid of folder? I realize this might need a bash solution, or an iTerm solution, but I don't know which. Or maybe it needs both.

6

In order to get this to work, in iTerm preferences I had to set the key alt+backspace (or w/e you have it as) to map to these hex codes:

0x1B 0x08
  • Good answer. For anyone else coming here using zsh, you'll also want to add autoload -U select-word-style select-word-style bash to your ~/.zshrc – Peter Dolan Jan 4 at 18:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .