Skip to content
Rewrite of my asdf utility using ncurses.
C Shell Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
Makefile
Readme.md
asdf
asdf_search.c
strmap.c
strmap.h

Readme.md

ASDF2

Fast history searching tool for zsh / bash.

Rewrite of this script using ncurses for blazing fast speed, hence the 2.

Using asdf to search for a command and running it:

Example of running asdf

Using asdf to search for a command, and edit it before running:

Example of editing a command

Using asdf to delete a command from the history:

Example of deleting a command

Building

Requirements:

  • ncurses development headers/libraries (you need to do something like sudo apt-get install ncurses-dev on Ubuntu, or brew install ncurses on Mac, or install the libncurses-devel package on Windows/Cygwin)

  • zsh or bash 4 (Mac install instructions)

  • make

You should be able to just run make, and it should build fine assuming you have ncurses installed.

Running

After you've built it simply run ./asdf. You can add it to your PATH to be able to use it from anywhere. Certain shell 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 .zshrc/.bashrc.

Controls:

  • <Up>/<Down> -> select different commands

  • <Enter> -> runs the selected command

  • <C-Space> -> edit the selected command before running it

  • <C-\> -> remove the selected command (and any copies) from your HISTFILE

Extras

Not required, but if you're using bash, 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"

TODO:

  • Clean up the code. It's kind of a mess right now. Manageable, but a mess.

  • Add support for bash movement hotkeys (like ^W deleting a word)

  • Add regex support (assuming it doesn't slow things down too much)

You can’t perform that action at this time.