Files
TerminalPolyjuice/nushell/modules/pj_helix.nu
T
gwbeip deb4e45c4e fix(nushell): improve robustness and clarify abstraction boundaries
- pj_completions: merge into $env.config instead of replacing it wholesale
- pj_completions: use parse-time const for cache dir instead of pwd fallback
- pj_fzf / pj_historyhintcomplete: null-safe keybindings access via ? and default
- pj_helix: replace $env.OS (Windows-only) with $nu.os-info.name; extract shared launcher
- pj_prompt: fix off-by-one in git OID substring (0..7 -> 0..<7)
- pj_prompt: use $nu.os-info.name for OS detection instead of sys host hostname
- pj_prompt: cache git availability in static base, skip per-render which call
- pj_prompt: bind LAST_EXIT_CODE once in right-prompt closure
- pj_brew / pj_uv: add --ignore-errors to hide-env calls
- pj_aliases: convert quote/dadjoke to defs with try/catch error handling
- pj_deepseek: guard curl availability before invoking
- pj_zoxide: add ? to $nu.os-info.name access
- pj_starship: fix null-to-nuon producing "null" string; broaden detection
- nu_polyjuice: load pj_starship module
2026-07-31 00:31:04 +08:00

24 lines
916 B
Nu

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 }