# HG changeset patch # User Ludovic Chabant # Date 1513145433 28800 # Node ID b5d54b669b8c25f9ce02f2bbece0f78f7b725b09 # Parent aad209194477d4e45b2ae9c2abd6cce0a790ddf5 Improve fish config. diff -r aad209194477 -r b5d54b669b8c fish/config.fish --- a/fish/config.fish Tue Dec 12 22:10:14 2017 -0800 +++ b/fish/config.fish Tue Dec 12 22:10:33 2017 -0800 @@ -4,12 +4,16 @@ set -g -x fish_greeting 'Hello.' # Homebrew. -set -g -x PATH /usr/local/sbin $PATH -set -g -x PATH /usr/local/bin $PATH +#set -g -x PATH /usr/local/sbin $PATH +#set -g -x PATH /usr/local/bin $PATH # My own stuff. -set -g -x PATH $HOME/.local/bin $PATH -set -g -x PATH $HOME/bin $PATH +if test -d $HOME/.local/bin + set -g -x PATH $HOME/.local/bin $PATH +end +if test -d $HOME/bin + set -g -x PATH $HOME/bin $PATH +end set -g -x OS MacOSX set -g -x EDITOR vim set -g -x SHELL fish @@ -20,10 +24,18 @@ # Go. set -g -x GOPATH /usr/local/Cellar/go/1.4/gocode +if type -q git + set -g -x __local_has_git +end +if type -q hg + set -g -x __local_has_hg +end + # }}} # Aliases {{{ +# Run Tmux in UTF8 and 256 colours always. alias tm 'tmux -u2' # }}} @@ -46,30 +58,36 @@ end function prompt_char - if git branch >/dev/null 2>/dev/null - printf '±' ; return + if set -q __local_has_git + if git branch >/dev/null 2>/dev/null + printf '±' ; return + end + if hg root >/dev/null 2>/dev/null + printf '☿' ; return + end + echo '○' end - if hg root >/dev/null 2>/dev/null - printf '☿' ; return - end - echo '○' end function hg_prompt - set_color magenta - printf '%s' (fast-hg-bookmark 2>/dev/null) - set_color normal + if set -q __local_has_hg + set_color magenta + printf '%s' (fast-hg-bookmark 2>/dev/null) + set_color normal + end end function git_prompt - if git root >/dev/null 2>&1 - set_color normal - printf ' on ' - set_color magenta - printf '%s' (git currentbranch ^/dev/null) - set_color green - git_prompt_status - set_color normal + if set -q __local_has_git + if git root >/dev/null 2>&1 + set_color normal + printf ' on ' + set_color magenta + printf '%s' (git currentbranch ^/dev/null) + set_color green + git_prompt_status + set_color normal + end end end @@ -128,7 +146,7 @@ # Virtualenv wrapper for Fish {{{ -eval (/usr/local/bin/python2.7 -m virtualfish) +#eval (python -m virtualfish) #set -g VIRTUALFISH_COMPAT_ALIASES # uncomment for virtualenvwrapper-style commands #. $HOME/.config/fish/virtualfish/virtual.fish