Rework atuin init (#652)

* Rework `atuin init`

This allows users to disable the CTRL-R and Up Arrow bindings,
independently from one another

* Document --disable-{ctrl-r,up-arrow}

* Apply suggestions from code review

Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com>

Co-authored-by: Ellie Huxtable <ellie@elliehuxtable.com>
This commit is contained in:
Jamie Quigley
2022-12-24 17:18:44 +00:00
committed by GitHub
parent ed394afa82
commit a5616aea8f
7 changed files with 135 additions and 84 deletions

View File

@ -1,11 +1,27 @@
# Key binding
By default, Atuin will rebind both <kbd>Ctrl-r</kbd> and the up arrow. If you do not want
this to happen, set ATUIN_NOBIND before the call to `atuin init`
By default, Atuin will rebind both <kbd>Ctrl-r</kbd> and the up arrow.
For example
You can also disable either the up-arrow or <kbd>Ctrl-r</kbd> bindings individually, by passing
`--disable-up-arrow` or `-disable-ctrl-r` to the call to `atuin init`:
```
# Bind ctrl-r but not up arrow
eval "$(atuin init zsh --disable-up-arrow)"
# Bind up-arrow but not ctrl-r
eval "$(atuin init zsh --disable-ctrl-r)"
```
If you do not want either key to be bound, either pass both `--disable` arguments, or set the
environment varuable `ATUIN_NOBIND` to any value before the call to `atuin init`:
```
## Do not bind any keys
# Either:
eval "$(atuin init zsh --disable-up-arrow --disable-ctrl-r)"
# Or:
export ATUIN_NOBIND="true"
eval "$(atuin init zsh)"
```
@ -36,6 +52,7 @@ eval "$(atuin init bash)"
# bind to ctrl-r, add any other bindings you want here too
bind -x '"\C-r": __atuin_history'
```
# fish
```