A fancy two-line prompt for the fish shell (https://github.com/fish-shell/fish-shell) with git integration
December 30, 2024 · View on GitHub
function fish_prompt
Set colors
set -l red (set_color red) set -l blue (set_color blue) set -l yellow (set_color yellow) set -l normal (set_color normal)
Get username, hostname, job count, and current directory
set -l user (whoami) set -l host (hostname) set -l jobs (jobs | count) set -l cwd (pwd)
Build the prompt
echo -n "normalred :: hostnormalred )-[ cwd$red ]"
Get the git branch/ref (if in a git repository)
set -l git_branch (git rev-parse --abbrev-ref HEAD 2>/dev/null)
Show the current git ref (if in a git repository)
if test -n "bluered )" end
echo
echo -n "normal" end