@@ -90,28 +90,55 @@ used in combination with the config
9090
9191## bash
9292
93- Atuin provides a bindable shell function "` __atuin_history ` " for keybindings in
94- Bash. The flag ` --shell-up-key-binding ` can be optionally specified to the
95- first argument for keybindings to the <kbd >up</kbd > key or similar keys.
93+ Atuin (` >= 18.10.0 ` ) provides a shell function ` atuin-bind ` to set up
94+ keybindings easily:
95+
96+ ```
97+ atuin-bind [-m KEYMAP] KEYSEQ COMMAND
98+ ```
99+
100+ ` KEYMAP ` is one of ` emacs ` , ` vi-insert ` , and ` vi-command ` and specifies the
101+ target keymap where the keybinding is defined. ` KEYSEQ ` specifies a key
102+ sequence in the format used in ` bind '"KEYSEQ": ...' ` . ` COMMAND ` specifies a
103+ shell command to run with the keybindings. The following special commands can
104+ be used as well as an arbitrary shell command:
105+
106+ | Command | Description |
107+ | ----------------------- | ----------------------------------------------------------------------------------- |
108+ | ` atuin-search ` | Standard search |
109+ | ` atuin-search-emacs ` | Standard search with the ` emacs ` keymap mode |
110+ | ` atuin-search-viins ` | Standard search with the ` vim-insert ` keymap mode |
111+ | ` atuin-search-vicmd ` | Standard search with the ` vim-insert ` keymap mode |
112+ | ` atuin-up-search ` | Search command for <kbd >up</kbd > or similar keys |
113+ | ` atuin-up-search-emacs ` | Search command for <kbd >up</kbd > or similar keys, with the ` emacs ` keymap mode |
114+ | ` atuin-up-search-viins ` | Search command for <kbd >up</kbd > or similar keys, with the ` vim-insert ` keymap mode |
115+ | ` atuin-up-search-vicmd ` | Search command for <kbd >up</kbd > or similar keys, with the ` vim-insert ` keymap mode |
116+
117+ The keymap mode controls the initial keymap in the Atuin search and is
118+ determined in combination with the config
119+ [ "keymap\_ mode"] ( https://docs.atuin.sh/configuration/config/#keymap_mode )
120+ (` atuin >= 18.0 ` ).
121+
96122
97123```
98124export ATUIN_NOBIND="true"
99125eval "$(atuin init bash)"
100126
101127# bind to ctrl-r, add any other bindings you want here too
102- bind -x '" \C-r": __atuin_history'
128+ atuin- bind ' \C-r' atuin-search
103129
104130# bind to the up key, which depends on terminal mode
105- bind -x '" \e[A": __atuin_history --shell- up-key-binding'
106- bind -x '" \eOA": __atuin_history --shell- up-key-binding'
131+ atuin- bind ' \e[A' atuin- up-search
132+ atuin- bind ' \eOA' atuin- up-search
107133```
108134
109- For the keybindings in the ` vi ` editing mode, the options
110- ` --keymap-mode=vim-insert ` and ` --keymap-mode=vim-normal ` (` atuin >= 18.0 ` ) can
111- be additionally specified to the shell function ` __atuin_history ` in
112- combination with the config
113- [ "keymap\_ mode"] ( https://docs.atuin.sh/configuration/config/#keymap_mode )
114- (` atuin >= 18.0 ` ) to start the Atuin search in respective keymap modes.
135+ With older versions of Atuin, the user needs to bind a bindable shell function
136+ "` __atuin_history ` " directly using Bash's ` bind ` . The flag
137+ ` --shell-up-key-binding ` can be optionally specified to the first argument for
138+ keybindings to the <kbd >up</kbd > key or similar keys. For the keybindings in
139+ the ` vi ` editing mode, the options ` --keymap-mode=vim-insert ` and the keymap
140+ mode ` --keymap-mode=vim-normal ` (` atuin >= 18.0 ` ) can be additionally specified
141+ to the shell function ` __atuin_history ` .
115142
116143## fish
117144Edit key bindings in FISH shell by adding the following to ~ /.config/fish/config.fish
0 commit comments