Skip to content

Instantly share code, notes, and snippets.

@davidmh
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidmh/28916ac17273ba62adda to your computer and use it in GitHub Desktop.
Save davidmh/28916ac17273ba62adda to your computer and use it in GitHub Desktop.
Fish prompt based on the minimal theme from oh-my-zsh. Put following code at the end of ~/.config/fish/config.fish. http://i.imgur.com/o7rOlRv.png
set fish_git_dirty_color red
set fish_git_not_dirty_color white
function parse_git_branch
set -l branch (git branch 2> /dev/null | grep -e '\* ' | sed 's/^..\(.*\)/\1/')
set -l git_status (git status -s)
if test -n "$git_status"
echo (set_color normal)$branch(set_color $fish_git_dirty_color)●(set_color normal)
else
echo (set_color $fish_git_not_dirty_color)$branch(set_color normal)
end
end
function fish_prompt
set -l git_dir (git rev-parse --git-dir 2> /dev/null)
if test -n "$git_dir"
printf '%s%s%s [%s] » ' (set_color $fish_color_cwd) (prompt_pwd) (set_color normal) (parse_git_branch)
else
printf '%s%s%s » ' (set_color $fish_color_cwd) (prompt_pwd) (set_color normal)
end
end
function fish_right_prompt
printf '[%s%s]' (set_color normal) (date +%H:%M:%S)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment