nushell

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit ec561373d73aca55d99a9703a334d5268bcdcf44
Author: minerva-jupiter <ryouturn@gmail.com>
Date:   Thu, 23 Apr 2026 06:34:10 +0900

init for starship config

Diffstat:
A.gitignore | 1+
Aconfig.nu | 20++++++++++++++++++++
Aenv.nu | 21+++++++++++++++++++++
Avendor/autoload/starship.nu | 57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 99 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1 @@ +history.txt diff --git a/config.nu b/config.nu @@ -0,0 +1,20 @@ +# config.nu +# +# Installed by: +# version = "0.112.2" +# +# This file is used to override default Nushell settings, define +# (or import) custom commands, or run any other startup tasks. +# See https://www.nushell.sh/book/configuration.html +# +# Nushell sets "sensible defaults" for most configuration settings, +# so your `config.nu` only needs to override these defaults if desired. +# +# You can open this file in your default editor using: +# config nu +# +# You can also pretty-print and page through the documentation for configuration +# options using: +# config nu --doc | nu-highlight | less -R +mkdir ($nu.data-dir | path join "vendor/autoload") +starship init nu | save -f ($nu.data-dir | path join "vendor/autoload/starship.nu") diff --git a/env.nu b/env.nu @@ -0,0 +1,21 @@ +# env.nu +# +# Installed by: +# version = "0.112.2" +# +# Previously, environment variables were typically configured in `env.nu`. +# In general, most configuration can and should be performed in `config.nu` +# or one of the autoload directories. +# +# This file is generated for backwards compatibility for now. +# It is loaded before config.nu and login.nu +# +# See https://www.nushell.sh/book/configuration.html +# +# Also see `help config env` for more options. +# +# You can remove these comments if you want or leave +# them for future reference. + +# env.nu +$env.STARSHIP_CONFIG = ("~/.config/starship/starship.toml" | path expand) diff --git a/vendor/autoload/starship.nu b/vendor/autoload/starship.nu @@ -0,0 +1,57 @@ +# 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: ( + ^'C:\Users\ryout\.cargo\bin\starship.exe' prompt --continuation + ) + + # Does not play well with default character module. + # TODO: Also Use starship vi mode indicators? + PROMPT_INDICATOR: "" + + PROMPT_COMMAND: {|| + ( + # The initial value of `$env.CMD_DURATION_MS` is always `0823`, which is an official setting. + # See https://github.com/nushell/nushell/discussions/6402#discussioncomment-3466687. + let cmd_duration = if $env.CMD_DURATION_MS == "0823" { 0 } else { $env.CMD_DURATION_MS }; + ^'C:\Users\ryout\.cargo\bin\starship.exe' prompt + --cmd-duration $cmd_duration + $"--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: {|| + ( + # The initial value of `$env.CMD_DURATION_MS` is always `0823`, which is an official setting. + # See https://github.com/nushell/nushell/discussions/6402#discussioncomment-3466687. + let cmd_duration = if $env.CMD_DURATION_MS == "0823" { 0 } else { $env.CMD_DURATION_MS }; + ^'C:\Users\ryout\.cargo\bin\starship.exe' prompt + --right + --cmd-duration $cmd_duration + $"--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 { + [] + } + ) + ) + } +}}