Skip to content

Instantly share code, notes, and snippets.

@clouds56
Last active April 29, 2025 03:18
Show Gist options
  • Save clouds56/c150352258746e5e69afb642f5ce0db6 to your computer and use it in GitHub Desktop.
Save clouds56/c150352258746e5e69afb642f5ce0db6 to your computer and use it in GitHub Desktop.
nushell/starship
$env.config.show_banner = false
$env.config.table.mode = 'light'
$env.PROMPT_COMMAND = { ||
let last_exit = if ($env.LAST_EXIT_CODE != 0) {
$"(ansi red)($env.LAST_EXIT_CODE | into string)(ansi reset) "
} else { "" }
let user = (ansi blue) + (whoami | str trim) + (ansi reset)
let host = (hostname | str trim)
let dir = (ansi white_bold) + ($env.PWD | str replace $nu.home-path "~") + (ansi reset)
$"($last_exit)($user)@($host) ($dir) "
}
$env.PROMPT_INDICATOR = "$ "
# alias
alias builtin-ls = ls
alias ls = ^ls --color
alias l = ls -l
alias ll = builtin-ls
mkdir ($nu.data-dir | path join "vendor/autoload")
# starship prompts
$env.STARSHIP_CONFIG = ($nu.data-dir | path join "starship.toml")
$env.VIRTUAL_ENV_DISABLE_PROMPT = true
starship init nu | save -f ($nu.data-dir | path join "vendor/autoload/starship.nu")
# argc-completions
$env.ARGC_COMPLETIONS_PATH = [($env.ARGC_COMPLETIONS_ROOT | path join completions $nu.os-info.family), ($env.ARGC_COMPLETIONS_ROOT | path join completions)] | str join (char esep)
$env.Path = ($env.Path | prepend ($env.ARGC_COMPLETIONS_ROOT | path join bin))
argc --argc-completions nushell | save -f ($nu.data-dir | path join "vendor/autoload/argc-completions.nu")
format = """$status\
$python\
$username\
$hostname\
$directory\
([\\(](purple)git[\\)](purple)-[\\[](purple)${custom.git_branch}$git_state$git_status[\\]](purple) )\
$cmd_duration\
\\$ """
add_newline = false
[status]
format = "[$status(:$common_meaning)(|$signal_number(:$signal_name)) ]($style)"
disabled = false
[username]
format = "[$user]($style)@"
style_user = "bold blue"
show_always = true
[hostname]
format = "$hostname "
ssh_only = false
style = "white"
[directory]
style = "bold white"
truncation_length = 8
truncation_symbol = ".../"
truncate_to_repo = false
[custom.git_branch]
format = "[$output]($style)"
style = "green"
command = "git name-rev --no-undefined --exclude 'HEAD' --exclude '*/HEAD' --name-only HEAD"
when = true
[git_status]
format = "[($ahead_behind)[$conflicted](218)]($style)"
style = "cyan"
ahead = "↑$count"
behind = "↓$count"
conflicted = "*"
[git_state]
format = '|[$state( $progress_current/$progress_total)]($style)'
style = "red"
[cmd_duration]
format = "[$duration]($style) "
style = "yellow"
[python]
format = "[\\(($virtualenv-)$version\\)]($style) "
style = "bright-black"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment