atuin/docs/zh-CN/key-binding.md
Koichi Murase 2ef5169357
feat(zsh): update widget names (#1631)
The current widget names for Zsh start with "_", which gives an
impression to users that those widgets are internal API and should not
be bound by the users.  However, we actually instruct users to set up
custom keybindings by specifying them to bindkey.

In other shells, a separate namespace for widgets are not prepared, so
we want to prefix "_" to shell function names to tell the users that
these are not the commands that are supposed to be called from the
command line.  However, the widget names are separated in their own
namespace in Zsh, so we do not have to isolate them by prefixing "_".
In fact, other frameworks such as `fzf` define widgets with names not
starting with "_".

In this patch, we update the widget names to have the form "atuin-*".
The old widget names that existed in the release version <= 17.2.1 are
left for compatibility.
2024-01-29 10:35:34 +00:00

49 lines
969 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 键位绑定
默认情况下, Atuin 将会重新绑定 <kbd>Ctrl-r</kbd>`up` 键。如果你不想使用默认绑定,请在调用 `atuin init` 之前设置 ATUIN_NOBIND
例如:
```
export ATUIN_NOBIND="true"
eval "$(atuin init zsh)"
```
如果需要,你可以在调用 `atuin init` 之后对 Atuin 重新进行键绑定
# zsh
Atuin 定义了 ZLE 部件 "atuin-search"
```
export ATUIN_NOBIND="true"
eval "$(atuin init zsh)"
bindkey '^r' atuin-search
# 取决于终端模式
bindkey '^[[A' atuin-search
bindkey '^[OA' atuin-search
```
# bash
```
export ATUIN_NOBIND="true"
eval "$(atuin init bash)"
# 绑定到 ctrl-r, 也可以在这里添加任何其他你想要的绑定方式
bind -x '"\C-r": __atuin_history'
```
# fish
```
set -gx ATUIN_NOBIND "true"
atuin init fish | source
# 在 normal 和 insert 模式下绑定到 ctrl-r你也可以在此处添加其他键位绑定
bind \cr _atuin_search
bind -M insert \cr _atuin_search
```