From 54a0494bae2c91ad7da43cd2c97238f6dfa471f6 Mon Sep 17 00:00:00 2001 From: Perry Huang Date: Sat, 15 Mar 2014 04:22:07 -0500 Subject: [PATCH] Add perryh theme. Add README. --- themes/perryh/README.md | 5 ++++ themes/perryh/fish_prompt.fish | 43 ++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 themes/perryh/README.md create mode 100644 themes/perryh/fish_prompt.fish diff --git a/themes/perryh/README.md b/themes/perryh/README.md new file mode 100644 index 0000000..68f5f6a --- /dev/null +++ b/themes/perryh/README.md @@ -0,0 +1,5 @@ +## perryh + +This is similar to godfat's gitstatus theme, but mainly includes red, white, cyan, and yellow. + +![perryh](http://perryhuang.com/stuff/perryh_fish.png) diff --git a/themes/perryh/fish_prompt.fish b/themes/perryh/fish_prompt.fish new file mode 100644 index 0000000..4e899d3 --- /dev/null +++ b/themes/perryh/fish_prompt.fish @@ -0,0 +1,43 @@ +# name: perry +# Works best in a black or dark terminal background. +# https://github.com/perryh/oh-my-fish +# Mostly copied from: https://github.com/godfat/fish_prompt-gitstatus + +function _git_branch_name + echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||') +end + +function _git_status_symbol + set -l git_status (git status --porcelain ^/dev/null) + if test -n "$git_status" + # Is there anyway to preserve newlines so we can reuse $git_status? + if git status --porcelain ^/dev/null | grep '^.[^ ]' >/dev/null + echo '*' # dirty + else + echo '#' # all staged + end + else + echo '' # clean + end +end + +function _remote_hostname + set -l red (set_color -o red) + set -l white (set_color -o white) + + echo $white(whoami)$red@$white(hostname) +end + +function fish_prompt + set -l red (set_color -o red) + set -l cyan (set_color -o cyan) + set -l yellow (set_color -o yellow) + set -l cwd (set_color $fish_color_cwd)(prompt_pwd) + set -l git_status (_git_status_symbol)(_git_branch_name) + + if test -n "$git_status" + set git_status " $git_status" + end + + echo -n (_remote_hostname)$red':'$cyan$cwd$yellow$git_status$red'➜ ' +end