Skip to content

Instantly share code, notes, and snippets.

@sent-hil
Last active December 17, 2015 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sent-hil/5519997 to your computer and use it in GitHub Desktop.
Save sent-hil/5519997 to your computer and use it in GitHub Desktop.
Fish shell config
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 __git_cb
set __git_cb ":"(set_color brown)(git branch ^/dev/null | grep \* | sed 's/* //')(set_color normal)""
end
switch $USER
case root
if not set -q __fish_prompt_cwd
if set -q fish_color_cwd_root
set -g __fish_prompt_cwd (set_color $fish_color_cwd_root)
else
set -g __fish_prompt_cwd (set_color $fish_color_cwd)
end
end
printf '%s:%s%s%s%s# ' $USER $__fish_prompt_hostname "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal" $__git_cb
case '*'
if not set -q __fish_prompt_cwd
set -g __fish_prompt_cwd (set_color $fish_color_cwd)
end
printf '%s:%s%s%s%s$ ' $USER $__fish_prompt_hostname "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal" $__git_cb
end
end
if status --is-login
#set PATH /usr/local/go-tip/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /usr/local/sbin
#set GOROOT /usr/local/Cellar/go/1.0.3
#set GOBIN /usr/local/bin/go/go
end
function rvm -d 'Ruby enVironment Manager'
set -l rvm_script ''
if test -e /usr/local/rvm/scripts/rvm
set rvm_script /usr/local/rvm/scripts/rvm
end
if test -e $HOME/.rvm/scripts/rvm
set rvm_script $HOME/.rvm/scripts/rvm
end
set -l env_file (mktemp -t rvm.fish.XXXXXXXXXX)
bash -c 'source '$rvm_script'; rvm "$@"; status=$?; env > "$0"; exit $status' $env_file $argv
and eval (grep '^rvm\|^[^=]*PATH' $env_file | grep -v _clr | sed '/^[^=]*PATH/y/:/ /; s/^/set -xg /; s/=/ /; s/$/ ;/; s/(//; s/)//')
rm -f $env_file
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment