hstr/man/hh.1

192 lines
5.5 KiB
Groff
Raw Normal View History

.TH HH 1
.SH NAME
\fBhh\fR \- easily view, navigate, sort and use your command history with shell history suggest box.
.SH SYNOPSIS
2014-01-17 11:54:54 +08:00
.B hh [option] [arg1] [arg2]...
.SH DESCRIPTION
.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
2014-04-13 15:37:40 +08:00
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
2014-04-13 15:37:40 +08:00
or with a sensitive content.
.SH OPTIONS
2014-01-17 11:46:12 +08:00
.TP
\fB-h --help\fR
Show help
.TP
\fB-n --non-interactive\fR
2014-05-21 12:14:09 +08:00
Print filtered history on standard output and exit
.TP
\fB-f --favorites\fR
2014-04-13 15:37:40 +08:00
Show favorites view immediately
.TP
\fB-s --show-configuration\fR
2014-04-13 15:37:40 +08:00
Show configuration that can be added to ~/.bashrc
.TP
\fB-b --show-blacklist\fR
Show blacklist of commands to be filtered out before history processing
.TP
\fB-V --version\fR
Show version information
2014-04-13 15:37:40 +08:00
.SH KEYS
.TP
\fBpattern\fR
Type to filter shell history.
.TP
\fBCtrl\-e\fR
2014-04-27 20:53:54 +08:00
Toggle regular expression and substring search.
.TP
\fBCtrl\-t\fR
Toggle case sensitive search.
.TP
\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.
.TP
\fBCtrl\-f\fR
Add currently selected command to favorites.
.TP
\fBCtrl\-l\fR
Make search pattern lowercase or uppercase.
.TP
2015-01-05 04:54:59 +08:00
\fBCtrl\-r\fR, \fBUP\fR arrow, \fBDOWN\fR arrow, \fBCtrl\-n\fR, \fBCtrl\-p\fR
2014-01-07 14:19:10 +08:00
Navigate in the history list.
.TP
\fBTAB\fR, \fBRIGHT\fR arrow
Choose currently selected item for completion and let user to edit it on the command prompt.
.TP
\fBLEFT\fR arrow
Choose currently selected item for completion and let user to edit it in editor (fix command).
.TP
\fBENTER\fR
Choose currently selected item for completion and execute it.
.TP
\fBDEL\fR
Remove currently selected item from the shell history.
.TP
\fBBACSKSPACE\fR, \fBCtrl\-h\fR
Delete last pattern character.
.TP
\fBCtrl\-u\fR, \fBCtrl\-w\fR
Delete pattern and search again.
.TP
\fBCtrl\-x\fR
Write changes to shell history and exit.
.TP
\fBCtrl\-g\fR
Exit with empty prompt.
.SH ENVIRONMENT VARIABLES
\fBhh\fR defines the following environment variables:
.TP
\fBHH_CONFIG\fR
Configuration options:
\fIhicolor\fR
Get more colors with this option (default is monochromatic).
\fImonochromatic\fR
Ensure black and white view.
2014-04-27 13:42:17 +08:00
\fIregexp\fR
2014-04-27 20:53:54 +08:00
Filter command history using regular expressions (substring match is default)
\fIsubstring\fR
Filter command history using substring.
2014-04-27 13:42:17 +08:00
\fIkeywords\fR
Filter command history using keywords - item matches if contains all keywords in pattern in any order.
\fIcasesensitive\fR
2014-04-27 20:53:54 +08:00
Make history filtering case sensitive (it's case insensitive by default).
\fIrawhistory\fR
2014-04-13 15:37:40 +08:00
Show normal history as a default view (metric-based view is shown otherwise).
\fIfavorites\fR
2014-04-13 15:37:40 +08:00
Show favorites as a default view (metric-based view is shown otherwise).
\fIblacklist\fR
Load list of commands to skip when processing history from ~/.hh_blacklist (built-in blacklist used otherwise).
\fIbigkeysskip\fR
Skip big history entries i.e. very long lines (default).
\fIbigkeysfloor\fR
Use different sorting slot for big keys when building metrics-based view (big keys are skipped by default).
\fIbigkeysexit\fR
Exit (fail) on presence of a big key in history (big keys are skipped by default).
\fIwarning\fR
Show warning.
\fIdebug\fR
Show debug information.
Example:
\fBexport HH_CONFIG=hicolor,regexp,rawhistory\fR
.TP
\fBHH_PROMPT\fR
Change prompt string which is \fBuser@host$\fR by default.
Example:
\fBexport HH_PROMPT="$ "\fR
2014-04-13 15:37:40 +08:00
.SH FILES
.TP
\fB~/.hh_favorites\fR
Bookmarked favorite commands.
.TP
\fB~/.hh_blacklist\fR
Command blacklist.
2014-04-13 15:37:40 +08:00
.SH BASH CONFIGURATION
Optionally add the following lines to ~/.bashrc:
.nf
.sp
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
.sp
.fi
The prompt command ensures synchronization of the history between BASH memory
and history file.
.SH ZSH CONFIGURATION
Optionally add the following lines to ~/.zshrc:
.nf
.sp
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)
.sp
.fi
.SH EXAMPLES
.TP
\fBhh git\fR
Start `hh` and show only history items containing 'git'.
.TP
\fBhh --non-interactive git\fR
Print history items containing 'git' to standard output and exit.
.TP
\fBhh --show-configuration >> ~/.bashrc\fR
Append default \fBhh\fR configuration to your Bash profile.
.TP
\fBhh --show-blacklist\fR
Show blacklist configured for history processing.
.SH AUTHOR
Written by Martin Dvorak <martin.dvorak@mindforger.com>
.SH BUGS
Report bugs to https://github.com/dvorka/hstr/issues
.SH "SEE ALSO"
.BR history (1),
2015-01-14 05:59:12 +08:00
.BR bash (1),
.BR zsh (1)