4 ms·
Ctrl-R! Ctrl-R! Ctrl-R! How many people have been on a screen sharing call and watched the other person tediously up-arrow through 5-10 commands to try to reru
by Steltek 4y ago
Ctrl-R! Ctrl-R! Ctrl-R!
How many people have been on a screen sharing call and watched the other person tediously up-arrow through 5-10 commands to try to rerun what they just did? The single greatest productivity boost you can gift a CLI newbie is searching their command history. Everyone jumps on the Emacs nav keys (C-f, C-b, etc) or other editing trivia. No one has trouble editing a command in place but it certainly takes some people way too long to run a command from one minute ago.
Also, purely selfishly, it's goddamned painful to watch the up-arrow dance and it wastes so much time. I want to scream.
- anamexis 4y agoFor extra boost, add fzf and its shell integration. https://github.com/junegunn/fzf https://github.com/junegunn/fzf
- petepete 4y agoI missed the shell integration when switching to Fish a couple of years ago. fzf.fish saved the day, I wouldn't be without the keybindings now (Ctrl+Alt+F is roughly the equivalent of **Tab) https://github.com/PatrickF1/fzf.fish https://github.com/PatrickF1/fzf.fish
- grimgrin 4y agoctrl+r is great so is modifying your inputrc so you can still use up arrows but filter the options by first typing a bit of text i.e. $ find <up arrow to just show lines starting with find> tada: $if mode=emacs "\e[A": history-search-backward "\e[B": history-search-forward $endif I do a bit more in that if block, but trimmed it down to make a point
- yamtaddle 4y agoI'm really bad about picking up new keyboard shortcuts (I end up using them little enough that unless I take out time for focused practice, I'll forget them—I'm pretty sure I'm just never gonna get decent at vim or emacs, for this reason, aside from basic navigation keys) but took to this one instantly because it's so damn useful that I used it several times the very first day I learned it, kept using it the rest of the week, and have used it almost daily ever since. Doesn't hurt that it's reasonably mnemonic ("R" for "reverse-search") Reverse-history-search is amazing and I don't know how I went as long as I did without knowing about it.