Skip to content

Instantly share code, notes, and snippets.

@vallettea
Created December 8, 2015 10:55
Show Gist options
  • Save vallettea/c132734ca339a4143540 to your computer and use it in GitHub Desktop.
Save vallettea/c132734ca339a4143540 to your computer and use it in GitHub Desktop.
My ~/.config/fish/config.fish
########## autojump
begin
set --local AUTOJUMP_PATH $HOME/.autojump/share/autojump/autojump.fish
if test -e $AUTOJUMP_PATH
source $AUTOJUMP_PATH
end
end
########## docker
eval (docker-machine env default)
set -x -g DOCKER_CLIENT_TIMEOUT 800000
########## python
set PATH ~/anaconda/bin/ $PATH
########## node
alias node4="/usr/local/Cellar/node/4.1.1/bin/node"
########## git
set fish_git_dirty_color red
set fish_git_clean_color brown
function parse_git_dirty
if test (git status 2> /dev/null ^&1 | tail -n1) != "nothing to commit (working directory clean)"
echo (set_color $fish_git_dirty_color)
else
echo (set_color $fish_git_clean_color)
end
end
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
if test (git rev-parse --is-inside-work-tree 2> /dev/null | tail -n 1) = 'true' 2> /dev/null
set __git_cb " ("(parse_git_dirty)(git branch ^/dev/null | grep \* | sed 's/* //')(set_color normal)") "
else
set __git_cb ""
end
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%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%s$ ' $USER $__fish_prompt_hostname "$__fish_prompt_cwd" (prompt_pwd) "$__fish_prompt_normal" $__git_cb
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment