LinuxCommandLibrary

starship

Customize terminal prompt

TLDR

Print the starship integration code for the specified shell

$ starship init [bash|elvish|fish|ion|powershell|tcsh|zsh|nu|xonsh|cmd]
copy

Explain each part of the current prompt and show the time taken to render them
$ starship explain
copy

Print the computed starship configuration (use --default to print default configuration instead)
$ starship print-config
copy

List supported modules
$ starship module --list
copy

Edit the starship configuration in the default editor
$ starship config
copy

Create a bug report GitHub issue pre-populated with information about the system and starship configuration
$ starship bug-report
copy

Print the completion script for the specified shell
$ starship completions [bash|elvish|fish|powershell|zsh]
copy

Display help for a subcommand
$ starship [subcommand] --help
copy

SYNOPSIS


starship init SHELL [OPTIONS]
starship prompt [OPTIONS]
starship config [OPTIONS]
starship module MODULE_NAME [OPTIONS]
starship COMMAND [OPTIONS]

PARAMETERS

init SHELL
    Initializes starship for the specified shell (e.g., bash, zsh, fish, powershell, nushell, elvish, ion). This command outputs the necessary shell script to set up the prompt.

prompt
    Prints the current prompt string based on the active configuration and environment. This command is primarily used internally by the shell's PROMPT_COMMAND (or equivalent).

config
    Opens the Starship configuration file (starship.toml) in your default editor for modification. If the file doesn't exist, it creates a new one with a basic structure.

module MODULE_NAME
    Displays information and the rendered output for a specific Starship module (e.g., git_branch, nodejs, kubernetes). Useful for debugging module-specific configurations.

print-config
    Prints the current active Starship configuration to standard output, including any default values. This is helpful for reviewing the full configuration that Starship is using.

--help, -h
    Displays a help message for the starship command or its subcommands.

--version, -V
    Prints the version information for the installed starship executable.

DESCRIPTION

Starship is a minimal, blazing-fast, and infinitely customizable prompt for any shell. It is designed to be universal, working across various shell environments like Bash, Zsh, Fish, PowerShell, Nushell, and more. Written in Rust, Starship prioritizes performance, ensuring your shell remains responsive even with a rich and informative prompt. Its modular architecture allows users to enable or disable specific elements (like Git status, Kubernetes context, Node.js version, etc.) and customize their appearance with ease, often through a simple TOML configuration file. Starship aims to provide a beautiful and functional prompt without the overhead of larger shell frameworks, enhancing developer productivity by providing immediate context about their current working environment.

CAVEATS

For the best visual experience, including icons and symbols, a Nerd Font (e.g., FiraCode Nerd Font, JetBrains Mono Nerd Font) should be installed and configured in your terminal emulator. Without it, some prompt elements may appear as placeholder characters or be missing. While Starship is fast, extremely complex custom commands or network-bound information in the prompt can still introduce latency.

CONFIGURATION

Starship's extensive customization is primarily managed through a TOML configuration file, typically located at ~/.config/starship.toml. This file allows users to define the order of modules, customize their symbols, colors, and formatting, and set conditional display rules. The modular approach makes it easy to add or remove context-aware information from the prompt without modifying complex shell scripts.

MODULES

Starship's functionality is broken down into small, independent units called modules. Each module is responsible for displaying a specific piece of information, such as the current working directory, Git status, programming language versions (Node.js, Python, Rust, Go, etc.), cloud provider contexts (AWS, GCP, Azure), Kubernetes contexts, and more. Users can enable, disable, and reorder these modules in their configuration to tailor the prompt to their exact needs.

HISTORY

Starship was created by Matija Marohnić and first released in 2019. Its development was motivated by a desire for a fast, universal, and easily customizable shell prompt that transcended the limitations of shell-specific frameworks. By being written in Rust, Starship capitalized on Rust's performance and memory safety features, which contributed to its reputation as a 'blazing fast' prompt. Its cross-shell compatibility quickly made it a popular choice for developers using diverse environments, offering a consistent and powerful prompt experience across their various machines and shells.

SEE ALSO

oh-my-zsh, powerlevel10k, pure, bash-it, powerline

Copied to clipboard