mirror of
https://github.com/starship/starship.git
synced 2026-06-22 02:02:12 +07:00
ac2359ca8a
* Add job support for nushell * Do not raise minimum supported nushell version * Update documentation about job support on nushell
52 lines
1.6 KiB
Nu
52 lines
1.6 KiB
Nu
# this file is both a valid
|
|
# - overlay which can be loaded with `overlay use starship.nu`
|
|
# - module which can be used with `use starship.nu`
|
|
# - script which can be used with `source starship.nu`
|
|
export-env { $env.STARSHIP_SHELL = "nu"; load-env {
|
|
STARSHIP_SESSION_KEY: (random chars -l 16)
|
|
PROMPT_MULTILINE_INDICATOR: (
|
|
^::STARSHIP:: prompt --continuation
|
|
)
|
|
|
|
# Does not play well with default character module.
|
|
# TODO: Also Use starship vi mode indicators?
|
|
PROMPT_INDICATOR: ""
|
|
|
|
PROMPT_COMMAND: {||
|
|
(
|
|
^::STARSHIP:: prompt
|
|
--cmd-duration $env.CMD_DURATION_MS
|
|
$"--status=($env.LAST_EXIT_CODE)"
|
|
--terminal-width (term size).columns
|
|
...(
|
|
if (which "job list" | where type == built-in | is-not-empty) {
|
|
["--jobs", (job list | length)]
|
|
} else {
|
|
[]
|
|
}
|
|
)
|
|
)
|
|
}
|
|
|
|
config: ($env.config? | default {} | merge {
|
|
render_right_prompt_on_last_line: true
|
|
})
|
|
|
|
PROMPT_COMMAND_RIGHT: {||
|
|
(
|
|
^::STARSHIP:: prompt
|
|
--right
|
|
--cmd-duration $env.CMD_DURATION_MS
|
|
$"--status=($env.LAST_EXIT_CODE)"
|
|
--terminal-width (term size).columns
|
|
...(
|
|
if (which "job list" | where type == built-in | is-not-empty) {
|
|
["--jobs", (job list | length)]
|
|
} else {
|
|
[]
|
|
}
|
|
)
|
|
)
|
|
}
|
|
}}
|