Files
starship/src/init/starship.nu
T

52 lines
1.6 KiB
Nu
Raw Normal View History

# 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
)
2021-07-04 21:32:58 +02:00
# 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
})
2022-12-02 19:40:36 +08:00
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 {
[]
}
)
)
}
}}