xaizek / hstr (License: Apachev2) (since 2018-12-07)
Bash and Zsh shell history suggest box - easily view, navigate, search and manage your command history.
<root> / man / hh.1 (9a5bd9e4f1bb3ed269b325e3800fd5fe90990b27) (6,329B) (mode 100644) [raw]
.TH HH 1
\fBhh\fR \-  easily view, navigate, sort and use your command history with shell history suggest box. 
.B hh [option] [arg1] [arg2]... 
.RS 0
.B hstr [option] [arg1] [arg2]...
.B 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
\fBhh\fR allows removal of commands from history - for instance with a typo 
or with a sensitive content.
\fB-h --help\fR
Show help
\fB-n --non-interactive\fR
Print filtered history on standard output and exit
\fB-k --kill-last-command\fR
Delete the last command from history and exit
\fB-f --favorites\fR
Show favorites view immediately
\fB-s --show-configuration\fR
Show configuration that can be added to ~/.bashrc
\fB-b --show-blacklist\fR
Show blacklist of commands to be filtered out before history processing
\fB-V --version\fR
Show version information
Type to filter shell history.
Toggle regular expression and substring search.
Toggle case sensitive search.
\fBCtrl\-/\fR, \fBCtrl\-7\fR
Rotate view of history as provided by Bash, ranked history ordered by the number of occurences/length/timestamp and favorites.
Add currently selected command to favorites.
Make search pattern lowercase or uppercase.
\fBCtrl\-r\fR, \fBUP\fR arrow, \fBDOWN\fR arrow, \fBCtrl\-n\fR, \fBCtrl\-p\fR, \fBCtrl\-j\fR, \fBCtrl\-k\fR
Navigate in the history list. 
\fBTAB\fR, \fBRIGHT\fR arrow
Choose currently selected item for completion and let user to edit it on the command prompt.
\fBLEFT\fR arrow
Choose currently selected item for completion and let user to edit it in editor (fix command).
Choose currently selected item for completion and execute it.
Remove currently selected item from the shell history.
\fBBACKSPACE\fR, \fBCtrl\-h\fR
Delete last pattern character.
\fBCtrl\-u\fR, \fBCtrl\-w\fR
Delete pattern and search again.
Write changes to shell history and exit.
Exit with empty prompt.
\fBhh\fR defines the following environment variables:
Configuration options:

        Get more colors with this option (default is monochromatic).

        Ensure black and white view.

        Show prompt at the bottom of the screen (default is prompt at the top).

        Do not ask for confirmation on a history entry delete (default is with confirmation).

        Filter command history using regular expressions (substring match is default) 

        Filter command history using substring.

        Filter command history using keywords - item matches if contains all keywords in pattern in any order.

        Make history filtering case sensitive (it's case insensitive by default). 

        Show normal history as a default view (metric-based view is shown otherwise). 

        Show favorites as a default view (metric-based view is shown otherwise).

        Show duplicates in rawhistory (duplicates are discarded by default). 

        Print the last command command deleted from history (nothing is printed by default).

        Load list of commands to skip when processing history from ~/.hh_blacklist (built-in blacklist used otherwise).

        Don't clear page with command selection on exit (page is cleared by default).

        Skip big history entries i.e. very long lines (default).

        Use different sorting slot for big keys when building metrics-based view (big keys are skipped by default).

        Exit (fail) on presence of a big key in history (big keys are skipped by default).

        Show warning.

        Show debug information.

        \fBexport HH_CONFIG=hicolor,regexp,rawhistory\fR

Change prompt string which is \fBuser@host$\fR by default.

        \fBexport HH_PROMPT="$ "\fR

 Bookmarked favorite commands.
 Command blacklist.

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 (for Vi mode check doc)
if [[ $\- =~ .*i.* ]]; then bind '"\eC\-r": "\eC\-a hh -- \eC-j"'; fi
The prompt command ensures synchronization of the history between BASH memory 
and history file.
Optionally add the following lines to ~/.zshrc:
export HISTFILE=~/.zsh_history   # ensure history file visibility
export HH_CONFIG=hicolor         # get more colors
bindkey -s "\eC\-r" "\eeqhh\en"  # bind hh to Ctrl-r (for Vi mode check doc, experiment with --)
\fBhh git\fR
 Start `hh` and show only history items containing 'git'.
\fBhh --non-interactive git\fR
 Print history items containing 'git' to standard output and exit.
\fBhh --show-configuration >> ~/.bashrc\fR
 Append default \fBhh\fR configuration to your Bash profile.
\fBhh --show-blacklist\fR
 Show blacklist configured for history processing.
Written by Martin Dvorak <martin.dvorak@mindforger.com>
Report bugs to https://github.com/dvorka/hstr/issues
.BR history (1),
.BR bash (1),
.BR zsh (1)

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/hstr

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/hstr

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master