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       -f --favorites
32              Show favorites view immediately
33
34       -s --show-configuration
35              Show configuration that can be added to ~/.bashrc
36
37       -b --show-blacklist
38              Show blacklist of commands to be  filtered  out  before  history
39              processing
40
41       -V --version
42              Show version information
43

KEYS

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

ENVIRONMENT VARIABLES

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

FILES

195       ~/.hstr_favorites
196               Bookmarked favorite commands.
197
198       ~/.hstr_blacklist
199               Commands to be hidden.
200
201

BASH CONFIGURATION

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

ZSH CONFIGURATION

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

EXAMPLES

226       hstr git
227               Start hstr and show only history items containing 'git'.
228
229       hstr cpp add git
230               Start hstr and show only history items containing 'cpp',  'add'
231              and 'git'.
232
233       hstr --non-interactive git
234               Print  history  items  containing  'git' to standard output and
235              exit.
236
237       hstr --show-configuration >> ~/.bashrc
238               Append default hstr configuration to your bash profile.
239
240       hstr --show-configuration >> ~/.zhrc
241               Append default hstr configuration to your zsh profile.
242
243       hstr --show-blacklist
244               Show blacklist configured for history processing.
245

AUTHOR

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

BUGS

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

SEE ALSO

253       history(1), bash(1), zsh(1)
254
255
256
257                                                                       HSTR(1)
Impressum