Skip to content

Instantly share code, notes, and snippets.

@killercup
Last active December 18, 2015 02:59
Show Gist options
  • Save killercup/5715389 to your computer and use it in GitHub Desktop.
Save killercup/5715389 to your computer and use it in GitHub Desktop.
My Fish Config
. ~/.config/fish/fish_prompt.fish
set fish_greeting '' # turn off greeting
alias vi 'vim'
alias o 'open'
alias wtf 'brew home'
alias pg 'ps aux | grep'
alias fuckthefinder 'sudo killall -KILL appleeventsd'
alias fuckdns 'sudo killall -HUP mDNSResponder'
alias gst 'git status -sb'
set -x PATH /usr/local/bin $PATH # prefer brews
set -x PATH $PATH $HOME/.rvm/bin # Add RVM to PATH for scripting
set -x PATH $HOME/.cabal/bin $PATH # Add CABAL/Haskell to PATH
set -x PATH $PATH /usr/local/share/npm/bin # Add NPM
set -x PATH $PATH /usr/local/lib/luarocks/bin/ # add luarocks
# Exports
set -x LC_ALL en_US.UTF-8
set -x LANG en_US.UTF-8
set -x LANGUAGE en_US.UTF-8
# Set the default prompt command. Make sure that every terminal escape
# string has a newline before and after, so that fish will know how
# long it is.
function fish_prompt --description "Write out the prompt"
# Just calculate these once, to save a few cycles when displaying the prompt
#if not set -q __fish_prompt_hostname
# set -g __fish_prompt_hostname (hostname|cut -d . -f 1)
#end
if not set -q __fish_prompt_normal
set -g __fish_prompt_normal (set_color normal)
end
if not set -q __fish_prompt_cwd
set -g __fish_prompt_cwd (set_color $fish_color_cwd)
end
printf '%s%s:%s%s%s ' (set_color -b 'white' 'black') $USER "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal"
end
function git-compress --description 'compress git repository'
if not test -d '.git'
echo "Current directory is not a git repository."
return -1
end
printf "Size before: "
du -h -d 0 .git | sed -E "s/[[:blank:]]|.git//g"
printf "Compressing..."
git gc 2> /dev/null
and printf "%sOK%s" (set_color green) (set_color normal)
or printf "%sFAILED%s" (set_color red) (set_color normal)
printf "\n"
printf "Size now: "
du -h -d 0 .git | sed -E "s/[[:blank:]]|.git//g"
end
function mcd --description 'make and cd to a directory'
mkdir -p $argv
cd $argv
end
function suvi --description 'sudo vim with user prefs'
sudo vim -u '$HOME/.vimrc' $argv
end
function update --description 'refresh brew'
printf "Pulling..."
brew update > /dev/null
and printf "%sOK%s" (set_color green) (set_color normal)
or printf "%sFAILED%s" (set_color red) (set_color normal)
printf "\n"
brew outdated
end
function upgrade --description 'upgrade some brews and cleanup'
brew upgrade $argv
printf "Cleaning up..."
brew cleanup ^ /dev/null
and printf "%sOK%s" (set_color green) (set_color normal)
or printf "%sFAILED%s" (set_color red) (set_color normal)
printf "\n"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment