1 |
1 |
2 # You can use fast_hg_root from https://bitbucket.org/yaniv_aknin/fast_hg_root |
|
3 # or maybe use the command false if you don't use Mercurial at all. |
|
4 # (Override in $ZDOTLOCALDIR/zshrc) |
|
5 HG_ROOT_CMD=("hg" "root") |
|
6 export HG_ROOT_CMD |
|
7 |
2 |
8 |
3 |
9 # Enable my Vim-like mode for supported terms |
4 # Enable my Vim-like mode for supported terms |
10 if [[ "$TERM" == "rxvt" || |
5 if [[ "$TERM" == "rxvt" || |
11 "$TERM" == "rxvt-256color" || |
6 "$TERM" == "rxvt-256color" || |
12 "$TERM" == "rxvt-unicode" || |
7 "$TERM" == "rxvt-unicode" || |
13 "$TERM" == "rxvt-unicode-256color" ]] |
8 "$TERM" == "rxvt-unicode-256color" ]] |
14 then |
9 then |
15 export SHOWMODE="on" |
10 export SHOWMODE="on" |
16 fi |
11 fi |
|
12 |
|
13 |
|
14 # __hg_fast_root() |
|
15 # My shell implementation of fast_hg_root. |
|
16 # Please let me now if it can be improved. |
|
17 # Mikael |
|
18 function __hg_fast_root() { |
|
19 local checkdir=$PWD |
|
20 local hgdir=".hg" |
|
21 while [[ ${checkdir} != '/' ]]; do |
|
22 [[ -r ${checkdir} ]] || return 1 |
|
23 [[ -d ${checkdir}/${hgdir} ]] && return 0 |
|
24 checkdir=${checkdir}/.. |
|
25 checkdir="${checkdir:A}" |
|
26 done |
|
27 #[[ ${checkdir} == '/' ]] && return 1 |
|
28 return 1 |
|
29 } |
|
30 |
|
31 # You can use fast_hg_root from https://bitbucket.org/yaniv_aknin/fast_hg_root |
|
32 # or maybe use the command false if you don't use Mercurial at all. |
|
33 # You can also use the actual hg command: HG_ROOT_CMD=("hg" "root") |
|
34 # ... but it will be slow |
|
35 # (Override in $ZDOTLOCALDIR/zshrc) |
|
36 HG_ROOT_CMD=(__hg_fast_root) |
|
37 export HG_ROOT_CMD |
17 |
38 |
18 |
39 |
19 ### Extended prompts |
40 ### Extended prompts |
20 |
41 |
21 function __prompt_path_color { |
42 function __prompt_path_color { |
30 print "%{$path_color%}" |
51 print "%{$path_color%}" |
31 } |
52 } |
32 |
53 |
33 # From http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/ |
54 # From http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/ |
34 function __prompt_char { |
55 function __prompt_char { |
|
56 $HG_ROOT_CMD >/dev/null 2>/dev/null && echo '☿' && return |
35 __gitdir >/dev/null 2>/dev/null && echo '±' && return |
57 __gitdir >/dev/null 2>/dev/null && echo '±' && return |
36 $HG_ROOT_CMD >/dev/null 2>/dev/null && echo '☿' && return |
|
37 echo '○' |
58 echo '○' |
38 } |
59 } |
39 |
60 |
40 function __hg_prompt_info { |
61 function __hg_prompt_info { |
41 $HG_ROOT_CMD >/dev/null 2>/dev/null && |
62 $HG_ROOT_CMD >/dev/null 2>/dev/null && |