Starship Prompt Builder

Username module

Show the current user and apply separate styles for regular and root sessions.

When it appears

By default it appears for root, SSH, and other non-default user sessions; show_always makes it permanent.

Preview

Rendered from the starting configuration in a representative simulated environment.

starship — preview
you 

Starting configuration

[username]
show_always = true
style_user = "bold blue"
style_root = "bold red"
format = "[$user]($style) "
Open in the builder

The configuration is compressed into the URL fragment and stays in your browser.

Key options

formatstring
The format for the module.
show_alwaysboolean
Always shows the username module.
style_userstring
The style used for non-root users.
style_rootstring
The style used when the user is root/admin.
aliasesobject
Translate system usernames to something else.
detect_env_varsarray
Which environment variable(s) should trigger this module.

Format variables

$user
The currently logged-in user ID.
$style
Mirrors the value of option style_root when root is logged in and style_user otherwise.

Common adjustments

  • Keep show_always false when the username only matters in unusual sessions.
  • Use aliases to shorten machine or directory-service account names.
  • Retain $style in format if style_user and style_root should paint the output.