3 ms·
I map <up> to history-search-backward in my .inputrc; so I can type 'sudo ' and press <up> to cycle through everything starting with sudo: # <up> --
by westurner 7y ago
I map <up> to history-search-backward in my .inputrc; so I can type 'sudo ' and press <up> to cycle through everything starting with sudo:
# <up> -- history search backward (match current input)
"\e[A": history-search-backward
# <down> -- history search forward (match current input)
"\e[B": history-search-forward
https://github.com/westurner/dotfiles/blob/develop/etc/.inputrc https://github.com/westurner/dotfiles/blob/develop/etc/.inpu...
- deeg 7y agoI do the exact same thing. This will probably be considered sacrilege by some but I also remap tab completion to cycle through all matches instead of stopping at the first ambiguous character: # Set up tab and Shift-tab to cycle through completion options "\e[Z": "\e-1\t" TAB: menu-complete # Alt-S is normal style TAB complete "\es": complete
- colejohnson66 7y ago> I also remap tab completion to cycle through all matches instead of stopping at the first ambiguous character Windows PowerShell does this and I love it. I don’t understand why people wouldn’t want this
- wruza 7y agoBecause instead of helping me enter a long filename by its distinctive parts, it forces flat mental read-decide-skip loop based on first few letters, which is slow and cannot be narrowed down without typing out additional letters by hand. It is like selecting from a popup menu through a 1-line window. If it presented a real popup for file selection, combining both worlds (tab to longest match, untab to undo, up-down to navigate), that would be great. But it doesn’t.
- nathanwh 7y agoFor anyone who isn’t already aware, fzf[0] does this exactly (and more!) https://github.com/junegunn/fzf https://github.com/junegunn/fzf
- wtallis 7y ago> which is slow and cannot be narrowed down without typing out additional letters by hand. In a PowerShell environment specifically, you usually end up having to backspace a dozen or more characters completed from a long command name before you can resume narrowing the search. It's less of a problem on a Unix shell where commands tend to be short.
- RHSeeger 7y agoInterestingly, that's one of the things I hate about powershell (and dos)
- skocznymroczny 7y agozsh works like that too.
- tln 7y agoI came here to post exactly this! Very useful. Two more quick tips 1. Undo is ^_ (ctrl+shift+-) 2. To learn more tricks... bindkey -p
- u801e 7y ago> Undo is ^_ (ctrl+shift+-) I use ctrl-/. I don't recall whether it's a default binding or not, but at least you don't have to press the shift key :-)
- dan-robertson 7y agoBoth are valid undo bindings in emacs so this is probably the reason that they are both supported. (I think this is an arrogant of a time where the keys were indistinguishable (and I think maybe they still are mostly indistinguishable to terminal apps))
- finnh 7y agoI did this a lot, too, until I started using fzf and mapped <Control-r> to fuzzy history search. It is really useful, you might like it!