2013-12-25 22:25:36 +08:00
|
|
|
.TH HH 1
|
|
|
|
.SH NAME
|
2014-01-17 11:46:12 +08:00
|
|
|
\fBhh\fR \- shell history suggest box
|
2013-12-25 22:25:36 +08:00
|
|
|
.SH SYNOPSIS
|
2014-01-17 11:54:54 +08:00
|
|
|
.B hh [option] [arg1] [arg2]...
|
2013-12-25 22:25:36 +08:00
|
|
|
.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
|
|
|
|
that considers number of occurences, length and timestamp. In addition
|
|
|
|
hh allows removal of commands from history - for instance with a typo or with a sensitive content.
|
2014-01-25 21:36:01 +08:00
|
|
|
.SH OPTIONS
|
2014-01-17 11:46:12 +08:00
|
|
|
.TP
|
|
|
|
\fB--show-configuration\fR
|
2014-02-01 02:46:18 +08:00
|
|
|
Show configuration that can be added to .bashrc
|
2014-01-28 04:12:17 +08:00
|
|
|
.TP
|
|
|
|
\fB--help\fR
|
|
|
|
Show help
|
2013-12-25 22:25:36 +08:00
|
|
|
.SH COMMANDS
|
|
|
|
.TP
|
2014-01-19 04:45:37 +08:00
|
|
|
\fBpattern\fR
|
2013-12-25 22:25:36 +08:00
|
|
|
Type to filter shell history.
|
2014-01-04 15:39:03 +08:00
|
|
|
.TP
|
2014-01-19 05:08:46 +08:00
|
|
|
\fBCtrl\-t\fR
|
2014-01-04 15:39:03 +08:00
|
|
|
Toggle case sensitive search.
|
2014-01-05 23:49:08 +08:00
|
|
|
.TP
|
2014-01-25 15:52:49 +08:00
|
|
|
\fBCtrl\-/\fR
|
2014-01-07 14:17:28 +08:00
|
|
|
Toggle history as provided by shell vs. ranked history ordered by the number of occurences, length and timestamp.
|
2014-01-25 15:52:49 +08:00
|
|
|
.TP
|
|
|
|
\fBCtrl\-l\fR
|
|
|
|
Make search pattern lowercase or uppercase.
|
2013-12-25 22:25:36 +08:00
|
|
|
.TP
|
2014-01-20 15:04:28 +08:00
|
|
|
\fBCtrl\-r\fR, \fBUP\fR arrow, \fBDOWN\fR arrow
|
2014-01-07 14:19:10 +08:00
|
|
|
Navigate in the history list.
|
2013-12-25 22:25:36 +08:00
|
|
|
.TP
|
2014-01-20 15:04:28 +08:00
|
|
|
\fBTAB\fR, \fBLEFT\fR arrow, \fBRIGHT\fR arrow,
|
2014-01-19 04:45:37 +08:00
|
|
|
Choose currently selected item for completion and let user to edit it on the command prompt.
|
|
|
|
.TP
|
2013-12-25 22:25:36 +08:00
|
|
|
\fBENTER\fR
|
2014-01-19 04:45:37 +08:00
|
|
|
Choose currently selected item for completion and execute it.
|
2013-12-25 22:25:36 +08:00
|
|
|
.TP
|
2014-01-19 15:57:45 +08:00
|
|
|
\fBDEL\fR
|
2013-12-25 22:25:36 +08:00
|
|
|
Remove currently selected item from the shell history.
|
|
|
|
.TP
|
2014-01-25 21:36:01 +08:00
|
|
|
\fBBACSKSPACE\fR, \fBCtrl\-h\fR
|
|
|
|
Delete last pattern character.
|
|
|
|
.TP
|
|
|
|
\fBCtrl\-u\fR, \fBCtrl\-w\fR
|
|
|
|
Delete pattern and search again.
|
|
|
|
.TP
|
2013-12-25 22:25:36 +08:00
|
|
|
\fBCtrl\-x\fR
|
|
|
|
Write changes to shell history and exit.
|
2014-01-19 04:45:37 +08:00
|
|
|
.TP
|
|
|
|
\fBCtrl\-g\fR
|
|
|
|
Exit with empty prompt.
|
2014-01-28 04:12:17 +08:00
|
|
|
.SH ENVIRONMENT VARIABLES
|
2014-02-01 02:46:18 +08:00
|
|
|
\fBhh\fR defines the following environment variable:
|
2014-01-28 04:12:17 +08:00
|
|
|
.TP
|
|
|
|
\fBHH_CONFIG\fR
|
2014-02-01 02:46:18 +08:00
|
|
|
Configuration options:
|
|
|
|
|
|
|
|
\fIhicolor\fR
|
|
|
|
Get more colors with this option (default is monochromatic).
|
|
|
|
|
|
|
|
\fIcasesensitive\fR
|
|
|
|
Make the pattern-based filtering case sensitive by default.
|
|
|
|
|
|
|
|
\fIrawhistory\fR
|
|
|
|
Show normal history by default (default is metric-based).
|
|
|
|
|
|
|
|
Example:
|
|
|
|
\fBexport HH_CONFIG=casesensitive,hicolor\fR
|
|
|
|
|
2014-01-28 04:12:17 +08:00
|
|
|
.SH CONFIGURATION
|
|
|
|
Optionally add the following lines to ~/.bashrc:
|
2013-12-25 22:25:36 +08:00
|
|
|
.nf
|
|
|
|
.sp
|
2014-01-28 04:12:17 +08:00
|
|
|
export HH_CONFIG=hicolor # get more colors
|
2014-01-25 21:36:01 +08:00
|
|
|
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)
|
2013-12-25 22:25:36 +08:00
|
|
|
export PROMPT_COMMAND="history \-a; history \-n; ${PROMPT_COMMAND}"
|
2014-01-25 21:36:01 +08:00
|
|
|
bind '"\eC\-r": "\eC\-a hh \eC-j"' # bind hh to Ctrl-r
|
2013-12-25 22:25:36 +08:00
|
|
|
.sp
|
|
|
|
.fi
|
2014-01-25 21:36:01 +08:00
|
|
|
The prompt command ensures synchronization of the history between BASH memory
|
|
|
|
and history file.
|
2013-12-25 22:25:36 +08:00
|
|
|
.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),
|
|
|
|
.BR bash (1)
|