File man/hh.1 changed (mode: 100644) (index c1ce877..f95010f) |
... |
... |
file that is filtered as you type a command substring. Commands |
11 |
11 |
are not just filtered, but also ordered by a ranking algorithm |
are not just filtered, but also ordered by a ranking algorithm |
12 |
12 |
that considers number of occurences, length and timestamp. In addition |
that considers number of occurences, length and timestamp. In addition |
13 |
13 |
hh allows removal of commands from history - for instance with a typo or with a sensitive content. |
hh allows removal of commands from history - for instance with a typo or with a sensitive content. |
14 |
|
.SH OPTIONNS |
|
|
14 |
|
.SH OPTIONS |
15 |
15 |
.TP |
.TP |
16 |
16 |
\fB--show-configuration\fR |
\fB--show-configuration\fR |
17 |
17 |
Show configuration to be added to .bashrc |
Show configuration to be added to .bashrc |
|
... |
... |
Choose currently selected item for completion and execute it. |
41 |
41 |
\fBDEL\fR |
\fBDEL\fR |
42 |
42 |
Remove currently selected item from the shell history. |
Remove currently selected item from the shell history. |
43 |
43 |
.TP |
.TP |
|
44 |
|
\fBBACSKSPACE\fR, \fBCtrl\-h\fR |
|
45 |
|
Delete last pattern character. |
|
46 |
|
.TP |
|
47 |
|
\fBCtrl\-u\fR, \fBCtrl\-w\fR |
|
48 |
|
Delete pattern and search again. |
|
49 |
|
.TP |
44 |
50 |
\fBCtrl\-x\fR |
\fBCtrl\-x\fR |
45 |
51 |
Write changes to shell history and exit. |
Write changes to shell history and exit. |
46 |
52 |
.TP |
.TP |
|
... |
... |
Exit with empty prompt. |
50 |
56 |
Add the following lines to ~/.bashrc: |
Add the following lines to ~/.bashrc: |
51 |
57 |
.nf |
.nf |
52 |
58 |
.sp |
.sp |
53 |
|
shopt -s histappend |
|
|
59 |
|
shopt -s histappend # append new history items to .bash_history |
|
60 |
|
export HISTCONTROL=ignorespace # leading space hides commands from history |
|
61 |
|
export HISTFILESIZE=10000 # increase history file size (default is 500) |
|
62 |
|
export HISTSIZE=${HISTFILESIZE} # increase history size (default is 500) |
54 |
63 |
export PROMPT_COMMAND="history \-a; history \-n; ${PROMPT_COMMAND}" |
export PROMPT_COMMAND="history \-a; history \-n; ${PROMPT_COMMAND}" |
55 |
|
bind '"\eC\-r": "\eC\-a hh \eC-j"' |
|
|
64 |
|
bind '"\eC\-r": "\eC\-a hh \eC-j"' # bind hh to Ctrl-r |
56 |
65 |
.sp |
.sp |
57 |
66 |
.fi |
.fi |
58 |
|
The first command ensures that new history items are appended to .bash_history |
|
59 |
|
(instead of overwriting). The second command ensures synchronization of the |
|
60 |
|
history between memory and file system. The third command binds hh to |
|
61 |
|
Ctrl-r shortcut. |
|
|
67 |
|
The prompt command ensures synchronization of the history between BASH memory |
|
68 |
|
and history file. |
62 |
69 |
.SH AUTHOR |
.SH AUTHOR |
63 |
70 |
Written by Martin Dvorak <martin.dvorak@mindforger.com> |
Written by Martin Dvorak <martin.dvorak@mindforger.com> |
64 |
71 |
.SH BUGS |
.SH BUGS |
File src/hstr.c changed (mode: 100644) (index f1766aa..a1434ca) |
66 |
66 |
#endif |
#endif |
67 |
67 |
|
|
68 |
68 |
static const char *INSTALL_STRING= |
static const char *INSTALL_STRING= |
69 |
|
"\n# Add this configuration to ~/.bashrc to let HH load and flush up to date history" |
|
70 |
|
"\nshopt -s histappend" |
|
71 |
|
"\nexport PROMPT_COMMAND=\"history -a; history -n; ${PROMPT_COMMAND}\"" |
|
72 |
|
"\nbind '\"\\C-r\": \"\\C-a hh \\C-j\"'" |
|
|
69 |
|
"\n# add this configuration to ~/.bashrc" |
|
70 |
|
"\nshopt -s histappend # append new history items to .bash_history" |
|
71 |
|
"\nexport HISTCONTROL=ignorespace # leading space hides commands from history" |
|
72 |
|
"\nexport HISTFILESIZE=10000 # increase history file size (default is 500)" |
|
73 |
|
"\nexport HISTSIZE=${HISTFILESIZE} # increase history size (default is 500)" |
|
74 |
|
"\nexport PROMPT_COMMAND=\"history -a; history -n; ${PROMPT_COMMAND}\" # mem/file sync" |
|
75 |
|
"\nbind '\"\\C-r\": \"\\C-a hh \\C-j\"' # bind hh to Ctrl-r" |
73 |
76 |
"\n\n"; |
"\n\n"; |
74 |
77 |
|
|
75 |
78 |
static const char *BUILD_STRING= |
static const char *BUILD_STRING= |
|
... |
... |
void loop_to_select(HistoryItems *history) |
383 |
386 |
print_history_label(history); |
print_history_label(history); |
384 |
387 |
selectionCursorPosition=0; |
selectionCursorPosition=0; |
385 |
388 |
break; |
break; |
386 |
|
case K_CTRL_X: |
|
387 |
|
result=NULL; |
|
388 |
|
done=TRUE; |
|
389 |
|
break; |
|
390 |
389 |
case KEY_RESIZE: |
case KEY_RESIZE: |
391 |
390 |
print_history_label(history); |
print_history_label(history); |
392 |
391 |
move(y, basex+strlen(pattern)); |
move(y, basex+strlen(pattern)); |
|
... |
... |
void loop_to_select(HistoryItems *history) |
462 |
461 |
history_clear_dirty(); |
history_clear_dirty(); |
463 |
462 |
done=TRUE; |
done=TRUE; |
464 |
463 |
break; |
break; |
|
464 |
|
case K_CTRL_X: |
|
465 |
|
result=NULL; |
|
466 |
|
done=TRUE; |
|
467 |
|
break; |
465 |
468 |
default: |
default: |
466 |
469 |
LOGKEYS(Y_OFFSET_HELP, c); |
LOGKEYS(Y_OFFSET_HELP, c); |
467 |
470 |
LOGCURSOR(Y_OFFSET_HELP); |
LOGCURSOR(Y_OFFSET_HELP); |
|
... |
... |
void loop_to_select(HistoryItems *history) |
495 |
498 |
|
|
496 |
499 |
void install_show() |
void install_show() |
497 |
500 |
{ |
{ |
498 |
|
printf("# %s\n%s", BUILD_STRING, INSTALL_STRING); |
|
|
501 |
|
printf("%s", INSTALL_STRING); |
499 |
502 |
} |
} |
500 |
503 |
|
|
501 |
504 |
void assemble_cmdline(int argc, char *argv[]) { |
void assemble_cmdline(int argc, char *argv[]) { |
|
... |
... |
int main(int argc, char *argv[]) |
535 |
538 |
if(argc==2 && strstr(argv[1], "--show-configuration")) { |
if(argc==2 && strstr(argv[1], "--show-configuration")) { |
536 |
539 |
install_show(); |
install_show(); |
537 |
540 |
// TODO --help (tr --help) |
// TODO --help (tr --help) |
|
541 |
|
//printf("# %s\n%s", BUILD_STRING, INSTALL_STRING); |
538 |
542 |
} else { |
} else { |
539 |
543 |
assemble_cmdline(argc, argv); |
assemble_cmdline(argc, argv); |
540 |
544 |
hstr(); |
hstr(); |