0

To source my ~/.inputrc, I've tried C-x C-c and bind -f ~/.inputrc. I'm out of ideas, even after reading the man bash section on bind.


I have "\C-Rubout": backward-kill-word in my ~/.inputrc. But when I query bash with bind -q backward-kill-word, I don't get the output I expect:

$ bind -q backward-kill-word
backward-kill-word can be invoked via "\C-rubout", "\e\C-h", "\e\C-?".

I think that the wrong capitalization in rubout might be an issue, but no matter how I change my ~/.inputrc file, I can't get it to work!!

I'm struggling to find a good resource to help me learn how to become less incompetent at the bind part of bash... The results I'm getting seem erroneous, but I know better than to be confident about that until I know more about this stuff.


I've read through the gnu manual, and tried using \b, \d, and \177 in lieu of Rubout, but none of those worked. The one in the gnu manual (here) was pretty neat.

Ari Sweedler
  • 753
  • 6
  • 11
  • Are you asking "how can I load `.inputrc` changes into the current shell" or "how do I say `Rubout`"? – tripleee Mar 26 '18 at 10:29
  • @tripleee I was asking about an issue with getting commands in my `~/.inputrc` to show up properly. I suppose I should change the title, I now know better than to say "I want to source my inputrc", I really want to re-read my init file... In a previous edit of the question, I provided way too much useless information, but that information acted as a segue between the two parts of my question. Removing the spurious information makes the question read poorly. I suppose I should edit the title and re-add the spurious information – Ari Sweedler Mar 26 '18 at 10:41

1 Answers1

0

The default binding was not present in terminal. I needed to add "\C-x\C-r": re-read-init-file to my ~/.inputrc.

Re-reading an init file will not cause currently bound commands to go away. I was wrong to assume that deleting a line from my ~/.inputrc then calling bind -f ~/.inputrc would unbind said binding. Thus, This command actually DOES work at re-reading my init file.


I was troubleshooting poorly. Since my basics didn't work, all my knowledge was shaky. I was not re-sourcing my readline file, I was re-reading. This is a KEY difference

Additionally, binding a command multiple times in the same file seems to discard all but the last definition. All of my issues with troubleshooting led me to just give up.

Finally, I didn't know that there's both unix-word-rubout and backward-kill-word. They're 2 distinct commands, but they act the same on my terminal.


I realized that I could figure out how to represent delete by looking at a command that was bound to delete.:

$ bind -q backward-kill-word
backward-kill-word can be invoked via "\e\C-h", "\e\C-?".

My terminal converts delete differently than other terminals, I guess... I thought that ? was a placeholder for "I am unable to represent this", but that's ! I really just needed to use a literal ?, ASCII code 63.

Anyway, when I placed "\C-?": unix-word-rubout in my ~/.inputrc, everything worked perfectly :)

Ari Sweedler
  • 753
  • 6
  • 11
  • My terminal turns inputrc entry `Control-?` into keybinding `C-_`, but inputrc entry `"\C-?"` into keybinding `C-?` (which is what I actually wanted). – Ari Sweedler Mar 26 '18 at 10:37