From 29e5cb59653016117c09dda509ef04d1d51ed967 Mon Sep 17 00:00:00 2001 From: qwjyh Date: Fri, 13 Oct 2023 20:48:06 +0900 Subject: [PATCH] new: nu: starship --- extra_configs/starship.nu | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 extra_configs/starship.nu diff --git a/extra_configs/starship.nu b/extra_configs/starship.nu new file mode 100644 index 0000000..23ef565 --- /dev/null +++ b/extra_configs/starship.nu @@ -0,0 +1,27 @@ +let-env STARSHIP_SHELL = "nu" +let-env STARSHIP_SESSION_KEY = (random chars -l 16) +let-env PROMPT_MULTILINE_INDICATOR = (^'C:\Program Files\starship\bin\starship.exe' prompt --continuation) + +# Does not play well with default character module. +# TODO: Also Use starship vi mode indicators? +let-env PROMPT_INDICATOR = "" + +let-env PROMPT_COMMAND = { || + # jobs are not supported + let width = (term size).columns + ^'C:\Program Files\starship\bin\starship.exe' prompt $"--cmd-duration=($env.CMD_DURATION_MS)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)" +} + +# Whether we have config items +let has_config_items = (not ($env | get -i config | is-empty)) + +let-env config = if $has_config_items { + $env.config | upsert render_right_prompt_on_last_line true +} else { + {render_right_prompt_on_last_line: true} +} + +let-env PROMPT_COMMAND_RIGHT = { || + let width = (term size).columns + ^'C:\Program Files\starship\bin\starship.exe' prompt --right $"--cmd-duration=($env.CMD_DURATION_MS)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)" +}