Mercurial > dotfiles
annotate fish/config.fish @ 407:c6da0c9f40ae
Replace subrepos with an install script. Finally.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 10 Jan 2018 00:00:00 -0800 |
parents | c05a8f250042 |
children | 61f343a2aaff |
rev | line source |
---|---|
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 | |
405
c05a8f250042
Fix Vim colours in tmux on macOS.
Ludovic Chabant <ludovic@chabant.com>
parents:
404
diff
changeset
|
20 set -g -x TERM screen-256color-bce |
371 | 21 |
22 # Python. | |
23 set -g -x VIRTUAL_ENV_DISABLE_PROMPT 1 | |
24 | |
25 # Go. | |
26 set -g -x GOPATH /usr/local/Cellar/go/1.4/gocode | |
27 | |
404 | 28 if type -q git |
29 set -g -x __local_has_git | |
30 end | |
31 if type -q hg | |
32 set -g -x __local_has_hg | |
33 end | |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
405
diff
changeset
|
34 if test -e $HOME/.local/bin/fast-hg-bookmark |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
405
diff
changeset
|
35 set -g -x __local_has_fast_hg_bookmark |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
405
diff
changeset
|
36 end |
404 | 37 |
371 | 38 # }}} |
39 | |
40 # Aliases {{{ | |
41 | |
404 | 42 # Run Tmux in UTF8 and 256 colours always. |
371 | 43 alias tm 'tmux -u2' |
44 | |
45 # }}} | |
46 | |
47 # Prompt {{{ | |
48 | |
49 set normal (set_color normal) | |
50 set magenta (set_color magenta) | |
51 set yellow (set_color yellow) | |
52 set green (set_color green) | |
53 set gray (set_color -o black) | |
54 | |
55 function virtualenv_prompt | |
56 if set -q VIRTUAL_ENV | |
57 set_color -b blue white | |
58 printf '(venv:%s)' (basename "$VIRTUAL_ENV") | |
59 set_color normal | |
60 printf ' ' | |
61 end | |
62 end | |
63 | |
64 function prompt_char | |
404 | 65 if set -q __local_has_git |
66 if git branch >/dev/null 2>/dev/null | |
67 printf '±' ; return | |
68 end | |
69 if hg root >/dev/null 2>/dev/null | |
70 printf '☿' ; return | |
71 end | |
72 echo '○' | |
371 | 73 end |
74 end | |
75 | |
76 function hg_prompt | |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
405
diff
changeset
|
77 if set -q __local_has_hg |
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
405
diff
changeset
|
78 and set -q __local_has_fast_hg_bookmark |
404 | 79 set_color magenta |
80 printf '%s' (fast-hg-bookmark 2>/dev/null) | |
81 set_color normal | |
82 end | |
371 | 83 end |
84 | |
85 function git_prompt | |
404 | 86 if set -q __local_has_git |
87 if git root >/dev/null 2>&1 | |
88 set_color normal | |
89 printf ' on ' | |
90 set_color magenta | |
91 printf '%s' (git currentbranch ^/dev/null) | |
92 set_color green | |
93 git_prompt_status | |
94 set_color normal | |
95 end | |
371 | 96 end |
97 end | |
98 | |
99 function fish_prompt | |
100 set last_status $status | |
101 | |
102 echo | |
103 | |
104 # 'username@hostname: ' | |
105 set_color magenta | |
106 printf '%s' (whoami) | |
107 set_color normal | |
108 printf '@' | |
109 set_color yellow | |
110 printf '%s' (hostname|cut -d . -f 1) | |
111 set_color normal | |
112 printf ': ' | |
113 | |
114 set_color $fish_color_cwd | |
115 printf '%s' (prompt_pwd) | |
116 set_color normal | |
117 | |
118 printf ' ' | |
119 prompt_char | |
120 printf ' ' | |
121 | |
122 hg_prompt | |
123 | |
124 echo | |
125 | |
126 virtualenv_prompt | |
127 | |
128 if test $last_status -eq 0 | |
129 set_color white -o | |
130 printf '> ' | |
131 else | |
132 set_color red -o | |
133 printf '[%d] > ' $last_status | |
134 end | |
135 | |
136 set_color normal | |
137 end | |
138 | |
139 # }}} | |
140 | |
141 # Directories {{{ | |
142 | |
143 alias .. 'cd ..' | |
144 alias ... 'cd ../..' | |
145 alias .... 'cd ../../..' | |
146 alias ..... 'cd ../../../..' | |
147 | |
148 alias md 'mkdir -p' | |
149 | |
150 # }}} | |
151 | |
152 # Local Settings {{{ | |
153 | |
154 if test -s $HOME/.config/fish/local.fish | |
155 . $HOME/.config/fish/local.fish | |
156 end | |
407
c6da0c9f40ae
Replace subrepos with an install script. Finally.
Ludovic Chabant <ludovic@chabant.com>
parents:
405
diff
changeset
|
157 #eval (/usr/local/bin/python -m virtualfish) |
371 | 158 |
159 # }}} | |
160 |