An open API service indexing awesome lists of open source software.

https://github.com/844196/wk

⌨️ which-key like menu for shell
https://github.com/844196/wk

which-key zsh

Last synced: 7 months ago
JSON representation

⌨️ which-key like menu for shell

Awesome Lists containing this project

README

          


 



wk


:keyboard: which-key like menu for zsh

## :package: Installation

1. Download the latest release and put into your `$PATH`:

2. Activate in `$ZDOTDIR/.zshrc`:

```shell
# Bind space as the leader key and comma as the major-leader key.
# The major-prefix "m" is used for the major menu.
eval "$(wk init --leader ' ' --major-leader ',' --major-prefix 'm')"
```

3. Restart zsh.

> [!TIP]
> If you want to register only the widgets, change it as follows:
>
> ```shell
> eval "$(wk init)"
> ```

## :gear: Configuration

### Config

`${XDG_CONFIG_HOME:-$HOME/.config}/wk/config.yaml`

```yaml
---
timeout: 60000
symbols:
prompt: '❯ '
colors:
prompt: 8
inputKeys:
color: 8
attrs: [dim]
breadcrumb:
color: 8
attrs: [dim]
lastInputKey:
color: 6
attrs: [underline]
bindingKey: 5
separator:
color: 5
attrs: [dim]
group: 8
bindingIcon: 8
bindingDescription: 8
```

See [schemas/config.json](./schemas/config.json) for more details.

### Global bindings

`${XDG_CONFIG_HOME:-$HOME/.config}/wk/bindings.yaml`

```yaml
---
- key: g
desc: Git
type: bindings
bindings:
- key: p
desc: Push/Pull
type: bindings
bindings:
- key: return
desc: git push
type: command
buffer: 'git push origin $(git symbolic-ref --short HEAD)'
eval: true
- key: f
desc: git push -f
type: command
buffer: 'git push --force-with-lease --force-if-includes origin $(git symbolic-ref --short HEAD)'
eval: true
- key: l
type: command
buffer: 'git pull'
accept: true
- key: y
desc: Yank
type: bindings
bindings:
- key: .
desc: Copy $PWD
type: command
buffer: ' echo -ne "\e]52;c;$(base64 <(pwd | tee >$TTY | sed -z ''$s/\n$//''))\a"'
accept: true
```

See [schemas/bindings.json](./schemas/bindings.json) for more details.

### Local bindings

`$PWD/wk.bindings.yaml`

```yaml
---
- key: m
desc: Major
type: bindings
bindings:
- key: b
type: command
buffer: 'npm run build'
accept: true
- key: l
type: command
buffer: 'npm run lint'
accept: true
- key: t
type: command
buffer: 'npm run test'
accept: true
```