oh-my-fish/themes/l/fish_prompt.fish
2013-01-13 16:49:28 +00:00

28 lines
630 B
Fish

function _git_branch_name
echo (git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
end
function _is_git_dirty
echo (git status -s --ignore-submodules=dirty ^/dev/null)
end
function fish_prompt
set -l blue (set_color blue)
set -l green (set_color green)
set -l normal (set_color normal)
set -l arrow "λ"
set -l cwd $blue(basename (prompt_pwd))
if [ (_git_branch_name) ]
set git_info $green(_git_branch_name)
set git_info ":$git_info"
if [ (_is_git_dirty) ]
set -l dirty "*"
set git_info "$git_info$dirty"
end
end
echo -n -s $cwd $git_info $normal ' ' $arrow ' '
end