2023-06-12 11:02:46 +02:00
|
|
|
# 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`
|
2024-03-21 06:38:38 -05:00
|
|
|
export-env { $env.STARSHIP_SHELL = "nu"; load-env {
|
2023-06-12 11:02:46 +02:00
|
|
|
STARSHIP_SESSION_KEY: (random chars -l 16)
|
|
|
|
|
PROMPT_MULTILINE_INDICATOR: (
|
|
|
|
|
^::STARSHIP:: prompt --continuation
|
|
|
|
|
)
|
2021-07-04 21:32:58 +02:00
|
|
|
|
2023-06-12 11:02:46 +02:00
|
|
|
# Does not play well with default character module.
|
|
|
|
|
# TODO: Also Use starship vi mode indicators?
|
|
|
|
|
PROMPT_INDICATOR: ""
|
2022-03-24 20:06:24 +01:00
|
|
|
|
2023-06-12 11:02:46 +02:00
|
|
|
PROMPT_COMMAND: {||
|
|
|
|
|
(
|
|
|
|
|
^::STARSHIP:: prompt
|
|
|
|
|
--cmd-duration $env.CMD_DURATION_MS
|
|
|
|
|
$"--status=($env.LAST_EXIT_CODE)"
|
|
|
|
|
--terminal-width (term size).columns
|
2025-05-28 00:24:39 +03:00
|
|
|
...(
|
|
|
|
|
if (which "job list" | where type == built-in | is-not-empty) {
|
|
|
|
|
["--jobs", (job list | length)]
|
|
|
|
|
} else {
|
|
|
|
|
[]
|
|
|
|
|
}
|
|
|
|
|
)
|
2023-06-12 11:02:46 +02:00
|
|
|
)
|
|
|
|
|
}
|
2022-03-24 20:06:24 +01:00
|
|
|
|
2023-06-12 11:02:46 +02:00
|
|
|
config: ($env.config? | default {} | merge {
|
|
|
|
|
render_right_prompt_on_last_line: true
|
|
|
|
|
})
|
2022-12-02 19:40:36 +08:00
|
|
|
|
2023-06-12 11:02:46 +02:00
|
|
|
PROMPT_COMMAND_RIGHT: {||
|
|
|
|
|
(
|
|
|
|
|
^::STARSHIP:: prompt
|
|
|
|
|
--right
|
|
|
|
|
--cmd-duration $env.CMD_DURATION_MS
|
|
|
|
|
$"--status=($env.LAST_EXIT_CODE)"
|
|
|
|
|
--terminal-width (term size).columns
|
2025-05-28 00:24:39 +03:00
|
|
|
...(
|
|
|
|
|
if (which "job list" | where type == built-in | is-not-empty) {
|
|
|
|
|
["--jobs", (job list | length)]
|
|
|
|
|
} else {
|
|
|
|
|
[]
|
|
|
|
|
}
|
|
|
|
|
)
|
2023-06-12 11:02:46 +02:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}}
|