Last active
October 8, 2020 16:41
-
-
Save rvause/f3d95fccae5181aef09fceafe13742bc to your computer and use it in GitHub Desktop.
Simple fish 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
set __fish_git_prompt_showdirtystate 'yes' | |
set __fish_git_prompt_showstashstate 'yes' | |
set __fish_git_prompt_showuntrackedfiles 'yes' | |
set __fish_git_prompt_showupstream 'yes' | |
set __fish_git_prompt_color_branch yellow | |
set __fish_git_prompt_color_upstream_ahead green | |
set __fish_git_prompt_color_upstream_behind red | |
set __fish_git_prompt_color_prefix white | |
set __fish_git_prompt_color_suffix white |
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 -d "Prints left prompt" | |
set -l glyph "=>" | |
set -l glyph_color (set_color brcyan) | |
set -l pwd (basename (prompt_pwd)) | |
set -l pwd_color (set_color bryellow) | |
set -l normal_color (set_color normal) | |
set -l venv_color (set_color blue) | |
if test (id -u "$USER") -eq 0 | |
set glyph "#" | |
end | |
printf "$pwd_color$pwd" | |
printf "%s\n" (__fish_git_prompt) | |
if test -n "$VIRTUAL_ENV" | |
set -l virtualenv (basename "$VIRTUAL_ENV") | |
printf "$normal_color($venv_color$virtualenv$normal_color) " | |
end | |
printf "$glyph_color$glyph $normal_color" | |
end |
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_right_prompt -d "Prints right prompt" | |
set -l last_status $status | |
set -l stat "✔️" | |
if test "$last_status" -ne 0 | |
set stat "❌" | |
end | |
if test $CMD_DURATION | |
set duration (echo "$CMD_DURATION 1000" | awk '{printf "%.3fs", $1 / $2}') | |
printf $duration | |
end | |
printf " $stat" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment