Skip to content

Instantly share code, notes, and snippets.

@pyro2927
Created November 11, 2013 22:24
Show Gist options
  • Save pyro2927/7421595 to your computer and use it in GitHub Desktop.
Save pyro2927/7421595 to your computer and use it in GitHub Desktop.
Fish config
set -U EDITOR vim
set NODE_PATH "/usr/local/lib/node_modules"
set PATH "$EC2_HOME/bin" $PATH
set PATH ".bundle/bin" $PATH
set PATH "/usr/local/bin" $PATH
set PATH "/usr/local/sbin" $PATH
set PATH "/usr/local/share/npm/bin" $PATH
set PATH $HOME/.rbenv/bin $PATH
set PATH $HOME/.rbenv/shims $PATH
rbenv rehash >/dev/null ^&1
. ~/.config/fish/z.fish
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 __fish_git_untracked_file_count
set -l uncomitted (git status --porcelain 2>/dev/null| grep "^M" | wc -l)
set -l not_added (git status --porcelain 2>/dev/null| grep "^ M" | wc -l)
set -l count (git status --porcelain 2>/dev/null| grep "^??" | wc -l)
echo $uncommitted $not_added $count
end
function parse_git_branch
# git branch outputs lines, the current branch is prefixed with a *
set -l branch (git branch --color ^&- | awk '/*/ {print $2}')
echo $branch
end
function __fish_git_in_working_tree
[ "true" = (git rev-parse --is-inside-work-tree ^ /dev/null; or echo false) ]
end
function __fish_git_dirty
not git diff --no-ext-diff --quiet --exit-code ^ /dev/null
or not git diff-index --cached --quiet HEAD ^ /dev/null
or count (git ls-files --others --exclude-standard) > /dev/null
end
function __fish_git_current_head
git symbolic-ref HEAD ^ /dev/null
or git describe --contains --all HEAD
end
function __fish_git_current_branch
__fish_git_current_head | sed -e "s#^refs/heads/##"
end
set normal (set_color normal)
set magenta (set_color magenta)
set yellow (set_color yellow)
set green (set_color green)
set gray (set_color -o black)
set at ↝
set hg_promptstring "< on $magenta<branch>$normal>< $at $yellow<tags|$normal, $yellow>$normal>$green<status|modified|unknown><update>$normal "
function hg_prompt
hg prompt --angle-brackets $hg_promptstring 2>/dev/null
end
function git_prompt
if test -z (git branch -quiet 2>| awk '/fatal:/ {print "no git"}')
printf '%s git%s ↝' (set_color yellow) (set_color normal)
printf '%s %s %s %s %s' (set_color yellow) (__fish_git_current_branch) (parse_git_dirty) (set_color normal)
end
end
function fish_title
if test -z (git branch -quiet 2>| awk '/fatal:/ {print "no git"}')
printf '%s | %s' (prompt_pwd) (__fish_git_current_branch)
else
printf '%s' (prompt_pwd)
end
end
function fish_prompt
z --add "$PWD"
echo
printf '%s%s%s' (set_color cyan) (whoami) (set_color normal)
printf '@'
printf '%s%s%s' (set_color cyan) (hostname|cut -d . -f 1) (set_color normal)
printf ' '
printf '%s%s%s' (set_color $fish_color_cwd) (prompt_pwd) (set_color normal)
git_prompt
# hg_prompt
printf '%s\n'
# figure out what icon to use
switch (date "+%m")
case '1'
printf '🎉 '
case '7'
printf '🇺🇸 '
case '10'
printf '🎃 '
case '11'
printf '🍗 '
case '12'
printf '🎅 '
case '*'
printf 'ॐ '
end
printf (set_color normal)
end
# Directories
alias .. 'cd ..'
alias ... 'cd ../..'
alias .... 'cd ../../..'
alias ..... 'cd ../../../..'
alias md 'mkdir -p'
alias tunnel 'ssh -D localhost:9999 -f cory@maxwell.softwareforgood.com -N'
alias gd 'git diff'
alias gdc 'git diff --cached'
alias gs 'git status'
alias gpr 'git pull --rebase'
alias gprp 'git pull --rebase ; git push'
alias gpu 'git push -u origin'
alias srv 'sudo python -m SimpleHTTPServer 8888'
alias ∆ 'git diff'
alias π 'git pull --rebase ; git push'
alias binstubs 'bundle install --binstubs'
alias bx 'bundle exec'
alias bxr 'bundle exec rake'
alias vu 'vagrant up'
alias vd 'vagrant destroy'
alias vp 'vagrant provision'aliases.fish
#joes aliases
alias cleardupes '/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user'
alias flushdns 'dscacheutil -flushcache'
alias poptime 'diskutil eject /dev/disk2'
alias posthaste 'pbpaste | haste | pbcopy'
alias snapshot 'wget -p -Ppost3 -nH -nd --convert-links'
alias startpostgres 'postgres -D /usr/local/var/postgres'
alias startredis 'redis-server (brew --prefix)/etc/redis.conf'
alias vundle 'vim +BundleInstall +qall'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment