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