Skip to content

Instantly share code, notes, and snippets.

@nautilebleu
Created June 10, 2012 13:51
Show Gist options
  • Save nautilebleu/2905720 to your computer and use it in GitHub Desktop.
Save nautilebleu/2905720 to your computer and use it in GitHub Desktop.
Fish config for Python and current git branch display on MacOS X with Homebrew
#
# Environment variables
#
# set PATH and PYTHONPATH to use Homebrew
set PATH /usr/local/Cellar /usr/local/bin /usr/local/sbin /usr/local/share/python $PATH
set PYTHONPATH /usr/local/lib/python $PYTHONPATH
set BROWSER 'open'
#
# Aliases
#
function ll -d "List directory content with more infos"
ls -ali
end
function mongo-start -d "Start Mongo"
mongod run --config /usr/local/etc/mongod.conf
end
function nginx-start -d "Start nginx"
sudo /usr/local/sbin/nginx
end
function nginx-stop -d "Stop nginx"
sudo kill (command cat /usr/local/var/run/nginx.pid);
end
function pg-start -d "Start Postgres"
sudo -u _postgres pg_ctl -D /usr/local/var/postgres start
end
function pg-stop -d "Stop Postgres"
sudo -u _postgres pg_ctl -m fast -D /usr/local/var/postgres stop
end
function rabbit-start -d "Start RabbitMQ"
rabbitmq-server -detached
end
#
# Shell enhancements
#
# Display current git branch https://gist.github.com/2902198
set fish_git_dirty_color red
function parse_git_dirty
git diff --quiet HEAD ^&-
if test $status = 1
echo (set_color $fish_git_dirty_color)"Δ"(set_color normal)
end
end
function parse_git_branch
# git branch outputs lines, the current branch is prefixed with a *
set -l branch (git rev-parse --abbrev-ref HEAD)
echo $branch (parse_git_dirty)
end
function fish_prompt
if test -z (git branch --quiet 2>| awk '/fatal:/ {print "no git"}')
printf '%s@%s %s%s%s (%s) $ ' (whoami) (hostname|cut -d . -f 1) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal) (parse_git_branch)
else
printf '%s@%s %s%s%s $ ' (whoami) (hostname|cut -d . -f 1) (set_color $fish_color_cwd) (prompt_pwd) (set_color normal)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment