- Scheme 92%
- Shell 8%
helix-hoogle #
A small Steel plugin for the plugin-enabled fork of Helix that opens the identifier under the cursor (or the current selection) in Mercury's internal Hoogle.
Behavior #
g H runs the :hoogle-search command, which:
- In select mode (or any selection longer than one character) uses the
highlighted text verbatim — handy for qualified names like
Data.Map.lookupor operators like>>=. - Otherwise extracts the identifier under the cursor (
[A-Za-z0-9_']; a.is a boundary, soData.Map.lookupunderlookupyieldslookup).
The term is RFC-3986 percent-encoded and opened via a direct, shell-free
process spawn (open <url>), so URL/shell metacharacters are passed verbatim.
Configuration #
The Hoogle URL defaults to Mercury's internal instance. Override it from
init.scm (after the require) with the percent-encoded term's URL prefix:
(hoogle-set-url! "https://hoogle.haskell.org/?hoogle=")
Install #
This fork loads Steel modules from ~/.local/share/steel/cogs/. Copy the cog
there:
./install.sh
# or: cp hoogle.scm ~/.local/share/steel/cogs/hoogle.scm
Then load it from ~/.config/helix/init.scm:
(require "hoogle.scm")
And bind the key (also in init.scm, using the Steel keymap API — config.toml
[keys] are not applied under the Steel engine):
(keymap (global)
(normal ("g" ("H" ":hoogle-search")))
(select ("g" ("H" ":hoogle-search"))))
Restart Helix (a full restart, not :config-reload, since the require runs
at startup).
Development #
hoogle.scm here is the source of truth. After editing, run ./install.sh to
copy it into the Steel cogs directory, then restart Helix.