1HSTR(1)                     General Commands Manual                    HSTR(1)
2
3
4

NAME

6       hstr  -   easily view, navigate, sort and use your command history with
7       shell history suggest box.
8

SYNOPSIS

10       hstr [option] [arg1] [arg2]...
11

DESCRIPTION

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

OPTIONS

22       -h --help
23              Show help
24
25       -n --non-interactive
26              Print filtered history on standard output and exit
27
28       -k --kill-last-command
29              Delete the last command from history and exit
30
31       -i --insert-in-terminal=[command]
32              Insert custom command to terminal prompt and exit
33
34       -f --favorites
35              Show favorites view immediately
36
37       -s --show-configuration
38              Show configuration that can be added to ~/.bashrc
39
40       -b --show-blacklist
41              Show blacklist of commands to be  filtered  out  before  history
42              processing
43
44       -V --version
45              Show version information
46

KEYS

48       pattern
49              Type to filter shell history.
50
51       Ctrl-e Toggle regular expression and substring search.
52
53       Ctrl-t Toggle case sensitive search.
54
55       Ctrl-/, Ctrl-7
56              Rotate  view  of history as provided by bash, ranked history or‐
57              dered by  the  number  of  occurences/length/timestamp  and  fa‐
58              vorites.
59
60       Ctrl-f Add currently selected command to favorites.
61
62       Ctrl-l Toggle search pattern case.
63
64       Ctrl-r, UP arrow, DOWN arrow, Ctrl-n, Ctrl-p, Ctrl-j, Ctrl-k
65              Navigate in the history list.
66
67       TAB, RIGHT arrow
68              Choose  currently  selected  item for completion and let user to
69              edit it on the command prompt.
70
71       LEFT arrow
72              Choose currently selected item for completion and  let  user  to
73              edit it in editor (fix command).
74
75       ENTER  Choose currently selected item for completion and execute it.
76
77       DEL    Remove currently selected item from the shell history.
78
79       BACKSPACE, Ctrl-h
80              Delete last pattern character.
81
82       Ctrl-u, Ctrl-w
83              Delete pattern and search again.
84
85       Ctrl-x Write changes to shell history and exit.
86
87       Ctrl-g Exit with empty prompt.
88

ENVIRONMENT VARIABLES

90       hstr defines the following environment variables:
91
92       HSTR_CONFIG
93              Configuration options:
94
95              hicolor
96                      Get  more  colors with this option (default is monochro‐
97              matic).
98
99              monochromatic
100                      Ensure black and white view.
101
102              prompt-bottom
103                      Show prompt at the bottom  of  the  screen  (default  is
104              prompt at the top).
105
106              help-on-opposite-side
107                      Show help label on the opposite site (default is next to
108              the prompt).
109
110              hide-basic-help
111                      Hide the basic help label.
112
113              hide-help
114                      Hide basic and  history  help  labels.  Implicitly  sets
115              hide-basic-help.
116
117              no-confirm
118                      Do  not  ask  for confirmation on a history entry delete
119              (default is with confirmation).
120
121              regexp-matching
122                      Filter command history using regular expressions.
123
124              substring-matching
125                      Filter command history using substring.
126
127              keywords-matching
128                      Filter command history using keywords - item matches  if
129              contains all keywords in pattern in any order (keywords match is
130              default).
131
132              case-sensitive
133                      Make history filtering case sensitive (it's case  insen‐
134              sitive by default).
135
136              raw-history-view
137                      Show normal history as a default view (metric-based view
138              is shown otherwise).
139
140              favorites-view
141                      Show favorites as a default view (metric-based  view  is
142              shown otherwise).
143
144              static-favorites
145                      Do  not  put  recently  used favorite to the head of fa‐
146              vorites (favorites are reordered by default).
147
148              skip-favorites-comments
149                      Skip comments (lines  beginning  with  #)  when  loading
150              ~/.hstr_favorites (all lines are loaded by default).
151
152              duplicates
153                      Show  duplicates in rawhistory (duplicates are discarded
154              by default).
155
156              verbose-kill
157                      Print the last  command  command  deleted  from  history
158              (nothing is printed by default).
159
160              blacklist
161                      Load  list  of  commands to skip when processing history
162              from ~/.hstr_blacklist (built-in blacklist used otherwise).
163
164              keep-page
165                      Don't clear page with command selection on exit (page is
166              cleared by default).
167
168              big-keys-skip
169                      Skip big history entries i.e. very long lines (default).
170
171              big-keys-floor
172                      Use  different  sorting  slot for big keys when building
173              metrics-based view (big keys are skipped by default).
174
175              big-keys-exit
176                      Exit (fail) on presence of a big  key  in  history  (big
177              keys are skipped by default).
178
179              warning
180                      Show warning.
181
182              debug
183                      Show debug information.
184
185              Example:
186                      export  HSTR_CONFIG=hicolor,regexp-matching,raw-history-
187              view
188
189
190       HSTR_PROMPT
191              Change prompt string which is user@host$ by default.
192
193              Example:
194                      export HSTR_PROMPT="$ "
195
196

FILES

198       ~/.hstr_favorites
199               Bookmarked favorite commands.
200
201       ~/.hstr_blacklist
202               Commands to be hidden.
203
204

BASH CONFIGURATION

206       Optionally add the following lines to ~/.bashrc:
207
208       alias hh=hstr                    # make hh alias of hstr
209       export HSTR_CONFIG=hicolor       # get more colors
210       shopt -s histappend              # append new history items to .bash_history
211       export HISTCONTROL=ignorespace   # leading space hides commands from history
212       export HISTFILESIZE=10000        # increase history file size (default is 500)
213       export HISTSIZE=${HISTFILESIZE}  # increase history size (default is 500)
214       # ensure synchronization between bash memory and history file
215       export PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}"
216       # if this is interactive shell, then bind hstr to Ctrl-r (for Vi mode check doc)
217       if [[ $- =~ .*i.* ]]; then bind '"\C-r": "\C-a hstr -- \C-j"'; fi
218
219

ZSH CONFIGURATION

221       Optionally add the following lines to ~/.zshrc:
222
223       export HSTR_CONFIG=hicolor            # get more colors
224       setopt histignorespace                # skip cmds w/ leading space from history
225       bindkey -s "\C-r" "\C-a hstr -- \C-j" # bind hstr to Ctrl-r (for Vi mode check doc)
226
227

EXAMPLES

229       hstr git
230               Start hstr and show only history items containing 'git'.
231
232       hstr cpp add git
233               Start hstr and show only history items containing 'cpp',  'add'
234              and 'git'.
235
236       hstr --non-interactive git
237               Print  history  items  containing  'git' to standard output and
238              exit.
239
240       hstr --show-configuration >> ~/.bashrc
241               Append default hstr configuration to your bash profile.
242
243       hstr --show-configuration >> ~/.zhrc
244               Append default hstr configuration to your zsh profile.
245
246       hstr --show-blacklist
247               Show blacklist configured for history processing.
248
249       hstr --insert-in-terminal="git add . && git diff --cached"
250               Insert command in terminal prompt and exit.
251

AUTHOR

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

BUGS

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

SEE ALSO

259       history(1), bash(1), zsh(1)
260
261
262
263                                                                       HSTR(1)
Impressum