A cross-shell prompt configuration for my terminal with consistent icons and git status across shells
- A terminal (of course)
- Starship installed in shell (see below)
- A Nerd Font installed (e.g., JetBrainsMono Nerd Font)
1. Download and install any NerdFont and select in your terminal of choice
PowerShell (Windows):
choco install starshipLinux:
curl -sS https://starship.rs/install.sh | sh- PowerShell (Windows)
Run these:
# Allow local scripts to run
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
# Fix profile file encoding (preserves icons)
$ProfileContent = Get-Content $PROFILE
$ProfileContent | Set-Content $PROFILE -Encoding UTF8Then run:
# Use your preferrred code editor. Example uses VS code
code $PROFILEAdd the contents of Microsoft.Powershell_profile.ps1 to the opened file and save
- Linux: Add the contents of .bashrc to your .bashrc or .zshrc, followed by either of these:
.bashrc:
PROMPT_COMMAND="update_dir_icon;$PROMPT_COMMAND".zshrc:
precmd() {
update_dir_icon
}
Then run this
# or .zshrc
source .bashrc- PowerShell (Windows)
# Use your preferrred code editor. Example uses VS code
code "$env:USERPROFILE\.config\starship.toml"- Linux:
# Use your preferrred code editor. Example uses Vim
vim ~/.config/starship.tomlCopy the starship.toml config here, paste in the file and save.
- PowerShell (Windows)
. $PROFILE- Linux:
exec $SHELLIf you use WSL and you want to share the same starship.toml config across all your profiles:
- Place config in a shared location eg:
Windows (PowerShell): C:\Users\YourName\.config\starship.toml
WSL (Linux profiles): Symlink to the Windows file:
mkdir -p ~/.config
ln -sf /mnt/c/Users/YourName/.config/starship.toml ~/.config/starship.toml| Module | Purpose |
|---|---|
| os | Shows OS icon |
| username | Displays current username |
| directory | Shows current folder (truncated to 1 level) |
| git_branch | Shows git branch with icon |
| git_status | Shows git staged or unstaged |
| character | Shows Input prompt character |
| Issue | Solution |
|---|---|
| Icons showing as squares | Install Nerd Font and set in Terminal |
| "Running scripts is disabled" | Set-ExecutionPolicy RemoteSigned -Scope CurrentUser |
| WSL scanning timeout warning | Add scan_timeout = 500 to config |
| Editor terminal missing icons | Set terminal.font_family = "JetBrainsMono Nerd Font" in Editor settings |
starship.toml— Main Starship configurationprofile.ps1— PowerShell profile contents.bashrc— Bash configuration
You should be good to go. If it fails, ask AI or something lol.