Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions fish_prompt.fish
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function fish_prompt
end
end


# Setup colors
set -l normal (set_color normal)
set -l cyan (set_color cyan)
Expand All @@ -25,7 +26,7 @@ function fish_prompt
set -l bwhite (set_color -o white)

# Configure __fish_git_prompt
set -g __fish_git_prompt_show_informative_status true
set -g __fish_git_prompt_use_informative_chars true
set -g __fish_git_prompt_showcolorhints true

# Color prompt char red for non-zero exit status
Expand All @@ -34,12 +35,23 @@ function fish_prompt
set pcolor $bred
end

# Top
echo -n $cyan$USER$normal at $yellow$__fish_prompt_hostname$normal in $bred(prompt_pwd)$normal
__fish_git_prompt
# pieces of the prompt
set -l p_user $USER
set -l p_host $__fish_prompt_hostname
set -l p_pwd (prompt_pwd)
set -l p_git (__fish_git_prompt | sed -e 's/^[[:space:]]*//') # remove leading space https://stackoverflow.com/a/3232433/1412255

echo
set -l full_length (string length "$p_user at $p_host in $p_pwd $p_git")
set -l med_length (string length "$p_pwd $p_git")

if test $COLUMNS -gt $full_length
# Top
echo -n $cyan$p_user$normal at $yellow$p_host$normal in $bred$p_pwd$normal $p_git
echo
else if test $COLUMNS -gt $med_length
echo -n $bred$p_pwd$normal $p_git
echo
end
# Bottom
echo -n $pcolor$__fish_prompt_char $normal
end