1

I've recently tried switching from being a long time tcsh user to bash and I was lamenting the extra key tapping for deleting "words" to the left, so I've been looking into modifying the behaviors in bash to make it more like tcsh so that I don't have to remap my 18 years of muscle memory. What I'm currently trying to figure out is:

How to change the "word boundaries" when escape delete is typed. (Note, I mean 2 separate key presses.)

In tcsh, when I want to delete a word to the left, I would repeat 2 keystrokes: escape delete. I know that bash uses control-w to kill the word to the left and I have figured out how to make that ignore dashes and underscores as word boundaries (but my tcsh muscle memory uses control-w to delete everything left of the cursor - bash's control-u). You can do one of either:

bind '\C-w:unix-filename-rubout'

or

stty altwerase

(though I don't know yet if that has any unintended side-effects - I'm still just trying to figure things out). Those each allow control-w to delete through dashes and underscores, but I don't know how they differ otherwise.

I was surprised however that the escape delete key sequence in both those cases was still stopping at dashes and underscores. I've tried different bind commands to change this, such as:

set bind-tty-special-chars Off
set bind-tty-special-chars On
bind '\e\C-h:unix-filename-rubout'
bind '\e\C-?:unix-filename-rubout'

But none of them change the word boundary behavior of escape delete.

Some notes: I really don't know what escape delete is doing in my terminal - i.e. what it's sending to bash. If I do control-v escape, I see ^[. If I do control-v delete, I see ^?. I'm using Terminal.app on macOS. I have the delete key set to not send control-h, because it doesn't behave the way I expect in every context. I also don't have option set as a meta key, as I've been cautious to not disrupt uses of option-arrow and option-click for cursor movement.

0

You must log in to answer this question.

Browse other questions tagged .