Skip to content
Kendrick's Website Kendrick's GitHub Kendrick's Youtube Kendrick's Travel blog

Starship - Cross-shell prompt and zsh plugins

5 min read
Cover

In this post, I'll introduce Starship, a cross-shell prompt.

What is Starship?

Starship is called a cross-shell prompt. Starship

What is a cross-shell prompt?

This tool is a command-line interface that works across various shell environments. Unlike traditional shell prompts that are specialized for specific shells (like Bash or Zsh), cross-shell prompts are compatible with multiple shells without separate core functionality or appearance changes. This is very useful for users who use multiple shells across different operating systems. It also provides a consistent prompt interface regardless of which shell you use, simplifying the user experience.

Why Starship?

I used Powerlevel9k for over 3 years, but I felt it was getting slower over time, so I looked for other shell prompts. Of course, vanilla is good too, but I was fascinated by customized themes and found similar ones, then switched to Powerlevel10k. After using it for a few months, I discovered Starship and switched again.

In the case of Powerlevel, it can only be used in Zsh, and the biggest problem is that it takes too much time to customize initially. After using Starship, I just need to install it simply and then install only essential zsh plugins I use frequently, so the time spent on new workspace setup compared to the functionality provided was satisfactory.

After using it for over a year like this, I thought it would be good to recommend it, so I wrote this post.

Pros and Cons

These are the pros and cons of Starship compared to Powerlevel10k, written by the creator of Powerlevel10k on Reddit.

Starship's advantages:

  • Works across various shells. Configure the prompt once and you can use it in bash, fish, and zsh.
  • Excellent documentation.
  • Very simple configuration.
  • Written in Rust.

Powerlevel10k's advantages:

  • More features: transient prompt, instant prompt, display on command, etc.
  • Can be configured with a wizard.
  • Much faster.

What to Use?

I want to customize to my heart's content? -> Powerlevel10k

I don't want to spend a lot of time on customization and I use zsh, bash, fish, etc. -> Starship

I use Fish? -> Tide

These tools have similar themes to each other. If I use the terminal frequently and want to personalize it with my own style, I strongly recommend Powerlevel10k. Conversely, if you like clean environments like vanilla and don't want to spend a lot of time on settings but want to install and use it immediately in a well-configured state, I recommend Starship.

Especially if you're using MacOS, since certain OS versions use zsh as the default shell, I recommend choosing between Powerlevel10k or Starship.

VSCode + iTerm2 + Starship

I use iTerm2 almost like a terminal. And I've linked VSCode to use iTerm2 as the terminal.

This way, when using the terminal in VSCode, you can use it without any disparity with iTerm. I'm sharing the detailed setup method through the StackOverflow link below.

Change default terminal app in Visual Studio Code on Mac - StackOverflow

  1. Code (Menu) > Preferences > User Settings
  2. Edit settings.json "terminal.external.osxExec": "iTerm.app" and "terminal.explorerKind": "external"
  3. Open in Terminal

Finally, I'll introduce some recommended plugins for Zsh users. Refer to the descriptions and examples to install as needed. You can follow the provided links for installation methods.

When there's an error in a command while using the terminal, it suggests a more appropriate command, and if you type 'fuck' again, it executes that command.

Example 1:

 apt-get install vim
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

 fuck
sudo apt-get install vim [enter/↑/↓/ctrl+c]
[sudo] password for nvbn:
Reading package lists... Done

Example 2:

➜ puthon
No command 'puthon' found, did you mean:
 Command 'python' from package 'python-minimal' (main)
 Command 'python' from package 'python3' (main)
zsh: command not found: puthon

➜ fuck
python [enter/↑/↓/ctrl+c]
Python 3.4.2 (default, Oct  8 2014, 13:08:17)

fzf is a tool that helps with navigation in terminal environments. This tool reminds me of mdir used on old 486 computers.

Using grep is also good, but fzf is more versatile and recommended.

There's also a similar tool called fd that you might want to check out.

This feature provides auto-completion.

Based on commands you've entered in the past, it's very useful when entering repetitive commands.

For example, you can easily use long Docker execution commands or similar long commands without having to search through history with the auto-completion feature. Personally, I've set it to prioritize the last entered command.

I also recommend nvm, which many developers are probably already using. This tool is essential for developers working in multiple Node version environments.

You can install with nvm install [version] and easily change the current terminal's Node version with the nvm use [version] command.