mirror of
https://github.com/dvorka/hstr.git
synced 2024-11-10 17:18:35 +08:00
Polishing CONFIGURATION.md and fixing vi mode binding which resolves #125
This commit is contained in:
parent
9427678182
commit
3f39bf26e3
1 changed files with 17 additions and 15 deletions
|
@ -19,8 +19,8 @@ For more configuration options details please refer to:
|
||||||
|
|
||||||
* bind HSTR to a [keyboard shortcut](#binding-hstr-to-keyboard-shortcut)
|
* bind HSTR to a [keyboard shortcut](#binding-hstr-to-keyboard-shortcut)
|
||||||
* [Bash Emacs keymap](#bash-emacs-keymap-default) (default)
|
* [Bash Emacs keymap](#bash-emacs-keymap-default) (default)
|
||||||
* [Bash Vim keymap](#bash-vim-keymap-default)
|
* [Bash Vim keymap](#bash-vim-keymap)
|
||||||
* [zsh Emacs keymap](#zsh-emacs-keymap-default) (default)
|
* [zsh Emacs keymap](#zsh-emacs-keymap) (default)
|
||||||
* create `hh` [alias](Alias) for `hstr`
|
* create `hh` [alias](Alias) for `hstr`
|
||||||
* use [HSTR config options](#hstr-config-options)
|
* use [HSTR config options](#hstr-config-options)
|
||||||
* get more [colors](#colors)
|
* get more [colors](#colors)
|
||||||
|
@ -38,11 +38,11 @@ For more configuration options details please refer to:
|
||||||
Don't miss the HSTR config [examples](#examples).
|
Don't miss the HSTR config [examples](#examples).
|
||||||
|
|
||||||
## Bash Binding HSTR to Keyboard Shortcut
|
## Bash Binding HSTR to Keyboard Shortcut
|
||||||
Bash uses *Emacs* style keyboard shortcuts by default. There is
|
`Bash` uses *Emacs* style keyboard shortcuts by default. There is
|
||||||
also *Vi* mode. Find out how to bind HSTR to a keyboard shortcut
|
also *Vi* mode. Find out how to bind HSTR to a keyboard shortcut
|
||||||
based on the style you prefer below.
|
based on the style you prefer below.
|
||||||
|
|
||||||
Check your active Bash keymap with:
|
Check your active bash keymap with:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bind -v | grep editing-mode
|
bind -v | grep editing-mode
|
||||||
|
@ -50,7 +50,7 @@ bind -v | grep keymap
|
||||||
```
|
```
|
||||||
|
|
||||||
To determine character sequence emitted by a pressed key in
|
To determine character sequence emitted by a pressed key in
|
||||||
terminal, type <kbd>Ctrl</kbd><kbd>v</kbd> and then press the key. Check your
|
terminal, type <kbd>Ctrl-v</kbd> and then press the key. Check your
|
||||||
current bindings using:
|
current bindings using:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -59,25 +59,25 @@ bind -S
|
||||||
|
|
||||||
|
|
||||||
### Bash Emacs Keymap (default)
|
### Bash Emacs Keymap (default)
|
||||||
Bind HSTR to a Bash key e.g. to <kbd>Ctrl</kbd><kbd>r</kbd>:
|
Bind HSTR to a `bash` key e.g. to <kbd>Ctrl-r</kbd>:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bind '"\C-r": "\C-a hstr -- \C-j"'
|
bind '"\C-r": "\C-a hstr -- \C-j"'
|
||||||
```
|
```
|
||||||
|
|
||||||
or <kbd>Ctrl</kbd><kbd>Alt</kbd><kbd>r</kbd>:
|
or <kbd>Ctrl-Alt-r</kbd>:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bind '"\e\C-r":"\C-a hstr -- \C-j"'
|
bind '"\e\C-r":"\C-a hstr -- \C-j"'
|
||||||
```
|
```
|
||||||
|
|
||||||
or <kbd>Ctrl</kbd><kbd>F12</kbd>:
|
or <kbd>Ctrl-F12</kbd>:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bind '"\e[24;5~":"\C-a hstr -- \C-j"'
|
bind '"\e[24;5~":"\C-a hstr -- \C-j"'
|
||||||
```
|
```
|
||||||
|
|
||||||
Bind HSTR to <kbd>Ctrl</kbd><kbd>r</kbd> only if it is interactive shell:
|
Bind HSTR to <kbd>Ctrl-r</kbd> only if it is interactive shell:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
if [[ $- =~ .*i.* ]]; then bind '"\C-r": "\C-a hstr -- \C-j"'; fi
|
if [[ $- =~ .*i.* ]]; then bind '"\C-r": "\C-a hstr -- \C-j"'; fi
|
||||||
|
@ -90,14 +90,14 @@ if [[ $- =~ .*i.* ]]; then bind '"\C-xk": "\C-a hstr -k \C-j"'; fi
|
||||||
```
|
```
|
||||||
|
|
||||||
### Bash Vim Keymap
|
### Bash Vim Keymap
|
||||||
Bind HSTR to a Bash key e.g. to <kbd>Ctrl</kbd><kbd>r</kbd>:
|
Bind HSTR to a `bash` key e.g. to <kbd>Ctrl-r</kbd>:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bind '"\C-r": "\e0ihstr -- \C-j"'
|
bind '"\C-r": "\e^ihstr -- \n"'
|
||||||
```
|
```
|
||||||
|
|
||||||
### Zsh Emacs Keymap
|
### Zsh Emacs Keymap
|
||||||
Bind HSTR to a `zsh` key e.g. to <kbd>Ctrl</kbd><kbd>r</kbd>:
|
Bind HSTR to a `zsh` key e.g. to <kbd>Ctrl-r</kbd>:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bindkey -s "\C-r" "\C-a hstr -- \C-j"
|
bindkey -s "\C-r" "\C-a hstr -- \C-j"
|
||||||
|
@ -292,9 +292,9 @@ export HSTR_CONFIG=keywords-matching,hicolor,debug
|
||||||
```
|
```
|
||||||
|
|
||||||
## Bash History Settings
|
## Bash History Settings
|
||||||
Use the following Bash settings to get most out of HSTR.
|
Use the following `bash` settings to get most out of HSTR.
|
||||||
|
|
||||||
Increase the size of history maintained by BASH - variables defined below
|
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 number of history items and history file size (default value is 500):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -323,9 +323,11 @@ export HISTCONTROL=ignorespace
|
||||||
```
|
```
|
||||||
|
|
||||||
Suitable for a sensitive information like passwords.
|
Suitable for a sensitive information like passwords.
|
||||||
## zsh History Settings
|
## Zsh History Settings
|
||||||
If you use `zsh`, set `HISTFILE` environment variable in `~/.zshrc`:
|
If you use `zsh`, set `HISTFILE` environment variable in `~/.zshrc`:
|
||||||
|
|
||||||
```
|
```
|
||||||
export HISTFILE=~/.zsh_history
|
export HISTFILE=~/.zsh_history
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Please check your system configuration - history might be store in `~/.zsh_history`, `~/.zhistory` or other file.
|
||||||
|
|
Loading…
Reference in a new issue