
The Missing Readline Primer - signa11
https://zwischenzugs.com/2019/04/23/the-missing-readline-primer/
======
01100011
No mention of .inputrc? An explanation of the kill ring would be nice.

Readline is great but I've been running into something that's driven me nuts
for a few weeks now. I recently switched to editing-mode=vi and it seems to
have changed the behavior of unix-word-rubout(normally ctrl-w). In emacs mode,
unix-word-rubout seems to append to the kill ring. In vi mode, it only
replaces it. So in emacs mode, I can eat several words with 'ctrl-w' and paste
them with 'ctrl-y'. In vi mode(after setting up the mappings), 'ctrl-y' only
pastes the last rubbed-out word.

~~~
akkartik
Your comment had enough info that I was able to Google the answer: when you
switch to vi mode, C-w gets switched to vi-unix-word-rubout. Override it in
.inputrc.

~~~
01100011
Sorry, I wasn't clear enough. I re-setup the mappings after enabling vi mode.
So I'm still mapping C-w to unix-word-rubout and not vi-unix-word-rubout.

~~~
akkartik
That was my suggestion as well :)

------
gabrielmoshe
For those who want a wonderful update to the C-r reverse search, I highly
recommend FZF[1], which allows fuzzy search of your command line history when
the keybindings are enabled (among other cool features).

[1] [https://github.com/junegunn/fzf](https://github.com/junegunn/fzf)

~~~
tambourine_man
FZF + Z[1] is amazing:

[1] [https://github.com/rupa/z](https://github.com/rupa/z)

------
cbm-vic-20
Reminder, if you're working on a project that you don't want to be "infected"
by the GPL, take a look at anitrez' Linenoise project:
[https://github.com/antirez/linenoise](https://github.com/antirez/linenoise)
It doesn't have all the bells and whistles as Readline, but chances are, you
won't miss them anyway.

------
weggnog
If I press Ctrl-R, start typing, and get to something like the following, how
do I keep what I've typed?

(failed reverse-i-search)`ssh some-host-i-want': ssh some-host-i-dont-want

I can't figure this out!

~~~
gumby
Try control e

~~~
weggnog
Nope. Ctrl-A and Ctrl-E both give the failed match (rather than what I typed).
I'm not sure if there's a way to do what I want.

~~~
therein
Ctrl-E works as far as my experience goes as well. What platform are you on?
It probably comes down to your shell in this situation.

------
m0nty
Ctrl-A and Ctrl-E are discussed. Try also Ctrl-K to delete to the end of the
line. Alt-B and Alt-F to move one word at a time. I'm sure there are many
more.

------
ngcc_hk
Very useful indeed.

