If you follow the internet trends around tools for developers, you might have heard of Starship, a tool that gives useful information quickly for higher productivity for developers.
At first, I got the feeling that Startship is more cosmetic than anything else, but after a few weeks working with it, I noticed that it is indeed a productivity tool in the original sense: low effort, high speed gains in the day-to-day workflow.
A typical problem that Starship solves
By day, I write mostly Python code, and the tricky thing that people forget is that there is no Python - there are Pythons. Each new Python 3.X version introduces several new features and might break some APIs from other 3.X versions. If I write code for Python 3.12, colleagues of mine that not so tech-savy and have only Python 3.10 in their machines would not be able to use my tools.
A similar problem occur for package versions: different clients use different versions of my companyโs products, so when debugging I need to be sure of running the correct version.
Enter Starship. When prototyping an application this morning, this is the prompt I got:
~/newapp on ๎ main [?] is ๐ฆ v0.1.0 via ๐ v3.11.8 took 4s
โ
This tells me immediately that:
Iโm on the
newapp
root directoryIโm on the main branch
There is at least one untracked file in git
The package version 0.1.0
Iโm not in an activated virtual environment, but am running Python 3.11.8
The previous command tool 4 seconds to run
Everything substantial that I would do, like activating an environment or bumping up the package version, would reflect immediately in the prompt.
When I switch projects to use Go for a new CLI tool that Iโm building, now I see this:
~/awesome-go-cli on ๎ main via ๐น v1.21.6
and now my brain notices the new animal and knows that I need to think statically-typed.
Productivity for developers: easy to setup, powerful results
Of course real nerds would set it up with shell variables in the profile and RC files. The real productivity leap is that configuration is minimal:
Install Starship with the official guide
Create your configuration in
~/.config/starship.toml
. Everything you saw above is built-in: there is the entirety of my configuration with comments:
# Replace the 'โฏ' symbol in the prompt with 'โ'
[character] # The name of the module we are configuring is 'character'
# The 'success_symbol' segment is being set to 'โ' with the color 'bold green'
success_symbol = '[โ](bold green)'
error_symbol = '[โ](bold red)'
[c]
symbol = "๎ "
[directory]
# the default is to truncate the full path in the prompt
# this increases the number of subdirectories before truncation happens
read_only = " ๓ฐพ"
truncation_length = 6
truncation_symbol = "..."
truncate_to_repo = false
[docker_context]
# I rarely use Docker but when I do, I find the Docker additions distracting
disabled = true
The TOML file is based on modules that you customize individually. Notice I did not have to change nor the Python nor the Go modules.
Do you use any shell prompt like this? Leave suggestions for similar productivity tools in the comments!