In a nutshell the Starship Prompt is a program and a collection of scripts that allows you to customize and enhance the command prompt beyond what it was originally intended for. Not only will you be able to change colors and display special fonts, but add additional qol features useful for people who spend a lot of time working within the command prompt.
To further clarify - when I mentioned the command prompt, I don't just mean the Windows Command Interpretor or PowerShell, I'm also refering to Bash, Zsh, and a few other supported shells thus making Starship Prompt cross-platform. However for the scope of this guide we'll be focusing on the command prompts within the Windows Platform - PowerShell and Cmd.
From the github page below click on "Latest" on the right side of the page. Scroll down to Assets and download the patched fonts you want to use. Hack, InconsolataLGC, Cascadia Code are all good choices.
Unzip the fonts anywhere on your C:\ drive. Then using the Ctrl key, individually select the fonts with "Windows Compatible" in the name, right click and choose "Install for all Users" from the context menu.
Tip: Instead of right clicking on each font file and installing one by one, in the Windows Search bar type in "Windows" and it will automatically show only the fonts with "Windows" in the name. You can then select all the font files and install to "All Users" in one go.
With most recent versions of Windows the Windows Terminal comes pre-installed. If you're using an earlier version of Windows 10 or something older you may need to manually install the Windows Terminal by different means. Assuming you're using a recent version of Windows, open up the Microsoft Store App and verify you have the latest version of Windows Terminal installed.
While you have the Store App open, type in "powershell" in the search bar to install the latest version PowerShell (the icon should look Dark Blue). You also have the option to install the Preview Version of PowerShell which will have new and additional features over the standard versions along with bugfixes.
Open up the Windows Terminal, goto Settings and make the Newer PowerShell the default profile shell. While in Settings click on the newer PowerShell from the left pane and scroll down and click on Appearance. Under Font face, change the font to Hack NF or whichever Nerd font you prefer. Below that change the font size as you may need to enlarge it to atleast 12. You can also scroll down and turn on Transperency to 60 percent or so.
Open up a Powershell in Administrative mode (type powershell in the windows search bar, select "Run as Administrator" from the results pane) and then run the following commands:
>Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser >New-Item -path $profile -type file -force >echo $Profile C:\Users\Stage\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
The last command should show the path to PowerShell's rc file. Which should be located:
%USERPROFILE%\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
This is important as we'll need it to configure PowerShell and other tools needed later. You can close the Administrator PowerShell prompt for now.
Go ahead and now launch Windows Terminal... it should open with the latest PowerShell version. The text should appear nice and clean with the Nerd Fonts we installed earlier.
Run the following commands to install the Starship Prompt along with the tools mentioned earlier:
iwr -useb get.scoop.sh | iex >scoop install aria2 >scoop config aria2-warning-enabled false >scoop install bucket add extras >scoop install extras/vcredist2022 >scoop install starship
Now close Windows Terminal along with PowerShell.
Using your favorite text editor open up %PROFILE%\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
Add the following code to enable Starship:
$ENV:STARSHIP_CONFIG = "$HOME\Documents\PowerShell\starship.toml" Invoke-Expression (&starship init powershell)
Save the changes but leave the rc file open in the editor as well need to edit it again soon.
In the same directory (%PROFILE%\Documents\PowerShell) create another text file and save it as "starship.toml".
This file will be your Starship config file which you'll have the ability to save custom settings.
Again with your favorite text editor you can now add your own settings. Eg:
[character] symbol = "❯" error_symbol = "✗" use_symbol_for_status = true [cmd_duration] min_time = 250 prefix = "underwent "
Launch Windows Terminal again and PowerShell should start with the Starship prompt. Congratulations if you made this far!
Once you use Fzf and PSFzf you'll wonder why you haven't been using it your whole life. It's really good. We'll first need to install a dependency to get everything working properly.
Run this code to install PSReadline:
>Install-Module -Name PSReadline -Scope CurrentUser -Force
Optionally try this alternative command to install PSReadline:
>Install-Module -Name PSReadline -Repository PSGallery -Force
Verify installation of PSReadline:
>Get-Module PSReadline ModuleType Version Name ExportedCommands ---------- ------- ---- ---------------- Script 2.0.0 PSReadLine {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PS...
Install Fzf and PSFzf:
>scoop install fzf psfzf
Verify installation and binary path:
>Get-Command fzf*.exe CommandType Name Version Source ----------- ---- ------- ------ Application fzf.exe 0.0.0.0 C:\Users\Stage\scoop\shims\fzf.exe
>Get-Module PSFzf ModuleType Version PreRelease Name ExportedCommands ---------- ------- ---------- ---- ---------------- Script 2.5.22 PSFzF {Enable-PsFzfAliases, Invoke-FuzzyEdit, Inv…
Go back to the PowerShell rc file and make sure it looks like the following:
# Starship Prompt $ENV:STARSHIP_CONFIG = "$HOME\Documents\PowerShell\starship.toml" Invoke-Expression (&starship init powershell) # PSReadline import-Module PSReadline #Set-PSReadlineOption -EditMode Emacs #Set-PSReadlineOption -BellStyle None #Set-PSReadlineKeyHandler -Chord 'Ctrl+d' -Function DeleteChar Set-PSReadlineOption -PredictionSource History Set-PSReadlineOption -PredictionViewStyle ListView # Fzf import-Module PSFzf Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+f' -PSReadlineChordReverseHistory 'Ctrl+r'
Open up PowerShell and test out Fzf by pressing Ctr+f or Ctr+r.
Clink is very much similar to PSReadline but made specifically to work with the Windows Command Prompt. Just like PSReadline it provides the Readline library features and capabilities to allow Fzf to function.
Install the latest version of Clink with PowerShell:
>scoop install clink clink-completions
Open up a Windows Command prompt and enter the following commands:
>clink inject >clink autorun install
Close and open the Windows Command prompt and you should now see the Clink startup banner.
Every once in a while a new version of Clink will be released. Whenever you launch the Command Prompt a notification will be shown if a new release is available. It should prompt you to update by running "clink update" or you can check anytime by running that same command.
Open up your favorite text editor again, copy and paste the following code. Save the text file as "starship.lua" to Clink's configuration directory "%LOCALAPPDATA%\clink" or "%USERPROFILE%\AppData\Local\clink".
load(io.popen('starship init cmd'):read("*a"))()
Copy your Starship config file (starship.toml) you used for PowerShell before and save it to this same location. Open up the Windows Command prompt and you should now see the Starship prompt. Congratulations!
We've already installed Fzf from the previous step, now we just need to copy the fzf.lua file from Fzf github page to clink's config directory.
Goto https://github.com/chrisant996/clink-fzf and download fzf.lua
Then copy that file into "%LOCALAPPDATA%\clink" directory.
Close and open the Windows Command prompt again, enter the following command:
>clink set fzf.default_bindings true
Press Ctr+f or Ctr+r to test Fzf search function. If that pop's up within the Windows Command prompt window, you're good to go. Congratulations!
>scoop install curl sudo less nano neovim winfetch
Install Git and add Unix tools to your path:
>winget install -e --id Git.Git
Now open up the PowerShell rc file (%USERPROFILE%\Documents\PowerShell\Microsoft.PowerShell_profile.ps1) in your text editor and add the following lines:
# Add Git Unix tools to path $ENV:PATH="$ENV:PATH;C:\Program Files\Git\usr\bin" # Optional aliases Function lsexe {ls.exe --color --group-directories-first --classify} Set-Alias l lsexe Set-Alias grep findstr Set-Alias vim nvim
You can add icons to file types whenever you use ls or dir using Terminal Icons.
>Install-Module -Name Terminal-Icons -Repository PSGallery -Force >Import-Module Terminal-Icons
To make the Icons persistant just edit the PowerShell rc file and add "Import-Module Terminal-Icons".
With the latest versions (and Preview versions) of PowerShell you have the ability to enable and test experimental features. To list these features run the following code:
>Get-ExperimentalFeature
If you see a particular feature you'd like to test run Enable-ExperimentalFeature . Eg:
>Enable-ExperimentalFeature PSCommandNotFoundSuggestion
Starship Official Website
Githubs
- https://github.com/ryanoasis/nerd-fonts
- https://github.com/ScoopInstaller/Scoop
- https://github.com/junegunn/fzf/wiki/Windows
- https://github.com/kelleyma49/PSFzf#psreadline-integration
- https://github.com/chrisant996/clink
- https://github.com/chrisant996/clink-fzf
How to set up PowerShell prompt with Oh My Posh on Windows 11