Last active
June 9, 2022 21:01
-
-
Save YamlEngineer/2cece16cb618b6d1a8ae58c6fd7ee2aa to your computer and use it in GitHub Desktop.
Beautiful Fish Shell Prompt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fish_prompt --description 'Write out the prompt' | |
set -l last_status $status | |
set_color green --bold | |
echo -n 'Ξ ' | |
# PWD | |
set_color cyan --bold | |
set fullpath (pwd) | |
if echo $fullpath | grep -q ^/home/ | |
set corrent (pwd | awk -F"/" '{ printf $NF }') | |
set previous (pwd | awk -F"/" '{ printf $(NF-1) }') | |
if [ "home/$USER" = "$previous/$corrent" ] | |
echo -n "~" | |
else | |
if [ $previous = $USER ] | |
set previous "~" | |
end | |
echo -n "$previous/$corrent" | |
end | |
end | |
if ! echo $fullpath | grep -q ^/home/ | |
set corrent (pwd | awk -F"/" '{ printf $NF }') | |
set previous (pwd | awk -F"/" '{ printf $(NF-1) }') | |
if set -q corrent[1] && set -q previous[1] | |
echo -n "$previous/$corrent" | |
else | |
echo -n $fullpath | |
end | |
end | |
set_color blue --bold | |
__terlar_git_prompt | |
fish_hg_prompt | |
if not test $last_status -eq 0 | |
set_color $fish_color_error | |
end | |
set_color green --bold | |
echo -n ' $ ' | |
set_color normal | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment