Mercurial > dotfiles
changeset 371:93a174c912ea
Re-add fish config.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 16 Feb 2017 21:45:27 -0800 |
parents | 4cbef98921a8 |
children | c4b8f894bff1 |
files | fish/config.fish |
diffstat | 1 files changed, 149 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fish/config.fish Thu Feb 16 21:45:27 2017 -0800 @@ -0,0 +1,149 @@ + +# Environment variables {{{ + +set -g -x fish_greeting 'Hello.' + +# Homebrew. +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 +set -g -x OS MacOSX +set -g -x EDITOR vim +set -g -x SHELL fish + +# Python. +set -g -x VIRTUAL_ENV_DISABLE_PROMPT 1 + +# Go. +set -g -x GOPATH /usr/local/Cellar/go/1.4/gocode + +# }}} + +# Aliases {{{ + +alias tm 'tmux -u2' + +# }}} + +# Prompt {{{ + +set normal (set_color normal) +set magenta (set_color magenta) +set yellow (set_color yellow) +set green (set_color green) +set gray (set_color -o black) + +function virtualenv_prompt + if set -q VIRTUAL_ENV + set_color -b blue white + printf '(venv:%s)' (basename "$VIRTUAL_ENV") + set_color normal + printf ' ' + end +end + +function prompt_char + if git branch >/dev/null 2>/dev/null + printf '±' ; return + 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 +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 + end +end + +function fish_prompt + set last_status $status + + echo + + # 'username@hostname: ' + set_color magenta + printf '%s' (whoami) + set_color normal + printf '@' + set_color yellow + printf '%s' (hostname|cut -d . -f 1) + set_color normal + printf ': ' + + set_color $fish_color_cwd + printf '%s' (prompt_pwd) + set_color normal + + printf ' ' + prompt_char + printf ' ' + + hg_prompt + + echo + + virtualenv_prompt + + if test $last_status -eq 0 + set_color white -o + printf '> ' + else + set_color red -o + printf '[%d] > ' $last_status + end + + set_color normal +end + +# }}} + +# Directories {{{ + +alias .. 'cd ..' +alias ... 'cd ../..' +alias .... 'cd ../../..' +alias ..... 'cd ../../../..' + +alias md 'mkdir -p' + +# }}} + +# Virtualenv wrapper for Fish {{{ + +eval (python -m virtualfish) + +#set -g VIRTUALFISH_COMPAT_ALIASES # uncomment for virtualenvwrapper-style commands +#. $HOME/.config/fish/virtualfish/virtual.fish +# optional plugins +#. path/to/auto_activation.fish +#. path/to/global_requirements.fish +#. path/to/projects.fish + +# }}} + +# Local Settings {{{ + +if test -s $HOME/.config/fish/local.fish + . $HOME/.config/fish/local.fish +end + +# }}} +