E.g. Alt-d deletes word until next word boundary. There's also a shortcut to delete until previous word boundary IIRC, but I'd like to delete word UNDER cursor (i.e. to current word left boundary and next word boundary).

Is this even available in readline?

  • Alt-Backspace deletes to previous word boundary. Not sure if there's a way to map a keystroke to Alt-d Alt-Backspace – glenn jackman Mar 25 '15 at 14:22

OK found it: you can create key bindings to "macros": http://manpages.ubuntu.com/manpages/trusty/en/man3/readline.3readline.html

First, choose a key combination you want to use for this "kill whole word" operation -- peruse bind -sp | sort | less to see what's in use.

Suppose Ctrl-xCtrl-w is OK, then

echo '"\C-x\C-w": "\ed\e\C-h"' >> ~/.inputrc

Start a new shell, and you should be good to go.

Although Ctrl-xCtrl-w is just as easy/awkward as Alt-dAlt-Backspace

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.