Skip to content

Instantly share code, notes, and snippets.

@Aldaviva
Last active March 1, 2025 07:40
Show Gist options
  • Save Aldaviva/81dadd20f894f57e050caae7f9b063ad to your computer and use it in GitHub Desktop.
Save Aldaviva/81dadd20f894f57e050caae7f9b063ad to your computer and use it in GitHub Desktop.
Shell prompt styles
set -U fish_color_host FA0
set -U fish_color_host_remote FA0
set -U fish_color_user normal
set -U fish_color_cwd normal
# If you're using the default prompt and don't have ~/.config/fish/functions/fish_prompt.fish, then run:
# fish_config prompt save default
# If that doesn't work and launches a web browser, then you have an older version of Fish, so you can instead run:
# mkdir -p ~/.config/fish/functions && cp /usr/share/fish/functions/fish_prompt.fish ~/.config/fish/functions/fish_prompt.fish
$EDITOR ~/.config/fish/functions/fish_prompt.fish
# Edit the script to change the $suffix value from ">" to "›" on line 10 or 11
# Save this in the path returned by $PROFILE, for example, %USERPROFILE%\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 (different depending on PS version).
# Compatible with both PowerShell 5 (built-in) and 7 (Core, installed separately).
# If the prompt ends with › instead of ›, try encoding this profile file with a UTF8 BOM instead of plain UTF8, to make Windows guess the encoding correctly. Needed on Windows 10, Server 2019, and Server 2022. ANSI(1252) or Windows 11 don't have this problem.
# Documentation:
# https://learn.microsoft.com/en-us/powershell/scripting/learn/shell/creating-profiles?view=powershell-7.5#adding-customizations-to-your-profile
# https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_prompts?view=powershell-7.5
function prompt {
$esc = [char]0x1b
$path = if ($PWD.Path.StartsWith($env:USERPROFILE)) { '~' + $PWD.Path.Substring($env:USERPROFILE.Length) } else { $PWD.Path }
$suffix = if ($NestedPromptLevel -ge 1) { '» ' } else { '› ' }
"$($env:USERNAME.ToLower())@$esc[38;2;255;170;0m$($env:COMPUTERNAME.ToLower())$esc[39;49m $path${suffix}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment