fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
beb32f3ab
master
1# Based on the Darc hub ``darcs-fish`` repositories of raichoo & toastal 2 3# For a Darcs-themed prompt try: 4# set fish_color_darcs_normal $__darcs_logo_color 5set -g __darcs_logo_color 72ff01 6# Basic green preferred to clash less with terminal emulator theming 7set -g fish_color_darcs_normal green 8set -g fish_color_darcs_rebasing yellow 9# Conflicts are a critical state that should be resolved 10set -g fish_color_darcs_conflict red 11 12# Darcs doesn’t have branches/channels so just showing the VCS name is more 13# consistent with having text as other VCS prompts do 14set -g fish_prompt_darcs_name darcs 15set -g fish_prompt_darcs_status_added'+' 16set -g fish_prompt_darcs_status_removed - 17set -g fish_prompt_darcs_status_modified'*' 18set -g fish_prompt_darcs_status_moved'→' 19set -g fish_prompt_darcs_status_conflict'!' 20set -g fish_prompt_darcs_status_untracked'…' 21 22set -g fish_prompt_darcs_status_order added removed modified moved conflict untracked 23 24function fish_darcs_prompt --description"Prompt function for Darcs" 25# No Darcs, no prompt 26command -sq darcs|| return 1 27# The _darcs metadata directory, must be exist 28darcs show repo> /dev/null2>&1 || return 1 29 30set -l added0 31set -l modified0 32set -l removed0 33set -l moved0 34set -l untracked0 35set -l conflict0 36 37for state_linein ( darcs status --machine-readable2>&1 ) 38set -l parts( string split' ' --" $state_line " ) 39switch $parts [ 1 ] 40case Rebase 41set rebase$parts [ 4 ] 42case A 43set added( math " $added + 1" ) 44case M 45set modified( math " $modified + 1" ) 46case R 47set removed( math " $removed + 1" ) 48case F 49set moved( math " $moved + 1" ) 50case a 51set untracked( math " $untracked + 1" ) 52case '!' 53set conflict( math " $conflict + 1" ) 54end 55end 56 57set_color normal 58echo -n'(' 59if set -q rebase 60set_color $fish_color_darcs_rebasing 61else if test " $conflict " -gt 0 62set_color $fish_color_darcs_conflict 63else 64set_color $fish_color_darcs_normal 65end 66echo -n$fish_prompt_darcs_name 67set_color normal 68if set -q rebase 69echo -n"[ $rebase ]" 70end 71 72set -l sep 73if string length -q --" $fish_prompt_darcs_name " 74set sep'|' 75end 76for statin $fish_prompt_darcs_status_order 77set -l count$$stat 78if test " $count " -gt 0 79echo -n" $sep " 80set -l color_var fish_color_darcs_$stat 81if set -q$color_var 82set_color $$color_var 83end 84echo -n" $count " 85set -l symbol_var fish_prompt_darcs_status_$stat 86echo -n" $$symbol_var " 87set_color normal 88set sep / 89end 90end 91set_color normal 92echo -n')' 93end