comparison fish/config.fish @ 371:93a174c912ea

Re-add fish config.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 16 Feb 2017 21:45:27 -0800
parents
children ff48d206d1f1
comparison
equal deleted inserted replaced
370:4cbef98921a8 371:93a174c912ea
1
2 # Environment variables {{{
3
4 set -g -x fish_greeting 'Hello.'
5
6 # Homebrew.
7 set -g -x PATH /usr/local/sbin $PATH
8 set -g -x PATH /usr/local/bin $PATH
9
10 # My own stuff.
11 set -g -x PATH $HOME/.local/bin $PATH
12 set -g -x PATH $HOME/bin $PATH
13 set -g -x OS MacOSX
14 set -g -x EDITOR vim
15 set -g -x SHELL fish
16
17 # Python.
18 set -g -x VIRTUAL_ENV_DISABLE_PROMPT 1
19
20 # Go.
21 set -g -x GOPATH /usr/local/Cellar/go/1.4/gocode
22
23 # }}}
24
25 # Aliases {{{
26
27 alias tm 'tmux -u2'
28
29 # }}}
30
31 # Prompt {{{
32
33 set normal (set_color normal)
34 set magenta (set_color magenta)
35 set yellow (set_color yellow)
36 set green (set_color green)
37 set gray (set_color -o black)
38
39 function virtualenv_prompt
40 if set -q VIRTUAL_ENV
41 set_color -b blue white
42 printf '(venv:%s)' (basename "$VIRTUAL_ENV")
43 set_color normal
44 printf ' '
45 end
46 end
47
48 function prompt_char
49 if git branch >/dev/null 2>/dev/null
50 printf '±' ; return
51 end
52 if hg root >/dev/null 2>/dev/null
53 printf '☿' ; return
54 end
55 echo '○'
56 end
57
58 function hg_prompt
59 set_color magenta
60 printf '%s' (fast-hg-bookmark 2>/dev/null)
61 set_color normal
62 end
63
64 function git_prompt
65 if git root >/dev/null 2>&1
66 set_color normal
67 printf ' on '
68 set_color magenta
69 printf '%s' (git currentbranch ^/dev/null)
70 set_color green
71 git_prompt_status
72 set_color normal
73 end
74 end
75
76 function fish_prompt
77 set last_status $status
78
79 echo
80
81 # 'username@hostname: '
82 set_color magenta
83 printf '%s' (whoami)
84 set_color normal
85 printf '@'
86 set_color yellow
87 printf '%s' (hostname|cut -d . -f 1)
88 set_color normal
89 printf ': '
90
91 set_color $fish_color_cwd
92 printf '%s' (prompt_pwd)
93 set_color normal
94
95 printf ' '
96 prompt_char
97 printf ' '
98
99 hg_prompt
100
101 echo
102
103 virtualenv_prompt
104
105 if test $last_status -eq 0
106 set_color white -o
107 printf '> '
108 else
109 set_color red -o
110 printf '[%d] > ' $last_status
111 end
112
113 set_color normal
114 end
115
116 # }}}
117
118 # Directories {{{
119
120 alias .. 'cd ..'
121 alias ... 'cd ../..'
122 alias .... 'cd ../../..'
123 alias ..... 'cd ../../../..'
124
125 alias md 'mkdir -p'
126
127 # }}}
128
129 # Virtualenv wrapper for Fish {{{
130
131 eval (python -m virtualfish)
132
133 #set -g VIRTUALFISH_COMPAT_ALIASES # uncomment for virtualenvwrapper-style commands
134 #. $HOME/.config/fish/virtualfish/virtual.fish
135 # optional plugins
136 #. path/to/auto_activation.fish
137 #. path/to/global_requirements.fish
138 #. path/to/projects.fish
139
140 # }}}
141
142 # Local Settings {{{
143
144 if test -s $HOME/.config/fish/local.fish
145 . $HOME/.config/fish/local.fish
146 end
147
148 # }}}
149