Highlight the input as it is typed, with fish's colors; bjoterm 0.2.3

Commands that exist are blue and others red; arguments cyan, underlined
when they name a path that exists; quotes, variables, operators,
redirections and comments each have their color.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Linus Björnstam 2026-12-01 15:00:15 +01:00
parent 2636bbbc4e
commit dc0a4e5d2b
7 changed files with 235 additions and 4 deletions

View file

@ -31,6 +31,8 @@
;; - An interactive shell keeps the directories it visits, ranked by
;; frecency, and its directory history, in $XDG_STATE_HOME/bjosh (see
;; (bjosh dirs)). `cd KEYWORD...` goes to the best match.
;; - The input is highlighted as it is typed, with fish's colors (see
;; (bjosh highlight)).
;; - On an empty line, Alt-Left and Alt-Right go back and forward in the
;; directory history, as `prevd` and `nextd`.
@ -43,6 +45,7 @@
(import (bjosh builtins))
(import (bjosh exec))
(import (bjosh editor))
(import (bjosh highlight))
(import (bjosh api))
(import (bjosh user))
@ -199,6 +202,10 @@
(match (box-ref current)
((Some sh) (suggest sh text history))
(None None))))
#:highlighter (Some (fun (text)
(match (box-ref current)
((Some sh) (highlight sh text))
(None []))))
#:command-key? (Some directory-key?)
#:suspend? #f))
(def path (history-path))