Create and view custom hotkey cheatsheets in the terminal
Create and view your own custom hotkey cheatsheet in the terminal
keyb does not support:
I had trouble remembering the various hotkeys that I sometimes use. It got annoying to look them up so I resorted to writing them down on a paper cheatsheet. Then, I thought: maybe there's a tool that does this better. I didn't find one I liked so I built keyb.
With keyb, I can list:
It is best used as a popup cheatsheet.
keyb supports Linux, MacOS and Windows.
Download a compiled binary from the releases page.
$ go install github.com/kencx/keyb@latest
$ git clone https://github.com/kencx/keyb
$ cd keyb
$ make build
usage: keyb [options] <command>
Options:
-p, --print Print to stdout
-e, --export Export to file
-k, --key Key bindings at custom path
-c, --config Config file at custom path
-v, --version Version info
-h, --help help for keyb
Commands:
a, add Add keybind to keyb file
/
to perform fuzzy filtering on all rowsEsc
Alt + d
clears the current filterTo perform filtering on section headings only, prefix the
search with h:
. This will return all matching section headings with their
respective rows.
keyb supports printing to stdout for use with other tools:
$ keyb -p | fzf
$ keyb -p | rofi -dmenu
keyb requires a yaml
file with a list of hotkeys to work. A default file is
generated in your system's config directory if no other file is specified.
Hotkeys are classified into sections with a name and (optional) prefix field. When displayed, sections are sorted by alphabetical order while the keys themselves are arranged in their defined order.
- name: bspwm
keybinds:
- name: terminal
key: Super + Return
The prefix is a key combination that will be prepended to every hotkey in the
section. A key can choose to opt out by including a ignore_prefix: true
field.
Prefixes are useful for applications with a common leading hotkey like tmux.
- name: tmux
prefix: ctrl + b
keybinds:
- name: Create new window
key: c
- name: Prev, next window
key: Shift + {←, →}
ignore_prefix: true
Refer to the examples
for more examples.
Multiline fields are not supported!
usage: keyb [-k file] add [app; name; key]
Options:
-b, --binding Key binding
-p, --prefix Ignore prefix
You can quick add bindings from the command line to a specified file. If -k file
is given and exists, the new keybind will be appended to the file.
Otherwise, keyb_path
defined in config.yml
will be used.
$ keyb add -b "kitty; open terminal; super + enter"
When adding a new keybind, the app name, keybind name and keybind must be
specified. It is separated by ;
and wrapped in quotes (to prevent parsing errors).
keyb can be customized with a config file at the default OS config
directory (i.e. $XDG_CONFIG_HOME/keyb/config.yml
). If no such file exists, the
default configuration will be used.
See config for all configuration options.
a, add
subcommand to quickly add a single hotkey entry from the CLIjson, toml, conf/ini
etc.)keyb requires Go 1.21. Bug reports, feature requests and PRs are very welcome.