shipwithjev

Catalog / Tools & apps

0479GitHub

jev-shell-history

Ranks existing zsh history entries for inline completion; accepting a suggestion does not execute it.

mrnugget/jev-shell-historyREADME ↗
# jev-shell-history

Fish-style autosuggestions for zsh, ranked by [Jev](https://typesafe.ai)
(TypeSafe). As you type, the plugin looks at your last 100 distinct history
entries and asks Jev which one you are most likely completing. The best match is
shown in grey after the cursor, with its score; press → (or `^E` / End) to
accept it.



```
% git st▌atus  [0.970]                        ← prefix mode: literal completion
% last 5 commits▌  ⇢ git log --oneline -5  [1.000]  ← replace mode: no entry starts with the input
```

(The demo runs against a fabricated history; regenerate it with
`demo/make-demo.sh`, which needs `vhs`, `ffmpeg` and `TYPESAFE_API_KEY`.)

## Install

Requirements: zsh 5.9+, Node 22+ (runs the TypeScript directly), a TypeSafe API
key.

```sh
git clone <this repo> ~/.zsh/jev-shell-history
cd ~/.zsh/jev-shell-history && npm install
```

In `~/.zshrc`:

```zsh
export TYPESAFE_API_KEY=...
source ~/.zsh/jev-shell-history/zsh/jev-shell-history.plugin.zsh
```

Suggestions are accepted by `forward-char`, `vi-forward-char`, `end-of-line`
and `vi-end-of-line` when the cursor is at the end of the line, so → and `^E`
work in both emacs and vi keymaps (in vi mode, bind `^E` to `end-of-line` if
you want it there). There is also a standalone widget, `jev-accept-suggestion`,
for a custom binding.

### Configuration

Set before sourcing the plugin:

| Variable            | Default | Meaning                                                             |
| ------------------- | ------- | ------------------------------------------------------------------- |
| `JEV_HISTORY_LIMIT` | `100`   | Recent distinct commands to consider                                |
| `JEV_MIN_CHARS`     | `2`     | Do nothing until this many characters are typed                     |
| `JEV_THR

Also filed under Tools & apps