NixOS_NoFlake/home/config/fish/functions/fish_prompt.fish

28 lines
794 B
Fish

function fish_prompt
set -l white (set_color white)
set -l brwhite (set_color brwhite)
set -l green (set_color green)
set -l red (set_color red)
set -l blue (set_color blue)
# Line 1: ┌─ [user] @ [host]
echo -s $white"┌─ ["$green$USER$white"] "$brwhite"@ " $white"["$red$hostname$white"]"
# Line 2: ├─ [directory]
set -l full_path (string replace -r "^$HOME" "~" $PWD)
echo -s $white"├─ ["$blue$full_path$white"]"
# Line 3: └─ [(git_branch)] or [$]
echo -n $white"└─ ["
set -l git_info (gitinfo 2>/dev/null)
if test -n "$git_info"
echo -n $git_info
else
echo -n $brwhite"\$"
end
echo -n $white"]"
# Final prompt symbol and reset
echo -n $brwhite" "
set_color normal
end