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