Fast history searching tool for bash.
Rewrite of this script using ncurses for blazing fast speed, hence the 2.
-
ncurses development headers/libraries (you need to do something like
sudo apt-get install ncurses-dev
on Ubuntu, orbrew install ncurses
on Mac, or install thelibncurses-devel
package on Windows/Cygwin) -
bash 4 (Mac install instructions)
-
make
You should be able to just run make
, and it should build fine assuming you have ncurses installed.
After you've built it simply run ./asdf
. You can add it to your PATH
to be able to use it from anywhere. Certain bash commands (like cd some/path
) won't run correctly because this will be inside of a subshell, which then exits, losing your changes. In order to get around that you can source asdf
instead of just running it. Simply add alias asdf="source /path/to/asdf"
to your .bashrc
.
Controls:
-
<Up>
/<Down>
-> select different commands -
<Enter>
-> runs the selected command -
<C-Space>
-> edit the selected command before running it -
<C-Del>
(or<C-\>
on Mac) -> remove the selected command (and any copies) from your HISTFILE
Not required, but adding the following to your .bashrc
can make interacting with your history a little bit nicer:
# make history virtually unlimited
export HISTSIZE=1000000
export HISTFILESIZE=$HISTSIZE
# make it so that asdf doesn't show up in the history
export HISTIGNORE="$HISTIGNORE:asdf*"
# append commands to the history as they're run (instead of after the shell exits)
shopt -s histappend
PROMPT_COMMAND="history -a;$PROMPT_COMMAND"
-
Clean up the code. It's kind of a mess right now. Manageable, but a mess.
-
Add support for other shells (
zshand fish at least) -
Add support for bash movement hotkeys (like
^W
deleting a word) -
Add regex support (assuming it doesn't slow things down too much)