đź—’ Carte de Bindkeys
Bindkey​
Les mappages de clés bindkey peuvent être très confus à déchiffrer. Il peut utiliser plusieurs notations différentes, mais il est judicieux d'utiliser la même notation de clé dans toute votre configuration. You can print all of your current key bindings in the current keymap with bindkey. To print the full bindkey command to add to your .zshrc file use bindkey -L.
In general, you'll bind a widget so a key sequence or a key with a modifier. This can be declared in caret notation using ^, using escape sequences using \, in octal (\NNN), hex (\xNN), or Unicode (\uNNNN). None of these are particularly great for people to read. This is also tricky because it depends on your keyboard, operating system, and shell.
Here are some basics:
\e,\E, = Échap^[= touche Alt (sur certains claviers, c'est la même chose que Echap)^ ?= Supprimer^X,^= Contrôle
The keys that come after the modifier can add more confusion.
Supprimer la liaison​
To delete a key binding you can use bindkey -d $KEYS. Make sure you don't delete the characters you need for typing.
Les raccourcis clavier bindmap'…'​
Sometimes plugins call bindkey to assign keyboard shortcuts. This can cause problems because multiple plugins can bind the same keys.
Also, the user might want a different binding(s), which will require complicated, additional bindkey commands in .zshrc.
Zi provides a solution to this problem – the ability to remap the bindkeys with a short ice-modifier specification with the bindmap'…' ice.
Exemples pour bindmap'…'​
Map Ctrl-G instead of Ctrl-R for the history searcher.
zi bindmap'^R -> ^G' for z-shell/history-search-multi-word
Map Ctrl-Shift-Left and Ctrl-Shift-Right used by URxvt instead of the Xterms' ones. Load with the bindkey-tracking ↔ with light-loading for anything else.
Could also separate the bindmaps with a semicolon, i.e.:
bindmap'"\\e[1\;6D" -> \\e[1\;5D ; "\\e[1\;6C" -> ^[[1\;5C' \
zi wait light-mode trackbinds bindmap'"\\e[1\;6D" -> \\e[1\;5D"' \ bindmap'"\\e[1\;6C" -> ^[[1\;5C' pick'dircycle.zsh' for \ michaelxmcbride/zsh-dircycleMap space to regular space and Ctrl-Space to the globalias widget, which expands the alias entered on the left, provided by OMZ globalias plugin.
zi bindmap='!" " -> magic-space; !"^ " -> globalias' nocompletions \ depth=1 pick=plugins/globalias/globalias.plugin.zsh for \ ohmyzsh/ohmyzshExplications​
The bindmap'…' ice has two modes of operation: normal and exclamation-mark (bindmap'!…'). In the first mode, the remapping is being done from-key to-key, i.e.: bindmap'fromkey -> to-key'.
The given key is changed to the second given key in the bindkey command while loading the plugin. In the second mode, the remapping is being done from-key to-widget, e.g: bindmap'!from-key -> to-widget'.
In this mode, the given key is being mapped to the given widget instead of the widget specified in the bindkey command e.g.:
Au lieu de:
bindkey "^ " magic-spacebindkey " " globaliasThe actual call that'll be done will be:
bindkey "^ " globaliasbindkey " " magic-spaceFor the bindmap='!" " -> magic-space; !"^ " -> globalias' ice.
Utilisation de la bindmap '…' en mode léger​
When the investigation mode is on i.e.:
- lorsque le mode de chargement complet est utilisé, par défaut dans la syntaxe
for, et lorsquezi load …est utilisé, alors la glacebindmap'…'fonctionne normalement.
In the non-investigation:
- le light mode - activé lorsque
zi light …ou lelight-modeest utilisé-lebindmap'…'n'est pas disponible, sauf si la la glacetrackbindsest spécifié:
With the use of the light-mode ice and the for-syntax:
zi light-mode for trackbinds bindmap'^R -> ^G' \ z-shell/history-search-multi-wordWith the use of the traditional syntax:
zi ice trackbinds bindmap'^R -> ^G'zi light z-shell/history-search-multi-wordUtilisation des raccourcis de UPAR​
There are four special values that can be used on the left side of the bind-map: UPAR, DOWNAR, LEFTAR, RIGHTAR. They'll match up arrow, down arrow, etc. So that it's possible to do:
zi bindmap='LEFTAR -> ^F; RIGHTAR -> ^G' …
The benefit of using the UPAR, … shorthands is that they cover multiple possible cursor-key codes for each of the cursor keys so that they'll work regardless of the terminal is used.