Skip to content

Instantly share code, notes, and snippets.

@jpillora
Last active November 13, 2018 05:46
Show Gist options
  • Save jpillora/dbc57fc1b222a801b7d0 to your computer and use it in GitHub Desktop.
Save jpillora/dbc57fc1b222a801b7d0 to your computer and use it in GitHub Desktop.
Fish Config
set PATH $HOME/bin /usr/local/bin /usr/local/go/bin $PATH
set -x GOPATH $HOME/go
function fish_greeting
end
function fish_prompt
set_color cyan
echo -n $USER
echo -n ' '
set_color $fish_color_cwd
echo -n (prompt_pwd)
set_color normal
echo -n ' '
end
function prompt_pwd --description 'modify pwd to shorten paths, add git branch'
set go "$GOPATH"
set gosrc "$go/src"
set gogh "$gosrc/github.com"
set gojp "$gogh/jpillora"
set wd "$PWD"
for v in "gojp" "gogh" "ord" "gosrc" "go";
if set wd (string replace "$$v" "" "$PWD");
set_color magenta
echo -n "$v"
break
end
end
set wd (string replace "$HOME" "~" "$wd")
set_color green
echo -n "$wd"
set_color normal
if set branch (git rev-parse --abbrev-ref HEAD 2> /dev/null);
echo -n " ("
set_color yellow
echo -n "$branch"
set_color normal
echo -n ")"
end
echo ""
end
function l
exa $argv
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment