4 ms·
The Missing Readline Primer
- 01100011 8y agoNo 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 8y agoYour 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.
- weggnog 8y agoIf 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 8y agoTry control e
- weggnog 8y agoNope. 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.
- deleted 8y ago[deleted]
- therein 8y agoCtrl-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.
- gabrielmoshe 8y agoFor 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 8y agoFZF + Z[1] is amazing: [1] https://github.com/rupa/z https://github.com/rupa/z
- m0nty 8y agoCtrl-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 8y agoVery useful indeed.
- cbm-vic-20 8y agoReminder, 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.