HH(1)

NAME
hh - shell history suggest box

SYNOPSIS
hh [option] [arg1] [arg2]...

DESCRIPTION
hh uses shell history to provide suggest box like functionality for commands used in the past. By default it parses .bash-history file that is filtered as you type a command substring. Commands are not just filtered, but also ordered by a ranking algorithm that considers number of occurences, length and timestamp. Favorite and frequently used commands can be bookmarked. In addition hh allows removal of commands from history - for instance with a typo or with a sensitive content.

OPTIONS

-h --help
    Show help

-n --non-interactive
    Print filtered history on standard output and exit

-f --favorites
    Show favorites view immediately

-s --show-configuration
    Show configuration that can be added to ~/.bashrc

-V --version
    Show version information

KEYS

pattern
    Type to filter shell history.

Ctrl-e
    Toggle regular expression and substring search.

Ctrl-t
    Toggle case sensitive search.

Ctrl-/
    Rotate view of history as provided by BASH, ranked history ordered by the number of occurences/length/timestamp and favorites.

Ctrl-f
    Add currently selected command to favorites.

Ctrl-l
    Make search pattern lowercase or uppercase.

Ctrl-r, UP arrow, DOWN arrow, Ctrl-n, Ctrl-p
    Navigate in the history list.

TAB, LEFT arrow, RIGHT arrow,
    Choose currently selected item for completion and let user to edit it on the command prompt.

ENTER
    Choose currently selected item for completion and execute it.

DEL Remove currently selected item from the shell history.

BACSKSPACE, Ctrl-h
    Delete last pattern character.

Ctrl-u, Ctrl-w
    Delete pattern and search again.

Ctrl-x
    Write changes to shell history and exit.

Ctrl-g
    Exit with empty prompt.

ENVIRONMENT VARIABLES
hh defines the following environment variables:

HH_CONFIG
    Configuration options: hicolor
            Get more colors with this option (default is monochromatic). monochromatic
            Ensure black and white view with this option. regexp
            Filter command history using regular expressions (substring match is default) substring
            Filter command history using substring. keywords
            Filter command history using keywords - item matches if contains all keywords in pattern in any order. casesensitive
            Make history filtering case sensitive (it's case insensitive by default). rawhistory
            Show normal history as a default view (metric-based view is shown otherwise). favorites
            Show favorites as a default view (metric-based view is shown otherwise). warning
            Show warning. debug
            Show debug information. Example:
            export HH_CONFIG=hicolor,regexp,rawhistory

HH_PROMPT
    Change prompt string which is "user@host$ " by default. Example:
            export HH_PROMPT="$ "

FILES
~/.hh_favorites bookmarked favorite commands

CONFIGURATION
Optionally add the following lines to ~/.bashrc:

export HH_CONFIG=hicolor         # get more colors
shopt -s histappend              # append new history items to .bash_history
export HISTCONTROL=ignorespace   # leading space hides commands from history
export HISTFILESIZE=10000        # increase history file size (default is 500)
export HISTSIZE=${HISTFILESIZE}  # increase history size (default is 500)
export PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}"
# if this is interactive shell, then bind hh to Ctrl-r
if [[ $- =~ .*i.* ]]; then bind '"\C-r": "\C-a hh \C-j"'; fi

The prompt command ensures synchronization of the history between BASH memory and history file.

AUTHOR
Written by Martin Dvorak <martin.dvorak@mindforger.com>

BUGS
Report bugs to https://github.com/dvorka/hstr/issues

SEE ALSO
history(1), bash(1)