export-env { $env.PJ_HELIX_CONFIG_PATH = $env.NU_POLYJUICE_PATH | path join ".." "helix" "config.toml" } # Shared launcher: resolves the helix binary, applies the polyjuice config, and # prints an OS-appropriate install hint when nothing is found. def _pj_helix_launch [...rest: string] { if (which ^helix | is-not-empty) { ^helix -c $env.PJ_HELIX_CONFIG_PATH ...$rest } else if (which ^hx | is-not-empty) { ^hx -c $env.PJ_HELIX_CONFIG_PATH ...$rest } else { print "Helix editor not found." if (($nu.os-info.name? | default "" | str lowercase) == "windows") { print "You can install Helix via `winget install Helix.Helix`" } else { print "You can install Helix from your package manager." } } } export def hx [...rest: string] { _pj_helix_launch ...$rest } export def helix [...rest: string] { _pj_helix_launch ...$rest }