Last active
August 29, 2015 14:20
-
-
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
This file contains hidden or 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_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