2025-03-14 21:59:59 -06:00
|
|
|
# bindkey
|
|
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
> Add hotkeys to Z shell.
|
2025-03-14 21:59:59 -06:00
|
|
|
> More information: <https://zsh.sourceforge.io/Guide/zshguide04.html>.
|
|
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
- List all existing hotkeys:
|
|
|
|
|
|
|
|
|
|
`bindkey`
|
|
|
|
|
|
2025-03-14 21:59:59 -06:00
|
|
|
- Bind a hotkey to a specific command:
|
|
|
|
|
|
|
|
|
|
`bindkey "{{^k}}" {{kill-line}}`
|
|
|
|
|
|
|
|
|
|
- Bind a hotkey to a specific key [s]equence:
|
|
|
|
|
|
|
|
|
|
`bindkey -s '^o' 'cd ..\n'`
|
|
|
|
|
|
|
|
|
|
- [l]ist keymaps:
|
|
|
|
|
|
|
|
|
|
`bindkey -l`
|
|
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
- List all hotkeys in a key[M]ap:
|
|
|
|
|
|
|
|
|
|
`bindkey -M {{main}}`
|
|
|
|
|
|
|
|
|
|
- Enable [v]i mode:
|
|
|
|
|
|
|
|
|
|
`bindkey -v`
|
|
|
|
|
|
|
|
|
|
- Enable [e]macs mode (default mode):
|
|
|
|
|
|
|
|
|
|
`bindkey -e`
|
|
|
|
|
|
|
|
|
|
- Check which mode is active (vi or emacs):
|
2025-03-14 21:59:59 -06:00
|
|
|
|
2026-02-18 06:55:01 -07:00
|
|
|
`bindkey -lL main | grep -Eo 'viins|emacs'`
|