config/fish/functions/fish_prompt.fish

30 lines
736 B
Fish

function fish_prompt --description 'Write out the prompt'
# Save status code for previous command
set -l last_status $status
# If we're running via SSH, display the hostname
if set -q SSH_TTY
set_color $fish_color_host_remote
echo -n "$hostname "
set_color normal
end
# Print working directory
set_color $fish_color_cwd
echo -n (prompt_pwd)
set_color normal
# Print git information
printf '%s ' (__fish_git_prompt)
# Print status code for previous command, if nonzero
if not test $last_status -eq 0
set_color $fish_color_error
echo -n "[$last_status] "
set_color normal
end
# Print the final character
echo -n "> "
end