aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/tools
diff options
context:
space:
mode:
authorGravatar Fernando Manfredi <contact@acidhub.click>2015-07-11 01:06:31 -0300
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2015-07-12 14:22:18 -0700
commit1e32f9431db86db6b34693a76a7fa2d80320df84 (patch)
treef9b52da4ede435b6ff0f2976f7eb8b9ecbf80b99 /share/tools
parent4a3cda1495383d7ba786e2d10f21ff27fa1f01e0 (diff)
:+1: New sample prompt from Acidhub
New sample prompt from Acidhub (github.com/acidhub) This prompt show user|path (full), and a small symbol to show last command status. If in a git repository, it's show after the path several symbols to indicate the branch status and the branch name. Very handy to me so far. Signed-off-by: Fernando Manfredi <contact@acidhub.click>
Diffstat (limited to 'share/tools')
-rw-r--r--share/tools/web_config/sample_prompts/acidhub.fish67
1 files changed, 67 insertions, 0 deletions
diff --git a/share/tools/web_config/sample_prompts/acidhub.fish b/share/tools/web_config/sample_prompts/acidhub.fish
new file mode 100644
index 00000000..45a7223e
--- /dev/null
+++ b/share/tools/web_config/sample_prompts/acidhub.fish
@@ -0,0 +1,67 @@
+# name: Acidhub
+# author: Acidhub - https://acidhub.click/
+
+function fish_prompt -d "Write out the prompt"
+ set laststatus $status
+ 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
+ if [ (_git_branch_name) ]
+ set -l git_branch (set_color -o blue)(_git_branch_name)
+ if [ (_is_git_dirty) ]
+ for i in (git branch -qv --no-color|grep \*|cut -d' ' -f4-|cut -d] -f1|tr , \n)\
+ (git status --porcelain | cut -c 1-2 | uniq)
+ switch $i
+ case "*[ahead *"
+ set git_status "$git_status"(set_color red)⬆
+ case "*behind *"
+ set git_status "$git_status"(set_color red)⬇
+ case "."
+ set git_status "$git_status"(set_color green)✚
+ case " D"
+ set git_status "$git_status"(set_color red)✖
+ case "*M*"
+ set git_status "$git_status"(set_color green)✱
+ case "*R*"
+ set git_status "$git_status"(set_color purple)➜
+ case "*U*"
+ set git_status "$git_status"(set_color brown)═
+ case "??"
+ set git_status "$git_status"(set_color red)≠
+ end
+ end
+ else
+ set git_status (set_color green):
+ end
+ set git_info "(git$git_status$git_branch"(set_color white)")"
+ end
+ set_color -b black
+ printf '%s%s%s%s%s%s%s%s%s%s%s%s%s'\
+ (set_color -o white) \
+ '❰' \
+ (set_color green) \
+ $USER \
+ (set_color white) \
+ '❙' \
+ (set_color yellow) \
+ (echo $PWD | sed -e "s|^$HOME|~|") \
+ (set_color white) \
+ $git_info \
+ (set_color white) \
+ '❱' \
+ (set_color white)
+ if test $laststatus -eq 0
+ printf "%s✔%s≻%s " \
+ (set_color -o green)\
+ (set_color white) \
+ (set_color normal)
+ else
+ printf "%s✘%s≻%s " \
+ (set_color -o red) \
+ (set_color white) \
+ (set_color normal)
+ end
+end