hh2hstr fixing documentation and manual page #309

This commit is contained in:
Martin Dvorak 2018-08-25 09:40:01 +02:00
parent 85f79bdfc9
commit 442da6ec86
9 changed files with 215 additions and 220 deletions

View file

@ -2,40 +2,32 @@
Get most of HSTR by configuring it with:
```bash
hh --show-configuration >> ~/.bashrc
hstr --show-configuration >> ~/.bashrc
```
Run `hh --show-configuration` to determine what will be appended to your Bash profile. Don't forget
to source `~/.bashrc` to apply changes.
Run `hstr --show-configuration` to determine what will be appended to your Bash profile. Don't forget to source `~/.bashrc` to apply changes.
---
For more configuration options details please refer to:
* Bind `hh` to a [keyboard shortcut](#binding-hh-to-keyboard-shortcut)
* Bind HSTR to a [keyboard shortcut](#binding-hh-to-keyboard-shortcut)
* [Bash Emacs keymap](#bash-emacs-keymap-default) (default)
* [Bash Vim keymap](#bash-vim-keymap-default)
* [zsh Emacs keymap](#zsh-emacs-keymap-default) (default)
* Create `hh` [alias](Alias) for `hstr`
* Get more [colors](#colors)
* Choose [default history view](#history-view)
* Set [filtering preferences](#filtering)
* Configure commands [blacklist](#blacklist)
* Disable [confirm on delete](#confirm-on-delete)
* Tune [verbosity](#verbosity)
* Bash:
* [Bash Emacs keymap](#bash-emacs-keymap-default) (default)
* [Bash Vim keymap](#bash-vim-keymap-default)
* History settings:
* [Bash history settings](#bash-history-settings)
* zsh:
* [zsh Emacs keymap](#zsh-emacs-keymap-default) (default)
* [zsh history settings](#zsh-history-settings)
Check also configuration [examples](#examples).
## Alias
Make running of `hstr` (e.g. if you don't want to bind it to <kbd>Ctrl+r</kbd>)
even easier by defining alias in your `~/.bashrc`:
```bash
alias hh=hstr
```
## Binding HSTR to Keyboard Shortcut
Bash uses *Emacs* style keyboard shortcuts by default. There is
also *Vi* mode. Find out how to bind HSTR to a keyboard shortcut
@ -57,49 +49,105 @@ bind -S
```
## Colors
Get `hh` in more colors:
### Bash Emacs Keymap (default)
Bind HSTR to a Bash key e.g. to <kbd>Ctrl</kbd><kbd>r</kbd>:
```bash
export HH_CONFIG=hicolor
bind '"\C-r": "\C-ahstr -- \C-j"'
```
or <kbd>Ctrl</kbd><kbd>Alt</kbd><kbd>r</kbd>:
```bash
bind '"\e\C-r":"\C-ahstr -- \C-j"'
```
or <kbd>Ctrl</kbd><kbd>F12</kbd>:
```bash
bind '"\e[24;5~":"\C-ahstr -- \C-j"'
```
Bind HSTR to <kbd>Ctrl</kbd><kbd>r</kbd> only if it is interactive shell:
```bash
if [[ $- =~ .*i.* ]]; then bind '"\C-r": "\C-a hstr -- \C-j"'; fi
```
You can bind also other HSTR commands like `-kill-last-command`:
```bash
if [[ $- =~ .*i.* ]]; then bind '"\C-xk": "\C-a hstr -k \C-j"'; fi
```
### Bash Vim Keymap
Bind HSTR to a Bash key e.g. to <kbd>Ctrl</kbd><kbd>r</kbd>:
```bash
bind '"\C-r": "\e0ihstr -- \C-j"'
```
### Zsh Emacs Keymap
Bind HSTR to a `zsh` key e.g. to <kbd>Ctrl</kbd><kbd>r</kbd>:
```bash
bindkey -s "\C-r" "\eqhstr --\n"
```
## Alias
If you want to make running of `hstr` from command line even easier,
then define alias in your `~/.bashrc`:
```bash
alias hh=hstr
```
Don't forget to source `~/.bashrc` to be able to to use `hh` command.
## Colors
Let HSTR to use colors:
```bash
export HSTR_CONFIG=hicolor
```
or ensure black and white mode:
```bash
export HH_CONFIG=monochromatic
export HSTR_CONFIG=monochromatic
```
## Default History View
Show normal history by default (instead of metrics-based view):
To show normal history by default (instead of metrics-based view, which is default)
use:
```bash
export HH_CONFIG=raw-history-view
export HSTR_CONFIG=raw-history-view
```
Show favorite commands by default (instead of metrics-based view):
To show favorite commands as default view use:
```bash
export HH_CONFIG=favorites-view
export HSTR_CONFIG=favorites-view
```
## Filtering
To use regular expressions based matching:
```bash
export HH_CONFIG=regexp-matching
export HSTR_CONFIG=regexp-matching
```
To use substring based matching:
```bash
export HH_CONFIG=substring-matching
export HSTR_CONFIG=substring-matching
```
To use keywords (substrings whose order doesn't matter) search matching (default):
```bash
export HH_CONFIG=keywords-matching
export HSTR_CONFIG=keywords-matching
```
---
@ -107,13 +155,13 @@ export HH_CONFIG=keywords-matching
Make search case sensitive (insensitive by default):
```bash
export HH_CONFIG=case-sensitive
export HSTR_CONFIG=case-sensitive
```
Keep duplicates in `raw-history-view` (duplicate commands are discarded by default):
```bash
export HH_CONFIG=duplicates
export HSTR_CONFIG=duplicates
```
## Static favorites
@ -122,24 +170,24 @@ by default. If you want to disable this behavior and make favorite
commands list static, then use the following configuration:
```bash
export HH_CONFIG=static-favorites
export HSTR_CONFIG=static-favorites
```
## Skip favorites comments
If you don't want to show lines starting with `#` (comments) among
favorites, then use the following configuration:
```bash
export HH_CONFIG=skip-favorites-comments
export HSTR_CONFIG=skip-favorites-comments
```
## Blacklist
Skip commands when processing history i.e. make sure that these commands
will *not* be shown in any view:
```bash
export HH_CONFIG=blacklist
export HSTR_CONFIG=blacklist
```
Commands to be stored in `~/.hh_blacklist` file with trailing empty line. For instance:
Commands to be stored in `~/.hstr_blacklist` file with trailing empty line. For instance:
```
cd
@ -152,87 +200,48 @@ ll
Do not prompt for confirmation when deleting history items:
```bash
export HH_CONFIG=no-confirm
export HSTR_CONFIG=no-confirm
```
## Verbosity
Show a message when deleting the last command from history:
```bash
export HH_CONFIG=verbose-kill
export HSTR_CONFIG=verbose-kill
```
Show warnings:
```bash
export HH_CONFIG=warning
export HSTR_CONFIG=warning
```
Show debug messages:
```bash
export HH_CONFIG=debug
export HSTR_CONFIG=debug
```
## Bash Emacs Keymap (default)
Bind `hh` to a Bash key e.g. to <kbd>Ctrl</kbd><kbd>r</kbd>:
```bash
bind '"\C-r": "\C-ahh -- \C-j"'
```
or <kbd>Ctrl</kbd><kbd>Alt</kbd><kbd>r</kbd>:
```bash
bind '"\e\C-r":"\C-ahh -- \C-j"'
```
or <kbd>Ctrl</kbd><kbd>F12</kbd>:
```bash
bind '"\e[24;5~":"\C-ahh -- \C-j"'
```
Bind `hh` to <kbd>Ctrl</kbd><kbd>r</kbd> only if it is interactive shell:
```bash
if [[ $- =~ .*i.* ]]; then bind '"\C-r": "\C-a hh -- \C-j"'; fi
```
You can bind also other `hh` commands like `-kill-last-command`:
```bash
if [[ $- =~ .*i.* ]]; then bind '"\C-xk": "\C-a hh -k \C-j"'; fi
```
## Bash Vim Keymap
Bind `hh` to a Bash key e.g. to <kbd>Ctrl</kbd><kbd>r</kbd>:
```bash
bind '"\C-r": "\e0ihh -- \C-j"'
```
## Bash History Settings
Use the following BASH settings to get most out of `hh`.
Use the following Bash settings to get most out of HSTR.
Increase the size of history maintained by BASH - variables defined below increase the
number of history items and history file size (default value is 500):
Increase the size of history maintained by BASH - variables defined below
increase the number of history items and history file size (default value is 500):
```bash
export HISTFILESIZE=10000
export HISTSIZE=${HISTFILESIZE}
```
Ensure syncing (flushing and reloading) of `.bash_history` with in-memory
history:
Ensure syncing (flushing and reloading) of `.bash_history` with
in-memory history:
```bash
export PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}"
```
Force appending of in-memory history to `.bash_history`
(instead of overwriting):
Force appending of in-memory history to `.bash_history` (instead
of overwriting):
```bash
shopt -s histappend
@ -245,15 +254,6 @@ export HISTCONTROL=ignorespace
```
Suitable for a sensitive information like passwords.
## Zsh Emacs Keymap (default)
Bind `hh` to a `zsh` key e.g. to <kbd>Ctrl</kbd><kbd>r</kbd>:
```bash
bindkey -s "\C-r" "\eqhh --\n"
```
## Zsh History Settings
If you use `zsh`, set `HISTFILE` environment variable in `~/.zshrc`:
@ -266,17 +266,17 @@ export HISTFILE=~/.zsh_history
More colors with case sensitive search of history:
```bash
export HH_CONFIG=hicolor,case-sensitive
export HSTR<_CONFIG=hicolor,case-sensitive
```
Favorite commands view in black and white:
Favorite commands view in black and white with prompt at the bottom of the screen:
```bash
export HH_CONFIG=favorites,monochromatic
export HSTR_CONFIG=favorites-view,prompt-bottom
```
Keywords based search in colors with debug mode verbosity:
```bash
export HH_CONFIG=keywords,hicolor,debug
export HSTR_CONFIG=keywords-matching,hicolor,debug
```

View file

@ -1,11 +1,12 @@
2018-08-28 Martin Dvorak <martin.dvorak@mindforger.com>
* Released v2.0.0 - Major release which resolves confusing hstr/hh ambuiguity by choosing
hstr to be the only name used - hh becomes just a shell alias. It also introduces backward
incompatible changes: all HH_ starting environment variables are changed to HSTR_, similarly
configuration files and distributions package names. Also identifiers used in HSTR_CONFIGURATION
were changed (please check man page and update your 1.x.x configuration).
Additional improvements: all memory leaks fixed, Bash autocomplete added.
hstr to be the only name used. hh becomes just a shell alias. Therefore this release
introduces backward incompatible changes: all HH_ starting environment variables are
changed to HSTR_, similarly configuration files and distributions package names. Also
identifiers used in HSTR_CONFIG were changed (please check man page and update
your 1.x.x configuration). Additional improvements: all memory leaks fixed, Bash
autocomplete added.
2018-08-13 Martin Dvorak <martin.dvorak@mindforger.com>

View file

@ -31,10 +31,10 @@ Tarball:
Install HSTR using a package.
## Ubuntu
Install `hh` on Ubuntu using one-liner:
Install HSTR on Ubuntu using one-liner:
```bash
sudo add-apt-repository ppa:ultradvorka/ppa && sudo apt-get update && sudo apt-get install hh && hh --show-configuration >> ~/.bashrc
sudo add-apt-repository ppa:ultradvorka/ppa && sudo apt-get update && sudo apt-get install hstr && hstr --show-configuration >> ~/.bashrc && . ~/.bashrc
```
... or step by step:
@ -42,37 +42,14 @@ sudo add-apt-repository ppa:ultradvorka/ppa && sudo apt-get update && sudo apt-g
```bash
sudo add-apt-repository ppa:ultradvorka/ppa
sudo apt-get update
sudo apt-get install hh
sudo apt-get install hstr
```
[Configure](CONFIGURATION.md) `hh` and check its [man page](README.md#documentation).
## Fedora/RHEL/Centos
Install `hh` on Fedora, RHEL or CentOS:
```bash
sudo dnf install hstr -y
```
... or:
```bash
sudo yum install hstr -y
```
[Configure](CONFIGURATION.md) `hh` and check its [man page](README.md#documentation).
---
If you want to make sure you have the latest version, then download `.rpm` archive from
[GitHub releases](https://github.com/dvorka/hstr/releases) and install it:
```bash
sudo dnf install ./hstr-<major>.<minor>.<revision>-2.x86_64.rpm -y
```
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
## Debian/Mint
Install `hh` from PPA. Add [my PPA](http://www.mindforger.com/debian),
trust [GPG key](http://www.mindforger.com/gpgpubkey.txt) and install `hh`:
Install HSTR from PPA. Add [my PPA](http://www.mindforger.com/debian),
trust [GPG key](http://www.mindforger.com/gpgpubkey.txt) and install HSTR:
```bash
# add PPA to APT sources:
@ -88,7 +65,7 @@ sudo apt update
sudo apt install hstr
```
[Configure](CONFIGURATION.md) `hh` and check its [man page](README.md#documentation).
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
---
@ -100,8 +77,31 @@ dpkg -i hstr_-<major>.<minor>.<revision>_1-amd64.deb
```
## Fedora/RHEL/Centos
Install HSTR on Fedora, RHEL or CentOS:
```bash
sudo dnf install hstr -y
```
... or:
```bash
sudo yum install hstr -y
```
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
---
If you want to make sure you have the latest version, then download `.rpm` archive from
[GitHub releases](https://github.com/dvorka/hstr/releases) and install it:
```bash
sudo dnf install ./hstr-<major>.<minor>.<revision>-2.x86_64.rpm -y
```
## openSUSE
To install `hh` on openSUSE Leap 42.1 run the following commands as root:
To install HSTR on openSUSE Leap 42.1 run the following commands as root:
```bash
zypper addrepo http://download.opensuse.org/repositories/home:tuw-e184/openSUSE_Leap_42.1/home:tuw-e184.repo
@ -109,16 +109,16 @@ zypper refresh
zypper install hstr
```
[Configure](CONFIGURATION.md) `hh` and check its [man page](README.md#documentation).
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
## Gentoo
To install `hh` on Gentoo run (HSTR has been added to [Portage](https://bugs.gentoo.org/show_bug.cgi?id=527122)):
To install HSTR on Gentoo run (HSTR has been added to [Portage](https://bugs.gentoo.org/show_bug.cgi?id=527122)):
```bash
emerge app-shells/hstr
```
[Configure](CONFIGURATION.md) `hh` and check its [man page](README.md#documentation).
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
## Arch Linux
To install HSTR on Arch Linux download latest distribution from [GitHub releases](https://github.com/dvorka/hstr/releases).
@ -127,18 +127,18 @@ Use [PKGBUILD](https://wiki.archlinux.org/index.php/PKGBUILD) in the root of the
https://aur.archlinux.org/packages/hstr-git/
Install `hh`.
Install HSTR.
[Configure](CONFIGURATION.md) `hh` and check its [man page](README.md#documentation).
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
## macOS
Install `hh` on macOS using [Homebrew](http://brew.sh/) ([formula](https://formulae.brew.sh/formula/hh)):
Install HSTR on macOS using [Homebrew](http://brew.sh/) ([formula](https://formulae.brew.sh/formula/hh)):
```bash
brew install hh
```
[Configure](CONFIGURATION.md) `hh` and check its [man page](README.md#documentation).
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
# Build
Build HSTR from source code.
@ -156,22 +156,16 @@ Create build files using:
cd ./build/tarball && ./tarball-automake.sh && cd ../..
```
Build and install `hh` using:
Build and install HSTR using:
```bash
./configure && make && make install
```
Run HSTR:
```bash
hh
```
[Configure](CONFIGURATION.md) `hh` and check its [man page](README.md#documentation).
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
## Build snap
To build [snap](https://snapcraft.io/) for 'hh' first clone Git repository:
To build [snap](https://snapcraft.io/) for HSTR first clone Git repository:
```bash
git clone https://github.com/dvorka/hstr.git
@ -191,10 +185,10 @@ $ snapcraft
...
```
Find `hh_0+git..._amd64.snap` in the current directory.
Find `hstr_0+git..._amd64.snap` in the current directory.
## Build on Ubuntu
To build `hh` on Ubuntu clone Git repository:
To build HSTR on Ubuntu clone Git repository:
```bash
git clone https://github.com/dvorka/hstr.git
@ -212,22 +206,16 @@ Create build files using:
cd ./build/tarball && ./tarball-automake.sh && cd ../..
```
Build and install `hh` using:
Build and install HSTR using:
```bash
./configure && make && make install
```
Run HSTR:
```bash
hh
```
[Configure](CONFIGURATION.md) `hh` and check its [man page](README.md#documentation).
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
## Build on Debian
To build `hh` on Debian clone Git repository:
To build HSTR on Debian clone Git repository:
```bash
git clone https://github.com/dvorka/hstr.git
@ -245,22 +233,16 @@ Create build files using:
cd ./build/tarball && ./tarball-automake.sh && cd ../..
```
Build and install `hh` using:
Build and install HSTR using:
```bash
./configure && make && make install
```
Run HSTR:
```bash
hh
```
[Configure](CONFIGURATION.md) `hh` and check its [man page](README.md#documentation).
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
## Build on Fedora
To build `hh` on Fedora clone Git repository:
To build HSTR on Fedora clone Git repository:
```bash
git clone https://github.com/dvorka/hstr.git
@ -278,22 +260,16 @@ Create build files using:
cd ./build/tarball && ./tarball-automake.sh && cd ../..
```
Build and install `hh` using:
Build and install HSTR using:
```bash
./configure && make && make install
```
Run HSTR:
```bash
hh
```
[Configure](CONFIGURATION.md) `hh` and check its [man page](README.md#documentation).
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
## Build on WSL
To build `hstr` on [Windows Subsystem for Linux (WSL)](https://msdn.microsoft.com/en-us/commandline/wsl/about) clone Git repository:
To build HSTR on [Windows Subsystem for Linux (WSL)](https://msdn.microsoft.com/en-us/commandline/wsl/about) clone Git repository:
```bash
git clone https://github.com/dvorka/hstr.git
@ -317,7 +293,7 @@ Build and install `hstr` using:
./configure && make && make install
```
It's **important** to finish installation by configuration of `hstr` binding
It's **important** to finish installation by configuration of HSTR binding
which ensures propagation of chosen command to the prompt:
```bash
@ -325,13 +301,12 @@ hstr --show-configuration >> ~/.bashrc
. ~/.bashrc
```
Make sure to **run** `hstr` using <kbd>Ctrl</kbd><kbd>r</kbd> - otherwise commands will not appear in prompt.
[Configure](CONFIGURATION.md) `hh` and check its [man page](README.md#documentation).
Make sure to **run** HSTR using <kbd>Ctrl</kbd><kbd>r</kbd> (or `hstrwsl`) - otherwise commands will not appear in prompt.
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
## Build on Cygwin
To build `hh` on [Cygwin](https://www.cygwin.com) clone Git repository:
To build HSTR on [Cygwin](https://www.cygwin.com) clone Git repository:
```bash
git clone https://github.com/dvorka/hstr.git
@ -343,19 +318,29 @@ Create build files using:
cd ./build/tarball && ./tarball-automake.sh && cd ../..
```
Build and install `hh` using:
Build and install HSTR using:
```bash
./configure && make && make install
```
[Configure](CONFIGURATION.md) `hh` and check its [man page](README.md#documentation).
It's **important** to finish installation by configuration of HSTR binding
which ensures propagation of chosen command to the prompt:
```bash
hstr --show-configuration >> ~/.bashrc
. ~/.bashrc
```
Make sure to **run** HSTR using <kbd>Ctrl</kbd><kbd>r</kbd> (or `hstrcygwin`) - otherwise commands will not appear in prompt.
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
## Build on macOS
HSTR can be built on macOS either using [MacPorts](https://www.macports.org/) or [Homebrew](https://brew.sh/).
---
To build `hh` using [MacPorts](https://www.macports.org/) install `readline` and `ncurses`:
To build HSTR using [MacPorts](https://www.macports.org/) install `readline` and `ncurses`:
```bash
port install readline
@ -370,11 +355,11 @@ autoreconf -fvi
make
```
[Configure](CONFIGURATION.md) `hh` and check its [man page](README.md#documentation).
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
---
To build `hh` using [Homebrew](https://brew.sh/):
To build HSTR using [Homebrew](https://brew.sh/):
```bash
autoreconf -fvi
@ -382,17 +367,17 @@ autoreconf -fvi
make
```
[Configure](CONFIGURATION.md) `hh` and check its [man page](README.md#documentation).
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).
# Tarball
Download and install HSTR tarball.
## Build and Install Tarball
Download latest tarball from [GitHub releases](https://github.com/dvorka/hstr/releases) section.
Expand the archive and install `hh` using:
Expand the archive and install HSTR using:
```bash
./configure && make && make install
```
[Configure](CONFIGURATION.md) `hh` and check its [man page](README.md#documentation).
[Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation).

View file

@ -23,8 +23,8 @@ from the history. It aims to make completion **easier** and more **efficient**
than <kbd>Ctrl</kbd><kbd>r</kbd>.
HSTR can also **manage** your command history (for instance you can remove
commands that are obsolete or contain a sensitive information) or **bookmark**
your favorite commands.
commands that are obsolete or contain a piece of sensitive information)
or **bookmark** your favorite commands.
Check [video](http://www.youtube.com/watch?v=sPF29NyXe2U) tutorial.
@ -53,6 +53,7 @@ Build:
* [build on Fedora](INSTALLATION.md#build-on-fedora)
* [build on Windows Subsystem for Linux (WSL)](INSTALLATION.md#build-on-wsl)
* [build on Cygwin](INSTALLATION.md#build-on-cygwin)
* [build on macOS](INSTALLATION.md#build-on-macos)
Tarball:
@ -60,21 +61,22 @@ Tarball:
## Configuration
Configure HSTR just by running:
```bash
hh --show-configuration >> ~/.bashrc
hstr --show-configuration >> ~/.bashrc
```
For detailed `hh` configuration documentation please refer to [Configuration](CONFIGURATION.md).
For detailed HSTR configuration documentation please refer to [Configuration](CONFIGURATION.md).
## Documentation
Check `hh` man page:
Check man page:
```bash
man hh
man hstr
```
## In the News
Read about `hh` in [LinuxMagazine](http://www.linux-magazine.com/Issues/2014/164/Bash-History-on-Steroids), [UbuntuGeek](http://www.ubuntugeek.com/tag/hstr-bash-history), [DebianAdmin](http://www.debianadmin.com/hstr-easily-view-navigate-search-and-use-your-command-history-with-shell-history.html), [Tuxdiary](https://tuxdiary.com/2015/02/17/hstr/), [Softpedia](http://linux.softpedia.com/get/Terminals/BASH-Command-History-Completion-103155.shtml) or [OSTechNix](https://www.ostechnix.com/hstr-easily-view-navigate-search-manage-commandline-history/).
Read about HSTR in [LinuxMagazine](http://www.linux-magazine.com/Issues/2014/164/Bash-History-on-Steroids), [UbuntuGeek](http://www.ubuntugeek.com/tag/hstr-bash-history), [DebianAdmin](http://www.debianadmin.com/hstr-easily-view-navigate-search-and-use-your-command-history-with-shell-history.html), [Tuxdiary](https://tuxdiary.com/2015/02/17/hstr/), [Softpedia](http://linux.softpedia.com/get/Terminals/BASH-Command-History-Completion-103155.shtml) and [OSTechNix](https://www.ostechnix.com/hstr-easily-view-navigate-search-manage-commandline-history/).
## Bugs

View file

@ -7,7 +7,7 @@ Developer Documentation
# Debugging
Remote debug - gdb server (program is running) + Eclipse debug (debugger w/ code)
1. `cd ~/p/hstr/github/hstr/Debug && gdbserver :9999 ./hh`
1. `cd ~/p/hstr/github/hstr/Debug && gdbserver :9999 ./hstr`
1. Eclipse/Debug Configuration/Using GDB Manual Remote Debugger launching|Debugger tab/Connection port: 9999
# Unit tests

View file

@ -19,15 +19,21 @@ Table of contents:
# Features
HSTR is typically started by pressing <kbd>Ctrl</kbd><kbd>r</kbd> after
you configure it for this shorcut for your shell. However,
you configure it for this shorcut in your shell. However,
you can run it as a normal program just by typing:
```bash
hstr
```
... or use simpler command configured using [alias](../CONFIGURATION.md#alias):
```bash
hh
```
It opens a page with a history view (ranking view is default).
Alternatively you can run `hh` in non-interactive mode -
Alternatively you can run HSTR in non-interactive mode -
commands are just listed on standard output based on history
view:
@ -56,7 +62,7 @@ move around it with `UP` and `DOWN` arrow keys. Selected history
items is highlighted. Once you are done with your choice:
* press `ENTER` to choose the command and execute it
* or press `TAB` or `RIGHT` arrow key to choose the command and edit it on command line after exiting `hh`
* or press `TAB` or `RIGHT` arrow key to choose the command and edit it on command line after exiting HSTR
* or press `LEFT` arrow key to choose the command and open it in editor (Bash `fc` i.e. fix command)
@ -69,7 +75,7 @@ ranking or raw history view by pressing <kbd>Ctrl</kbd><kbd>f</kbd>.
You can check your favorite commands by choosing
favorite view - rotate views using <kbd>Ctrl</kbd><kbd>/</kbd> or start
`hh` by adding `favorites` to `HH_CONFIG` environment
HSTR by adding `favorites-view` to `HSTR_CONFIG` environment
property. A favorite command can be choosen just
by pressing `ENTER` when on command in favorite view.
Last chosen favorite commands appears as the first
@ -78,7 +84,7 @@ You can delete a favorite command with `DEL` key.
Tips:
* Favorite commands are stored in `~/.hh_favorites`
* Favorite commands are stored in `~/.hstr_favorites`
* Suffix your favorite commands with comments
describing their purpose. For example:
@ -107,13 +113,13 @@ pwd
cd
cd ..
ls
hh
hstr
mc
```
Tips:
* Blacklist of commands is stored in `~/.hh_blacklist`
* Blacklist of commands is stored in `~/.hstr_blacklist`
If the file doesn't exist, you may create it and complete
it with your own blacklist.
* You can skip any command from history just by
@ -124,11 +130,11 @@ Tips:
## Kill the Last Command
Using `hh` you can easily delete the last command from history
Using HSTR you can easily delete the last command from history
e.g. when you make a typo or write something sensitive:
```
hh --kill-last-command
hstr --kill-last-command
```
See configuration section for how to bind this functionality to
@ -136,14 +142,15 @@ a key - bound to <kbd>Ctrl</kbd><kbd>x</kbd> <kbd>k</kbd> by default.
# Examples
Get more colors when running `hh`:
Get more colors when running HSTR:
```bash
export HH_CONFIG=hicolor
export HSTR_CONFIG=hicolor
```
Start `hh` in configured view and filter out history items
containing 'git':
Start HSTR in configured view and filter out history items
containing 'git' (make sure `hh` is defined using
[alias](../CONFIGURATION.md#alias)):
```bash
hh git
@ -161,8 +168,8 @@ Append default `hh` configuration to your Bash profile:
hh --show-configuration >> ~/.bashrc
```
Check `hh` man page:
Check HSTR man page:
```bash
man hh
man hstr
```

View file

@ -151,7 +151,7 @@ Configuration options:
Show debug information.
Example:
\fBexport HSTR_CONFIG=hicolor,regexp,rawhistory\fR
\fBexport HSTR_CONFIG=hicolor,regexp-matching,raw-history-view\fR
.TP
\fBHSTR_PROMPT\fR

View file

@ -34,7 +34,7 @@ hstr_SOURCES = \
main.c
# create hstr > hh hard link on installation
#install-exec-hook:
# ln $(DESTDIR)$(bindir)/hstr$(EXEEXT) $(DESTDIR)$(bindir)/hh$(EXEEXT)
install-exec-hook:
ln $(DESTDIR)$(bindir)/hstr$(EXEEXT) $(DESTDIR)$(bindir)/hh$(EXEEXT)
hstr_LDADD = $(NCURSES_LIBS)

View file

@ -179,21 +179,21 @@ static const char* INSTALL_BASH_STRING=
// Script hints:
// {...} is inline group ~ lambda function whose vars are visible to the other commands
// V=$(c) executes commands and stores it to var V
"\nfunction hstr_winwsl {"
"\nfunction hstrwsl {"
"\n offset=${READLINE_POINT}"
"\n READLINE_POINT=0"
"\n { READLINE_LINE=$(</dev/tty hstr ${READLINE_LINE:0:offset} 2>&1 1>&$hstrout); } {hstrout}>&1"
"\n READLINE_POINT=${#READLINE_LINE}"
"\n}"
"\nif [[ $- =~ .*i.* ]]; then bind -x '\"\\C-r\": \"hstr_winwsl\"'; fi"
"\nif [[ $- =~ .*i.* ]]; then bind -x '\"\\C-r\": \"hstrwsl\"'; fi"
#elif defined(__CYGWIN__)
"\nfunction hstr_cygwin {"
"\nfunction hstrcygwin {"
"\n offset=${READLINE_POINT}"
"\n READLINE_POINT=0"
"\n { READLINE_LINE=$(</dev/tty hstr ${READLINE_LINE:0:offset} 2>&1 1>&$hstrout); } {hstrout}>&1"
"\n READLINE_POINT=${#READLINE_LINE}"
"\n}"
"\nif [[ $- =~ .*i.* ]]; then bind -x '\"\\C-r\": \"hstr_cygwin\"'; fi"
"\nif [[ $- =~ .*i.* ]]; then bind -x '\"\\C-r\": \"hstrcygwin\"'; fi"
#else
"\nif [[ $- =~ .*i.* ]]; then bind '\"\\C-r\": \"\\C-a hstr -- \\C-j\"'; fi"
"\n# if this is interactive shell, then bind 'kill last command' to Ctrl-x k"