Mercurial > dotfiles
changeset 404:b5d54b669b8c
Improve fish config.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 12 Dec 2017 22:10:33 -0800 |
parents | aad209194477 |
children | c05a8f250042 |
files | fish/config.fish |
diffstat | 1 files changed, 40 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- 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