Neo Tokyo Vibes for Your Command Line

Neo Tokyo Vibes for Your Command Line

Tags
DotFiles
OSS
Published
August 27, 2024
Author
Jesper Vang
🌆 Neo Tokyo Vibes for Your Command Line: A Starship Prompt Experience
Hello, Command Line Enthusiasts!
I was asked about my prompt at a Hackathon so here we go.
Look no further! the Neo Tokyo Starship Prompt – a visually captivating prompt that transforms your terminal into a futuristic wonderland, perfect for anyone who loves a touch of cyberpunk aesthetic.
Why Neo Tokyo?
The Tokyo night theme has been a favorite among developers who enjoy a sleek, modern interface with a futuristic flair. Inspired by the neon lights and dynamic energy of a cyberpunk cityscape.
This Starship prompt configuration complements the Neo Tokyo theme for VS Code (but it looks fantastic with any theme, really! - Thanks to Sizur for the org style). It uses Nerd Fonts and modern terminal features to create a unique, engaging command-line experience. This prompt isn’t just about looks; it’s designed to be highly functional and informative, making your command-line experience both stylish and efficient. Here’s a quick rundown of its key features:
  • Battery Status: Know when your device needs a charge at a glance.
  • Shell Level: Displays the current shell level with cool symbols.
  • Command Duration: Tracks how long each command takes to execute, perfect for optimizing workflows.
  • Time Display: A neat time display right in your terminal.
  • Git Integration: Detailed Git information, including branch, commit hash, and state.
  • Customizable Icons: Various symbols for different statuses, shells, and languages.
Getting Started with the Neo Tokyo Starship Prompt
Install Starship: If you haven’t installed Starship yet, you can follow the official installation guide.
2. Install a Nerd Font: This prompt relies on Nerd Fonts to display icons correctly. You can download one from Nerd Fonts. Make sure to set this font in your terminal settings.
3. Configure Your Prompt: Copy the following TOML configuration into your Starship configuration file (~/.config/starship.toml for Linux/MacOS or C:\Users\<YourUsername>\.config\starship.toml for Windows).
4. Reload Your Terminal: Restart your terminal or source the configuration file to apply the new prompt.
Notion cant display Nerd fonts - dont worry, if You install a Nerd font it will work.
"$schema" = 'https://starship.rs/config-schema.json' format = """ [](bold inverted)$shell$battery$status$directory$cmd_duration$time$all\ [](bold inverted)[](underline)$shlvl$character\ """ continuation_prompt = "[ ](inverted) " add_newline = true [shlvl] format = "[$symbol$shlvl]($style underline)" symbol = "󱌵 " style = "bold italic" threshold = 1 disabled = false [shell] disabled = false format = "[$indicator]($style)" style = "bold underline italic" [[battery.display]] threshold = 10 style = "red" [battery] format = " []($style bold)[$symbol]($style bold inverted bold)[]($style bold)[$percentage]($style bold underline)" full_symbol = "󰁹" charging_symbol = "󰂄" discharging_symbol = "󱊢" unknown_symbol = "󰂑" empty_symbol = "󱊡" [status] map_symbol = true disabled = false format = ' []($style)[$symbol$common_meaning$signal_name$maybe_int]($style bold inverted)[]($style)' style = "red" [cmd_duration] format = " []($style)[󰄉]($style inverted bold)[]($style)[$duration]($style underline)" style = "" [time] disabled = false format = " []($style)[]($style bold inverted)[]($style)[$time]($style underline) " style = "" [directory] format = " [$path]($style)[$read_only]($read_only_style)" [character] success_symbol = "" error_symbol = "" vimcmd_symbol = "[](bold green)" vimcmd_replace_one_symbol = "[](bold purple)" vimcmd_replace_symbol = "[](bold purple)" vimcmd_visual_symbol = "[](bold yellow)" [dotnet] format = "[$symbol]($style inverted bold)[]($style)[($version )(🎯 $tfm )]($style underline)" symbol = "" style = "" [nodejs] format = "[$symbol]($style bold inverted)[]($style )[($version )]($style underline)" symbol = "" style = "" [gcloud] format = '[$symbol]($style bold inverted)[]($style)[$account(@$domain)(\([$project]($style italic underline)\))]($style underline)' symbol = "󱇶" style = "" [python] format = '[$symbol]($style inverted)[]($style)[${pyenv_prefix}(${version} )(\($virtualenv\) )]($style underline)' symbol = "" style = "" [git_branch] format = "[$symbol]($style bold inverted)[]($style)[$branch(:$remote_branch)]($style underline)" style = "" symbol = "" [git_commit] format = "[ \\($hash$tag\\)]($style underline) " style = "" tag_disabled = false [git_state] format = "[ \\($state( $progress_current/$progress_total)\\)]($style underline) " style = ""
Customization Tips
One of the best things about the Starship prompt is its customizability. Here are a few ways to make it your own:
  • Change Colors and Styles: You can modify the color scheme by adjusting the style parameter in the configuration file. Try combinations of bold, italic, underline, and different color codes.
  • Add or Remove Components: If there are sections you don’t want, like battery status or command duration, you can disable them by setting disabled = true for that section.
  • Adjust Symbols: Swap out symbols to match your aesthetic preference or for better clarity.
See It in Action!
Check out these examples of the Neo Tokyo Starship Prompt in various terminal themes:
  • Dark Theme with Tokyo Night: A sleek look that highlights the bright, neon accents.
  • Light Theme Compatibility: Works beautifully with light-themed terminals too!
  • VS Code Tokyo Night Theme Pairing: Achieves perfect harmony when combined with the Neo Tokyo theme in VS Code terminal, iTerm2, and Warp.
Common Issues and Troubleshooting
Encountering issues? Here are some quick fixes:
  • Fonts Not Displaying Correctly? Make sure you’ve installed and set a Nerd Font in your terminal settings.
  • Prompt Not Updating? Ensure you’ve saved your changes and restarted your terminal.
  • Configuration Errors? Double-check the TOML syntax. Missing quotes or brackets can cause the configuration to fail.
 
Additionally you can add zsh-autosuggestions, zsh-syntax-highlighting, and zsh-you-should-use, here is installation instructions using Homebrew and an explanation of compinit.

Neo Tokyo Starship Prompt Update

Zsh Plugins for Enhanced Productivity

  1. zsh-autosuggestions: This plugin suggests commands as you type, based on your command history. It's like having your terminal autocomplete your thoughts!
  1. zsh-syntax-highlighting: Adds colors to your command line input, helping you visually distinguish between valid commands, options, and mistakes.
  1. zsh-you-should-use: Advises on better command alternatives based on your usage patterns, promoting best practices and efficiency.

Installation Instructions with Homebrew

To install these plugins using Homebrew, run the following commands:
brew install zsh-autosuggestions brew install zsh-syntax-highlighting brew install zsh-you-should-use
After installation, add these lines to your .zshrc:
# zsh-autosuggestions source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh # zsh-syntax-highlighting source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh # zsh-you-should-use source $(brew --prefix)/share/zsh-you-should-use/you-should-use.plugin.zsh

Compinit Explanation

compinit is a Zsh function that initializes the completion system, allowing for advanced command autocompletion features. It reads the existing completion definitions and sets up the environment. The -C flag is used to compile completion functions into a binary format, which improves the performance of autocompletion.
Add the following to your .zshrc to enable and optimize completion:
autoload -Uz compinit compinit -C

Starship Configuration

Ensure Starship is initialized as the last line in your .zshrc:
# Optional: Custom Starship configurations export STARSHIP_CACHE=~/.config/starship/cache export STARSHIP_CONFIG=~/.config/starship.toml # Starship prompt initialization - Should be the last line eval "$(starship init zsh)"
By following these steps, you can enjoy a powerful and visually appealing command-line experience tailored to your needs!

Make sure to reload your .zshrc file by running source ~/.zshrc to apply these changes.