News for hackers. Stuff that matters.
Re:The Missing Readline Primer by 01100011 on Monday May 13, 2019 @09:04PM (#19905794)
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.

Re:The Missing Readline Primer by akkartik on Monday May 13, 2019 @09:24PM (#19905922)
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.
Re:The Missing Readline Primer by 01100011 on Monday May 13, 2019 @11:24PM (#19906532)
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.
Re:The Missing Readline Primer by akkartik on Monday May 13, 2019 @11:47PM (#19906626)
That was my suggestion as well :)
Re:The Missing Readline Primer by gabrielmoshe on Monday May 13, 2019 @10:45PM (#19906357)
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

Re:The Missing Readline Primer by tambourine_man on Tuesday May 14, 2019 @12:02AM (#19906679)
FZF + Z[1] is amazing:

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

Re:The Missing Readline Primer by cbm-vic-20 on Tuesday May 14, 2019 @08:05AM (#19908721)
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 It doesn't have all the bells and whistles as Readline, but chances are, you won't miss them anyway.
Re:The Missing Readline Primer by weggnog on Monday May 13, 2019 @09:18PM (#19905878)
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!

Re:The Missing Readline Primer by gumby on Monday May 13, 2019 @10:07PM (#19906183)
Try control e
Re:The Missing Readline Primer by weggnog on Monday May 13, 2019 @11:07PM (#19906460)
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.
Re:The Missing Readline Primer by therein on Wednesday May 15, 2019 @05:11AM (#19917622)
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.
Re:The Missing Readline Primer by m0nty on Tuesday May 14, 2019 @05:31AM (#19908008)
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.
Re:The Missing Readline Primer by ngcc_hk on Tuesday May 14, 2019 @07:35AM (#19908564)
Very useful indeed.