"$schema" = "https://starship.rs/config-schema.json"

# 每次提示符前插入空行，增加视觉间距
add_newline = true

# 扫描 Git 仓库上下文的超时时间（毫秒），显式声明避免默认值歧义
scan_timeout = 30

# 单个模块运行超时（毫秒），调高避免大型仓库模块被跳过
command_timeout = 5000

# 布局：左侧放位置信息，$fill 填充空白，右侧推送状态信息
# 第二行只保留 ❯ 等待输入，视觉层次清晰
format = """
$username$hostname$directory$git_branch$git_status$git_metrics$fill$python$nodejs$rust$cmd_duration$time
$character"""

# ── 调色板：统一管理颜色，避免分散在各模块 ──────────────────────────
palette = "custom"

[palettes.custom]
user_color    = "blue"
root_color    = "red"
host_color    = "green"
dir_color     = "cyan"
branch_color  = "purple"
status_color  = "yellow"
error_color   = "red"
dim_color     = "white"
lang_color    = "yellow"
node_color    = "green"
rust_color    = "red"

# ── 身份信息 ────────────────────────────────────────────────────────
[username]
style_user = "user_color bold"   # 普通用户：蓝色加粗
style_root = "root_color bold"   # root：红色警示
format = "[$user]($style) "
show_always = false               # 本机不显示，SSH 会话自动带出

[hostname]
ssh_only = true                   # 仅 SSH 会话显示主机名，减少本地噪音
style = "host_color bold"
format = "@[$hostname]($style) "

# ── 目录 ────────────────────────────────────────────────────────────
[directory]
truncation_length = 3             # 最多显示路径最后 3 段
truncation_symbol = "…/"          # 路径被截断时显示省略符，明确感知层级缺失
truncate_to_repo = true           # Git 仓库内以仓库根为起点，不显示仓库外路径
style = "dir_color bold"
format = "[$path]($style) "

# ── Git ─────────────────────────────────────────────────────────────
[git_branch]
symbol = " "                     # 需要 Nerd Font
style = "branch_color bold"
format = "[$branch]($style) "

[git_status]
style = "status_color"
format = "[$all_status]($style) "
ahead      = "↑"   # 本地超前远端
behind     = "↓"   # 本地落后远端
diverged   = "⇕"   # 与远端分叉
conflicted = "✖"   # 合并冲突
untracked  = "?"   # 未跟踪文件
staged     = "+"   # 已暂存变更
modified   = "!"   # 未暂存的修改
renamed    = "»"   # 重命名文件
deleted    = "✘"   # 删除文件
stashed    = "≡"   # 有 stash 记录

[git_metrics]
disabled = false                  # 显示增删行数，code review 时很实用
added_style = "green bold"
deleted_style = "red bold"
format = "[+$added]($added_style) [-$deleted]($deleted_style) "

# ── 填充：把左侧位置信息和右侧状态信息分开 ──────────────────────────
[fill]
symbol = " "                      # 用空格填充，撑开左右两侧内容

# ── 语言版本（右侧，仅在对应项目目录内出现）────────────────────────
[python]
symbol = "🐍 "
format = "[$symbol$version]($style) "
style = "lang_color"
detect_files = ["*.py", "requirements.txt", "pyproject.toml", ".python-version"]

[nodejs]
symbol = "⬢ "
format = "[$symbol$version]($style) "
style = "node_color"
detect_files = ["package.json", ".nvmrc", ".node-version"]

[rust]
symbol = "🦀 "
format = "[$symbol$version]($style) "
style = "rust_color"
detect_files = ["Cargo.toml"]

# ── 耗时与时间（右侧）──────────────────────────────────────────────
[cmd_duration]
min_time = 2000                   # 命令耗时超过 2 秒才显示
style = "status_color italic"
format = "[$duration]($style) "

[time]
disabled = false
format = "[$time]($style) "
style = "dim_color dimmed"        # 低调显示，不抢主要信息视觉权重
time_format = "%H:%M"             # 只显示时:分

# ── 退出状态（第二行左侧，紧贴输入符）──────────────────────────────
[status]
symbol = "✗ "
style = "error_color bold"
format = "[$symbol$status]($style) "   # 符号 + 退出码数字，简洁无冗余
disabled = false

# ── 输入符（第二行）────────────────────────────────────────────────
[character]
success_symbol = "[❯](bold green)"    # 上条命令成功：绿色
error_symbol   = "[❯](bold red)"      # 上条命令失败：红色
vimcmd_symbol  = "[❮](bold purple)"  # Vim 普通模式：紫色
