Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/844196/wk

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

which-key zsh

Last synced: 27 days ago
JSON representation

⌨️ which-key like menu for shell

Awesome Lists containing this project

README

        


 



wk


:keyboard: which-key like menu for shell

## :package: Installation

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

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

```shell
# Register a widget with the name "_wk_widget", and bind it to the ^G.
eval "$(wk widget zsh)"
```

3. Restart zsh.

> [!TIP]
> If you want to change the trigger key, change it as follows:
>
> ```shell
> eval "$(wk widget zsh --bindkey '^T')"
> ```
>
> If you want to register only the widget, change it as follows:
>
> ```shell
> eval "$(wk widget zsh --no-bindkey)"
> ```

## :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
```