Created
August 27, 2013 18:34
-
-
Save ashrithr/6357266 to your computer and use it in GitHub Desktop.
Fish prompt with git
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fish_prompt --description 'Write out the prompt' | |
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 | |
set_color yellow | |
printf '%s' (whoami) | |
set_color normal | |
printf ' at ' | |
set_color magenta | |
printf '%s' (hostname|cut -d . -f 1) | |
set_color normal | |
printf ' in ' | |
set_color $fish_color_cwd | |
printf '%s' (prompt_pwd) | |
set_color normal | |
if [ (_git_branch_name) ] | |
set -l cyan (set_color -o cyan) | |
set -l yellow (set_color -o yellow) | |
set -l red (set_color -o red) | |
set -l blue (set_color -o blue) | |
set -l normal (set_color normal) | |
set -l git_branch $red(_git_branch_name) | |
set git_info "$blue git:($git_branch$blue)" | |
if [ (_is_git_dirty) ] | |
set -l dirty "$yellow ✗" | |
set git_info "$git_info$dirty" | |
end | |
printf '%s' $git_info | |
set_color normal | |
end | |
# Line 2 | |
echo | |
if test $VIRTUAL_ENV | |
printf "(%s) " (set_color blue)(basename $VIRTUAL_ENV)(set_color normal) | |
end | |
printf '↪ ' | |
set_color normal | |
end | |
rvm > /dev/null | |
#Alias functions | |
function marked | |
open -a Marked $argv | |
end | |
# Env Variables | |
set -xg AWSCLI_CONFIG_FILE '~/.aws_config.yml' | |
set -xg JAVA_HOME (/usr/libexec/java_home) | |
set -xg SCALA_HOME '/usr/local/opt/scala/idea' | |
set -xg SBT_OPTS '-XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:PermSize=256M -XX:MaxPermSize=512M' | |
# Set PATH variable for homebrew | |
set -xg PATH /usr/local/bin /usr/local/sbin $PATH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment