Improving zsh related documentation + fixing zsh bindkey as suggested by @hoto in #248

This commit is contained in:
Martin Dvorak 2019-12-07 22:44:28 +01:00
parent 49c4723bed
commit ba8efffd07
4 changed files with 20 additions and 10 deletions

View file

@ -2,10 +2,16 @@
Get most of HSTR by configuring it with:
```bash
# bash
hstr --show-configuration >> ~/.bashrc
# zsh
hstr --show-configuration >> ~/.zshrc
```
Run `hstr --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 / zsh profile. Don't forget to `source ~/.bashrc` / `source ~/.zshrc`
to apply changes.
---
@ -28,7 +34,7 @@ For more configuration options details please refer to:
Check also configuration [examples](#examples).
## Binding HSTR to Keyboard Shortcut
## Bash 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
based on the style you prefer below.
@ -91,7 +97,7 @@ bind '"\C-r": "\e0ihstr -- \C-j"'
Bind HSTR to a `zsh` key e.g. to <kbd>Ctrl</kbd><kbd>r</kbd>:
```bash
bindkey -s "\C-r" "\eqhstr --\n"
bindkey -s "\C-r" "\C-ahstr -- \C-j"
```

View file

@ -3,7 +3,7 @@
[![Current release](https://img.shields.io/github/release/dvorka/hstr.svg)](https://github.com/dvorka/hstr/releases)
[![GitHub issues](https://img.shields.io/github/issues/dvorka/hstr.svg?maxAge=360)](https://github.com/dvorka/hstr/issues)
[![All releases downloads](https://img.shields.io/github/downloads/dvorka/hstr/total.svg)](https://github.com/dvorka/hstr/releases)
[![AUR](https://img.shields.io/aur/license/yaourt.svg)](https://github.com/dvorka/hstr/blob/master/LICENSE)
[![License](https://img.shields.io/github/license/dvorka/hstr?color=%23fe0000)](https://github.com/dvorka/hstr/blob/master/LICENSE)
Easily view, navigate and search your **command history** with shell history suggest box for Bash and
[zsh](CONFIGURATION.md#zsh-history-settings).
@ -66,7 +66,11 @@ Tarball:
Configure HSTR just by running:
```bash
# bash
hstr --show-configuration >> ~/.bashrc
# zsh
hstr --show-configuration >> ~/.zshrc
```
For detailed HSTR configuration documentation please refer to [Configuration](CONFIGURATION.md).

View file

@ -188,9 +188,9 @@ if [[ $\- =~ .*i.* ]]; then bind '"\eC\-r": "\eC\-a hstr -- \eC-j"'; fi
Optionally add the following lines to ~/.zshrc:
.nf
.sp
export HISTFILE=~/.zsh_history # ensure history file visibility
export HSTR_CONFIG=hicolor # get more colors
bindkey -s "\eC\-r" "\eeqhstr\en" # bind hstr to Ctrl-r (for Vi mode check doc, experiment with --)
export HISTFILE=~/.zsh_history # ensure history file visibility
export HSTR_CONFIG=hicolor # get more colors
bindkey -s "\eC\-r" "\eC\-ahstr \-\- \eC\-j" # bind hstr to Ctrl-r (for Vi mode check doc)
.sp
.fi
.SH EXAMPLES

View file

@ -205,7 +205,7 @@ static const char* INSTALL_BASH_STRING=
static const char* INSTALL_ZSH_STRING=
"\n# HSTR configuration - add this to ~/.bashrc"
"\nalias hh=hstr # hh to be alias for hstr"
"\nexport HISTFILE=~/.zsh_history # ensure history file visibility"
"\nexport HISTFILE=~/.zsh_history # ensure history file visibility"
"\nexport HSTR_CONFIG=hicolor # get more colors"
#if defined(__MS_WSL__)
// TODO binding to be rewritten for zsh@WSL as it's done for Bash - hstr_winwsl() like function to be implemented to make it work on WSL
@ -238,13 +238,13 @@ static const char* INSTALL_ZSH_STRING=
"\n"
"\nbindkey -s \"\\C-r\" \"\\eqhstr\\n\" # bind hstr to Ctrl-r (for Vi mode check doc)"
#else
"\nbindkey -s \"\\C-r\" \"\\eqhstr\\n\" # bind hstr to Ctrl-r (for Vi mode check doc)"
"\nbindkey -s \"\\C-r\" \"\\C-ahstr -- \\C-j\" # bind hstr to Ctrl-r (for Vi mode check doc)"
#endif
// TODO try variant with args/pars separation
//"\nbindkey -s \"\\C-r\" \"\\eqhstr --\\n\" # bind hstr to Ctrl-r (for Vi mode check doc)"
// alternate binding options in zsh:
// bindkey -s '^R' '^Ahstr ^M'
// bindkey -s "\C-r" "\C-ahstr \C-j"
// bindkey -s "\C-r" "\C-ahstr -- \C-j"
"\n\n";
static const char* HELP_STRING=