Mercurial > dotfiles
annotate fish/config.fish @ 405:c05a8f250042
Fix Vim colours in tmux on macOS.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 12 Dec 2017 22:32:30 -0800 |
parents | b5d54b669b8c |
children | c6da0c9f40ae |
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 | |
34 | |
371 | 35 # }}} |
36 | |
37 # Aliases {{{ | |
38 | |
404 | 39 # Run Tmux in UTF8 and 256 colours always. |
371 | 40 alias tm 'tmux -u2' |
41 | |
42 # }}} | |
43 | |
44 # Prompt {{{ | |
45 | |
46 set normal (set_color normal) | |
47 set magenta (set_color magenta) | |
48 set yellow (set_color yellow) | |
49 set green (set_color green) | |
50 set gray (set_color -o black) | |
51 | |
52 function virtualenv_prompt | |
53 if set -q VIRTUAL_ENV | |
54 set_color -b blue white | |
55 printf '(venv:%s)' (basename "$VIRTUAL_ENV") | |
56 set_color normal | |
57 printf ' ' | |
58 end | |
59 end | |
60 | |
61 function prompt_char | |
404 | 62 if set -q __local_has_git |
63 if git branch >/dev/null 2>/dev/null | |
64 printf '±' ; return | |
65 end | |
66 if hg root >/dev/null 2>/dev/null | |
67 printf '☿' ; return | |
68 end | |
69 echo '○' | |
371 | 70 end |
71 end | |
72 | |
73 function hg_prompt | |
404 | 74 if set -q __local_has_hg |
75 set_color magenta | |
76 printf '%s' (fast-hg-bookmark 2>/dev/null) | |
77 set_color normal | |
78 end | |
371 | 79 end |
80 | |
81 function git_prompt | |
404 | 82 if set -q __local_has_git |
83 if git root >/dev/null 2>&1 | |
84 set_color normal | |
85 printf ' on ' | |
86 set_color magenta | |
87 printf '%s' (git currentbranch ^/dev/null) | |
88 set_color green | |
89 git_prompt_status | |
90 set_color normal | |
91 end | |
371 | 92 end |
93 end | |
94 | |
95 function fish_prompt | |
96 set last_status $status | |
97 | |
98 echo | |
99 | |
100 # 'username@hostname: ' | |
101 set_color magenta | |
102 printf '%s' (whoami) | |
103 set_color normal | |
104 printf '@' | |
105 set_color yellow | |
106 printf '%s' (hostname|cut -d . -f 1) | |
107 set_color normal | |
108 printf ': ' | |
109 | |
110 set_color $fish_color_cwd | |
111 printf '%s' (prompt_pwd) | |
112 set_color normal | |
113 | |
114 printf ' ' | |
115 prompt_char | |
116 printf ' ' | |
117 | |
118 hg_prompt | |
119 | |
120 echo | |
121 | |
122 virtualenv_prompt | |
123 | |
124 if test $last_status -eq 0 | |
125 set_color white -o | |
126 printf '> ' | |
127 else | |
128 set_color red -o | |
129 printf '[%d] > ' $last_status | |
130 end | |
131 | |
132 set_color normal | |
133 end | |
134 | |
135 # }}} | |
136 | |
137 # Directories {{{ | |
138 | |
139 alias .. 'cd ..' | |
140 alias ... 'cd ../..' | |
141 alias .... 'cd ../../..' | |
142 alias ..... 'cd ../../../..' | |
143 | |
144 alias md 'mkdir -p' | |
145 | |
146 # }}} | |
147 | |
148 # Virtualenv wrapper for Fish {{{ | |
149 | |
404 | 150 #eval (python -m virtualfish) |
371 | 151 |
152 #set -g VIRTUALFISH_COMPAT_ALIASES # uncomment for virtualenvwrapper-style commands | |
153 #. $HOME/.config/fish/virtualfish/virtual.fish | |
154 # optional plugins | |
155 #. path/to/auto_activation.fish | |
156 #. path/to/global_requirements.fish | |
157 #. path/to/projects.fish | |
158 | |
159 # }}} | |
160 | |
161 # Local Settings {{{ | |
162 | |
163 if test -s $HOME/.config/fish/local.fish | |
164 . $HOME/.config/fish/local.fish | |
165 end | |
166 | |
167 # }}} | |
168 |