History suggestions, frecency, cd by keyword, fish completions; bjoterm 0.2.0

The editor suggests history lines whose command exists, cd lines by the
frecency of their directory, paths ignoring case, and the visited directory
that cd KEYWORD... goes to. Tab completes arguments with fish's completions
when fish is on PATH, and paths by the start of each part (~/P/B/B).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Linus Björnstam 2026-12-01 13:30:23 +01:00
parent 5012a5d993
commit 61d5a96eda
10 changed files with 751 additions and 110 deletions

View file

@ -357,7 +357,20 @@ the text above:*
same command: the order of the two would matter. A stage with ~>&2~
before another one in a pipe is an error, as one with ~>~ is.
- An alias of its own name (~alias ls='ls -d'~) runs the program.
- The completer does not complete aliases yet.
- The completer completes aliases and the user's commands, with their
help. Arguments complete with fish's completions when fish is on
~PATH~ (~complete --do-complete~, at most 2 seconds), else with paths.
Paths match with case, then without, then with each part as the start
of a name (~~/P/B/B~).
- The suggester, as fish's: a history line whose command exists (for
~cd~, the one whose directory has the highest frecency), else
directories and paths, else the visited directory that ~cd KEYWORD...~
goes to.
- An interactive shell saves the visited directories with their
frecency, and the directory history, in ~$XDG_STATE_HOME/bjosh~. ~cd~
with words that name no directory goes to the best match there and
writes it. Only an interactive shell does that: a script's ~cd~ to a
missing directory fails.
- Tests: ~tests/syntax.bjo~ (72), ~tests/expand.bjo~ (26),
~tests/editor.bjo~ (24), ~tests/run.bjo~ (60), ~tests/values.bjo~
(59), ~tests/interactive.bjo~ (16). bjoterm's