News for hackers. Stuff that matters.
Re:Show HN: McFly, a smart Bash history search CLI in Rust w... by Wowfunhappy on Tuesday December 04, 2018 @12:29AM (#18596577)
TIL I can use ctrl+R to search bash history! This is going to save me a lot of time going forward!
Re:Show HN: McFly, a smart Bash history search CLI in Rust w... by asicsp on Tuesday December 04, 2018 @06:51AM (#18598565)
I rarely use ctrl+r, because most of the time I'm searching based on command name, which is at the start (unless it is in pipeline, etc).. so, I use this instead in `.inputrc`:

    # use up and down arrow to match search history based on typed starting text
    "\e[A": history-search-backward
    "\e[B": history-search-forward
Re:Show HN: McFly, a smart Bash history search CLI in Rust w... by Wowfunhappy on Tuesday December 04, 2018 @03:14PM (#18603225)
This is wonderful, thank you!
Re:Show HN: McFly, a smart Bash history search CLI in Rust w... by 0db532a0 on Tuesday December 04, 2018 @06:58AM (#18598600)
This is actually a general feature of the GNU readline library, which a lot of programmes including bash use. For instance, a lot of REPLs like ghci use it.

https://linux.die.net/man/3/readline

https://tiswww.cwru.edu/php/chet/readline/rltop.html

Re:Show HN: McFly, a smart Bash history search CLI in Rust w... by majewsky on Tuesday December 04, 2018 @07:31AM (#18598806)
As does my favorite underappreciated Unix CLI tool, units(1).

  $ units --verbose
  You have: 1 mile * 20 pounds force
  You want: joule
          1 mile * 20 pounds force = 143174.38 joule
          1 mile * 20 pounds force = (1 / 6.98449e-06) joule
Re:Show HN: McFly, a smart Bash history search CLI in Rust w... by 0db532a0 on Tuesday December 04, 2018 @07:34AM (#18598819)
I had no idea of that command. Thanks.
Re:Show HN: McFly, a smart Bash history search CLI in Rust w... by JetSpiegel on Tuesday December 04, 2018 @08:11PM (#18604970)
For dumb terminals, you can also use rlwrap: https://linux.die.net/man/1/rlwrap
Re:Show HN: McFly, a smart Bash history search CLI in Rust w... by jaster on Tuesday December 04, 2018 @05:10AM (#18598051)
Additional tip: if you overshoot and miss the command you wanted by hitting ctrl+R too much times (as it happens sometime when looking for an older command), you can go forward with ctrl+S. [EDIT: As Hikikomori pointed (thanks!), I got my shortcuts mixed up, ctrl+S is the shortcut for zsh, and the equivalent for bash is ctrl+shift+R]

(ctrl+S and ctrl+R are based on emacs shortcuts, where ctrl+S is search and ctrl+R is reverse search)

Re:Show HN: McFly, a smart Bash history search CLI in Rust w... by 0db532a0 on Tuesday December 04, 2018 @06:53AM (#18598576)
Note that your terminal emulator needs to pass the ctrl+S through. ctrl+S won’t work by default in a lot of cases from personal experience.
Re:Show HN: McFly, a smart Bash history search CLI in Rust w... by Hikikomori on Tuesday December 04, 2018 @05:19AM (#18598090)
Doesn't work on GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18)

ctrl+shift+r works though.

Re:Show HN: McFly, a smart Bash history search CLI in Rust w... by jaster on Tuesday December 04, 2018 @06:06AM (#18598300)
Yep you're right, I got my shortcuts between bash and zsh mixed-up. I edited my post, thanks for the correction.

(Not sure why bash did not go the obvious route here, I guess they already had something on ctrl+S when they implemented forward search...)

EDIT: actually, you can activate ctrl+S for search-foward on bash by using `stty -ixon`. See more info about why here https://unix.stackexchange.com/questions/141422/searching-hi...

Re:Show HN: McFly, a smart Bash history search CLI in Rust w... by fnord123 on Tuesday December 04, 2018 @07:12AM (#18598670)
ctrl-s is usually for pausing the terminal (where ctrl-q resumes it).

https://en.wikipedia.org/wiki/Software_flow_control

Re:Show HN: McFly, a smart Bash history search CLI in Rust w... by craftyguy on Tuesday December 04, 2018 @12:15PM (#18601379)
Now you should try fzf and take your command searching to a whole new level with fuzzy find!

https://github.com/junegunn/fzf/wiki/Examples#command-histor...