Skip to content

Instantly share code, notes, and snippets.

@rnorth
Forked from jonathanmarvens/pure-theme.fish
Last active May 4, 2016 20:45
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rnorth/267835865a173b587fb0 to your computer and use it in GitHub Desktop.
Save rnorth/267835865a173b587fb0 to your computer and use it in GitHub Desktop.
Pure themed prompt for Fish shell, with display of last command duration and time of day
###########################################
# Copyright (c) 2014 Jonathan Barronville #
# Minor tweaks by Richard North #
# License: MIT. #
###########################################
function fish_prompt
set last_command_status $status
echo ''
set_color green
echo -n (echo $PWD | sed 's|^'$HOME'\(.*\)$|~\1|')
set_color normal
set git_directory (git rev-parse --git-dir ^/dev/null)
if test $status = 0
echo -n ' '
set_color 777
set git_branch (git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
if test $status = 0
echo -n 'git$'$git_branch
else
echo -n 'git$%unknown%'
end
set -e git_branch
set_color normal
git diff --ignore-submodules --quiet HEAD
if test $status = 1
set_color cyan
echo -n '*'
set_color normal
end
if test $git_directory != '.git'
set_color 444
echo -n '['
set_color 555
echo -n (echo $git_directory | sed 's|^'$HOME'\(.*\)$|~\1|')/
set_color 444
echo -n ']'
set_color normal
end
end
set -e git_directory
if test "$CMD_DURATION" != ""
set_color yellow
echo -n " $CMD_DURATION"
end
echo ''
if test $last_command_status = 0
set_color green
else
set_color red
end
echo -n '❯'
set_color normal
echo -n ' '
end
function fish_right_prompt
set_color white
date '+%H:%M:%S'
echo -n ' '
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment