Mercurial > dotfiles
annotate .zshrc @ 380:0ceb8554801e
zsh: make vcs info in prompt async
Roughly cribbed from [0], but I'm hoping to rework this soon to use
the zsh async library that shouldn't require a tempfile.
0: http://www.anishathalye.com/2015/02/07/an-asynchronous-shell-prompt/
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Thu, 10 Mar 2016 18:56:28 -0500 |
parents | a7f5b0526a51 |
children | b78aa03c0c00 |
rev | line source |
---|---|
0 | 1 # Augie Fackler's zshrc file |
2 | |
39
62bfb554ab85
Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
3 for file in $(ls $HOME/.shell.d/*.{,z}sh) ; do |
62bfb554ab85
Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
4 source $file |
0 | 5 done |
6 | |
7 # Login greeting ------------------ | |
8 | |
9 if [ ! "$SHOWED_SCREEN_MESSAGE" = "true" ]; then | |
307
e37b00236907
zshrc: work around my shell function that turns on utf8 in screen
Augie Fackler <raf@durin42.com>
parents:
286
diff
changeset
|
10 # Use /bin/which explicitly because we have a shell function |
e37b00236907
zshrc: work around my shell function that turns on utf8 in screen
Augie Fackler <raf@durin42.com>
parents:
286
diff
changeset
|
11 # that confuses the zsh built-in which. |
322
a7f5b0526a51
zshrc: second attempt to make screen message not break
Augie Fackler <raf@durin42.com>
parents:
316
diff
changeset
|
12 if sh -c 'which screen' > /dev/null; then |
39
62bfb554ab85
Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
13 detached_screens=`screen -list | grep Detached | sed -e 's/ (Detached)//'` |
62bfb554ab85
Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
14 if [ ! -z "$detached_screens" ]; then |
62bfb554ab85
Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
15 echo "+---------------------------------------+" |
62bfb554ab85
Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
16 echo "| Detached screens are available: |" |
62bfb554ab85
Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
17 echo "$detached_screens" |
62bfb554ab85
Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
18 echo "+---------------------------------------+" |
62bfb554ab85
Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
19 fi |
62bfb554ab85
Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
20 fi |
62bfb554ab85
Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
21 export SHOWED_SCREEN_MESSAGE="true" |
0 | 22 fi |
23 | |
278
c65cc71d7ba1
zshrc: add a tmux variant of the detached screens message
Augie Fackler <raf@durin42.com>
parents:
39
diff
changeset
|
24 if [ ! "$SHOWED_TMUX_MESSAGE" = "true" ]; then |
c65cc71d7ba1
zshrc: add a tmux variant of the detached screens message
Augie Fackler <raf@durin42.com>
parents:
39
diff
changeset
|
25 if which tmux > /dev/null; then |
286
c7e8311eb2ba
zshrc: suppress stderr from tmux
Augie Fackler <raf@durin42.com>
parents:
278
diff
changeset
|
26 detached_screens=$(tmux ls 2> /dev/null | grep -v attached) |
278
c65cc71d7ba1
zshrc: add a tmux variant of the detached screens message
Augie Fackler <raf@durin42.com>
parents:
39
diff
changeset
|
27 if [ ! -z "$detached_screens" ]; then |
c65cc71d7ba1
zshrc: add a tmux variant of the detached screens message
Augie Fackler <raf@durin42.com>
parents:
39
diff
changeset
|
28 echo "+-----------------------------------------------------------+" |
c65cc71d7ba1
zshrc: add a tmux variant of the detached screens message
Augie Fackler <raf@durin42.com>
parents:
39
diff
changeset
|
29 echo "| Detached tmux sessions are available: |" |
c65cc71d7ba1
zshrc: add a tmux variant of the detached screens message
Augie Fackler <raf@durin42.com>
parents:
39
diff
changeset
|
30 echo "$detached_screens" |
c65cc71d7ba1
zshrc: add a tmux variant of the detached screens message
Augie Fackler <raf@durin42.com>
parents:
39
diff
changeset
|
31 echo "+-----------------------------------------------------------+" |
c65cc71d7ba1
zshrc: add a tmux variant of the detached screens message
Augie Fackler <raf@durin42.com>
parents:
39
diff
changeset
|
32 fi |
c65cc71d7ba1
zshrc: add a tmux variant of the detached screens message
Augie Fackler <raf@durin42.com>
parents:
39
diff
changeset
|
33 fi |
c65cc71d7ba1
zshrc: add a tmux variant of the detached screens message
Augie Fackler <raf@durin42.com>
parents:
39
diff
changeset
|
34 export SHOWED_TMUX_MESSAGE="true" |
c65cc71d7ba1
zshrc: add a tmux variant of the detached screens message
Augie Fackler <raf@durin42.com>
parents:
39
diff
changeset
|
35 fi |
c65cc71d7ba1
zshrc: add a tmux variant of the detached screens message
Augie Fackler <raf@durin42.com>
parents:
39
diff
changeset
|
36 |
0 | 37 # If available, source private extensions stored in a different repo |
38 if [[ -a ~/.private/zshrc ]]; then | |
39 source ~/.private/zshrc | |
40 fi | |
41 | |
42 if [[ -a ~/.zshrc-machine ]]; then | |
39
62bfb554ab85
Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents:
0
diff
changeset
|
43 source ~/.zshrc-machine |
0 | 44 fi |