2013-08-27 09:34:55 +08:00
|
|
|
# name: L
|
2013-01-14 00:49:28 +08:00
|
|
|
function _git_branch_name
|
2013-07-10 04:50:56 +08:00
|
|
|
echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
|
2013-01-14 00:49:28 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function _is_git_dirty
|
2013-07-10 04:50:56 +08:00
|
|
|
echo (command git status -s --ignore-submodules=dirty ^/dev/null)
|
2013-01-14 00:49:28 +08:00
|
|
|
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 ' '
|
2013-07-10 04:50:56 +08:00
|
|
|
end
|