Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 405 lines (365 sloc) 11.937 kb
88df6f01 » richo
2011-07-28 Github, whyfor you break multibyte chracter?!
1 # #!/usr/bin/env zsh
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
2 # richo '11
3 #
4 # TODO
5 # Document all of the *TITLE variables
6 # Clean up that infrastructure (honestly, I think I either need to learn zsh
7 # modules, or write a seperate program to do it
6738685d » richo
2011-10-21 Teach the shell stuff about my aliases
8 # in a perfect world, the titles should dereference aliases to see what I would
9 # have had to type
1b153820 » richo
2011-09-06 Rearrangement into more logical units
10 # {{{ Colors
f7e08100 » richo
2011-08-18 Refactor colors in zshrc
11 autoload colors
12 colors
1b00edff » richo
2011-08-19 Add more colors
13 for COLOR in RED BLUE GREEN MAGENTA YELLOW WHITE BLACK CYAN; do
f7e08100 » richo
2011-08-18 Refactor colors in zshrc
14 eval PR_$COLOR='%{$fg[${(L)COLOR}]%}'
15 eval PR_BRIGHT_$COLOR='%{$fg_bold[${(L)COLOR}]%}'
16 done
17 PR_RESET="%{${reset_color}%}";
1b153820 » richo
2011-09-06 Rearrangement into more logical units
18 # }}}
f7e08100 » richo
2011-08-18 Refactor colors in zshrc
19
1b153820 » richo
2011-09-06 Rearrangement into more logical units
20 # Source this after colors, in case profile wants to use it (Terrible idea, but
21 # nicer on the eyes)
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
22 source ~/.profile
1b153820 » richo
2011-09-06 Rearrangement into more logical units
23
24 # {{{ completion
25 # rvm completion
926e801a » richo
2011-08-26 Enable rvm completion. Timing is very important!!
26 [[ -r $rvm_path/scripts/zsh/Completion ]] &&
27 fpath=($rvm_path/scripts/zsh/Completion $fpath)
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
28 zstyle :compinstall filename '/home/richo/.zshrc'
1b153820 » richo
2011-09-06 Rearrangement into more logical units
29 autoload -U compinit
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
30 autoload -Uz vcs_info
31 compinit
1b153820 » richo
2011-09-06 Rearrangement into more logical units
32 # }}}
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
33
1b153820 » richo
2011-09-06 Rearrangement into more logical units
34 # {{{ inbuilt prompt hax
35 autoload -U promptinit
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
36 promptinit
37 setopt prompt_subst
38
82f2c383 » richo
2011-08-25 collissions avoidance
39 function __richo_host()
45b1ffd4 » richo
2011-08-18 prompt shows exit status + color
40 {
df75233b » richo
2011-08-19 Older versions of zsh: ${#?} is always = 0
41 local b=$?
42 local n=$((${#b} + 2))
45b1ffd4 » richo
2011-08-18 prompt shows exit status + color
43 echo "$sHost[0,-$n]"
44 }
45
9ea781a4 » richo
2011-08-25 Show something clever for system ruby
46 function __richo_rvm_version()
47 {
48 local v=$(rvm-prompt v g)
49 if [ -z "$v" ]; then
50 echo 'system'
51 else
52 echo $v
53 fi
54 }
55
c377905c » richo
2011-08-30 Reset prompt to avoid blue text if the shell doesn't like RPROMPT
56 PS1="${SHELL_COLOR}%(?.%m.\$(__richo_host) $PR_BRIGHT_RED%?)%b $PR_BRIGHT_BLUE%# $PR_RESET"
ffd4c111 » richo
2011-08-24 Completely refactor prompt generation, zsh handles it all now
57 RPS1="$PR_BRIGHT_BLUE%~ "
58 which rvm-prompt > /dev/null &&
9ea781a4 » richo
2011-08-25 Show something clever for system ruby
59 RPS1+='$PR_BRIGHT_CYAN($(__richo_rvm_version)) '
ffd4c111 » richo
2011-08-24 Completely refactor prompt generation, zsh handles it all now
60 RPS1+='%b$PR_CYAN$vcs_info_msg_0_$PR_BRIGHT_BLUE${ZSH_TIME}$PR_RESET'
1b153820 » richo
2011-09-06 Rearrangement into more logical units
61 # }}}
62
f91b7155 » richo
2011-09-06 Yet more rearranging. Apologies to anyone who was trying to keep in sync
63 # {{{ Misc shell settings
1b153820 » richo
2011-09-06 Rearrangement into more logical units
64 HISTFILE=~/.histfile
65 HISTSIZE=1000
66 SAVEHIST=1000
67 setopt sharehistory
f91b7155 » richo
2011-09-06 Yet more rearranging. Apologies to anyone who was trying to keep in sync
68 setopt histignoredups
118e5a0f » richo
2011-11-04 Someting in my environment has changed, clobber isn't on by default
69 setopt clobber
f91b7155 » richo
2011-09-06 Yet more rearranging. Apologies to anyone who was trying to keep in sync
70 bindkey '^R' history-incremental-search-backward
71 bindkey -v
95525716 » richo
2011-10-07 Continue collecting similar config items
72 [ -n "$TTY" ] &&
73 REPORTTIME=5
f91b7155 » richo
2011-09-06 Yet more rearranging. Apologies to anyone who was trying to keep in sync
74 # }}}
1b153820 » richo
2011-09-06 Rearrangement into more logical units
75
76 function cdp
f91b7155 » richo
2011-09-06 Yet more rearranging. Apologies to anyone who was trying to keep in sync
77 { cd $pdir }
1b153820 » richo
2011-09-06 Rearrangement into more logical units
78
f91b7155 » richo
2011-09-06 Yet more rearranging. Apologies to anyone who was trying to keep in sync
79 # {{{ Helper functions
80 function __richo_time()
81 { date "+%s" }
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
82
f91b7155 » richo
2011-09-06 Yet more rearranging. Apologies to anyone who was trying to keep in sync
83 function __richo_bg_tags()
4bc627a4 » richo
2011-09-16 Don't capture output
84 { (cd $1 && ctags -R -f .newtags . 2>/dev/null && mv .newtags tags) &| }
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
85
f91b7155 » richo
2011-09-06 Yet more rearranging. Apologies to anyone who was trying to keep in sync
86 function __set_title()
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
87 {
f91b7155 » richo
2011-09-06 Yet more rearranging. Apologies to anyone who was trying to keep in sync
88 if [ ! -z $INSCREEN ] ; then
89 echo -ne "\033k$t_prefix$@\033\\"
90 fi
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
91 }
f91b7155 » richo
2011-09-06 Yet more rearranging. Apologies to anyone who was trying to keep in sync
92 function __set_urxvt_title()
191627d5 » richo
2011-07-19 When we create tags automatically, do that in the background
93 {
f91b7155 » richo
2011-09-06 Yet more rearranging. Apologies to anyone who was trying to keep in sync
94 echo -ne "\033]0;$1\007"
191627d5 » richo
2011-07-19 When we create tags automatically, do that in the background
95 }
3f9900db » richo
2011-10-11 Preserve window title hax
96 function __richo_tmux_hook()
97 {
98 case $rTITLE in
99 *"tmux"*)
100 ;;
101 *)
102 export rTITLE="$rTITLE [tmux]"
103 __set_urxvt_title $rTITLE
104 ;;
105 esac
106 }
f91b7155 » richo
2011-09-06 Yet more rearranging. Apologies to anyone who was trying to keep in sync
107 # }}}
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
108
f91b7155 » richo
2011-09-06 Yet more rearranging. Apologies to anyone who was trying to keep in sync
109 function __richo_preexec() # {{{
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
110 # DOCS
111 # This function has a few variables that it throws around.
112 # I'm thinking pretty seriously about building this show into it's own module and calling that, but load times could become an issue
113 #
114 # reTITLE
115 # -------
116 # This is what the title will be set to after this command finishes
117 #
118 # sTITLE
119 # ------
120 # This is the current value of the title "at rest" (Including things like the prefix)
f91b7155 » richo
2011-09-06 Yet more rearranging. Apologies to anyone who was trying to keep in sync
121 {
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
122 # Potential TODO:
123 # Set a variable for commands where we care about return status
124 # if returnstatus and $! -> Add something to sTITLE
125 reTITLE=$sTITLE
126 case $1 in
127 # Rails kludges
128 "rails "*)
2405e5c3 » richo
2011-08-06 Use shell redirection instead of echo
129 work=`sed -e 's/^rails //' <<< $1`
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
130 case $work in
131 "s"|"server")
132 arg="WEBRICK"
133 ;;
134 esac
135 ;;
6738685d » richo
2011-10-21 Teach the shell stuff about my aliases
136 "be"*|"bundle exec"*)
137 arg=`sed $sed_r -e 's/^(be|bundle exec)/BE:/' <<< $1`
6d667a8c » richo
2011-06-27 Show full command (sans bundle exec) for things I run in the bundle env
138 ;;
41edfb30 » richo
2011-10-25 Show a useful title wen I ./serve
139 "./serve"*) # Special case
bb03b031 » richo
2011-11-07 Let t_prefix take precedence over the pwd when serving
140 arg="serve"
141 if [ -z "$t_prefix" ] &&
142 arg="`basename $PWD`: $arg"
143 ;;
aa55d823 » richo
2011-08-18 Move the cd hook in preexec to it's own specific zsh hook
144 "cd"*|"ls"*|"cp"*|"mv"*|"echo"*|"wiki"*|"screen"*|"dig"*|"rm"*|"mkdir"*|"tinfo"*)
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
145 reTITLE=""
146 return ;;
7ad248b7 » richo
2011-08-05 clear clears title ( Patch from @onlysamurai )
147 "clear"*)
148 arg="zsh";;
4a06c78a » richo
2011-10-25 Whitespace
149
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
150 # If we're doing it to everything, the command is more interesting than
151 # the target
152 *"*")
2405e5c3 » richo
2011-08-06 Use shell redirection instead of echo
153 arg=$(awk '{print $1}' <<< $1);;
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
154 # Catch kill early
155 "kill "*)
156 reTITLE=""
2405e5c3 » richo
2011-08-06 Use shell redirection instead of echo
157 arg=$(awk '{print $NF}' <<< $1);;
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
158 "ctags"*|"killall"*|"screen"*)
159 return ;;
160 "tmux"*)
3f9900db » richo
2011-10-11 Preserve window title hax
161 __richo_tmux_hook
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
162 ;;
163 "man"*)
164 arg=$1;;
165 "watchr"*)
166 arg="WATCHR";;
167 # For Source control I want the whole line, I think...
168 "svn"*|"git"*|"hg"*|"cvs"*)
169 arg=$1;;
170
171 "make"*)
172 arg=$(pwd | grep -o "[^/]*/[^/]*$");;
173
174 # TODO Include host
175 "cap"*)
176 # hax
177 #arg=$(echo $1 | grep -o "(deploy[^ ]*)");;
2405e5c3 » richo
2011-08-06 Use shell redirection instead of echo
178 arg=$(awk '{print $2}' <<< $1);;
e489bc98 » richo
2011-09-01 Follow the same path for vimpc as ncmpc
179 "ncmpc"*|"vimpc"*)
2405e5c3 » richo
2011-08-06 Use shell redirection instead of echo
180 arg=$(sed $sed_r -e 's/ ?-h */:/' <<< $1);;
4a06c78a » richo
2011-10-25 Whitespace
181
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
182 # Webby stuffs
183 "lynx"*|"links"*)
2405e5c3 » richo
2011-08-06 Use shell redirection instead of echo
184 arg=$(sed $sed_r -e 's/^(lynx|links) (http[s]?:\/\/)?(www\.)?//' -e 's/\/.*$//' <<< $1);;
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
185
186 "su"*)
187 arg="!root!"
188 export reTITLE=$sTITLE
189 ;;
190 "ssh"*)
2405e5c3 » richo
2011-08-06 Use shell redirection instead of echo
191 arg=$(awk '{print $NF}' <<< $1)
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
192 # Don't care where in the local fs we are
193 export t_prefix=""
194 export reTITLE=$sTITLE
195 ;;
196 "vim"*)
197 # Vim likes to play funny buggers with my terminal. Show that
198 # bastage who's in charge.
199 export reTITLE=$sTITLE
200 # Don't bother setting a title- handles it.
201 ;;
5565ef32 » richo
2011-10-10 Now that twat -f is a usable feed parser thing
202 "twat"*)
203 arg='twat';;
ffedfa0b » richo
2011-10-07 Mutt now shows which account you're connected to
204 "mutt"*)
205 arg=`awk '{ print $1 ":" $2 }' <<< $1`;;
a64046ca » richo
2011-08-01 Put thor commands in window title more intelligently
206 "_thor"*|"thor"*)
eedd2264 » richo
2011-08-01 Added thor titling
207 export reTITLE=$sTITLE
2405e5c3 » richo
2011-08-06 Use shell redirection instead of echo
208 arg=`sed $sed_r -e 's/^_?thor //' -e 's/ /:/' <<< $1`
eedd2264 » richo
2011-08-01 Added thor titling
209 if [ -z "$INSCREEN" ]; then
106e3ba2 » richo
2011-08-18 Refactor title functions, again for collisions
210 __set_urxvt_title "$arg: "
eedd2264 » richo
2011-08-01 Added thor titling
211 fi
212 ;;
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
213 *)
2405e5c3 » richo
2011-08-06 Use shell redirection instead of echo
214 arg=$(awk '{print $NF}' <<< $1);;
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
215 esac
216
106e3ba2 » richo
2011-08-18 Refactor title functions, again for collisions
217 __set_title $arg
b4a072f3 » richo
2011-08-18 Rename this function to avoid potentiall collisions
218 }
219 add-zsh-hook preexec __richo_preexec
220 # }}}
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
221
f91b7155 » richo
2011-09-06 Yet more rearranging. Apologies to anyone who was trying to keep in sync
222 function __richo_chpwd() # {{{
aa55d823 » richo
2011-08-18 Move the cd hook in preexec to it's own specific zsh hook
223 {
224 # Clear title if we're going home
225 if [ "$PWD" = "$HOME" ]; then
226 export t_prefix=""
227 arg=$sTITLE
228 else
229 if [ -e .title ]; then
230 export pdir=$PWD
231 # XXX Should this happen for all titles?
232 dTITLE=$(cat .title | sed $sed_r 's/[\r\n]//g')
233 export t_prefix="$dTITLE: "
234 arg=""
235 fi
236 if [ -n "$AUTOTAGS" -a -f .autotags ]; then
237 # TODO
238 # Store some more info about the tags, command to run and
239 # git branch, and use the stat time of the file, rather
240 # than the contents to work out timing
7c0428ed » richo
2011-08-26 Carry on renaming functions
241 if [ $((`cat .autotags` + $TAGS_LIFETIME)) -lt `__richo_time` ]; then
242 __richo_time > .autotags
aa55d823 » richo
2011-08-18 Move the cd hook in preexec to it's own specific zsh hook
243 echo "Tags are mad old, regenerating."
282344c8 » richo
2011-09-03 Make the background/disown happen in the context of the function
244 __richo_bg_tags $PWD
aa55d823 » richo
2011-08-18 Move the cd hook in preexec to it's own specific zsh hook
245 fi
246 fi
247 fi
106e3ba2 » richo
2011-08-18 Refactor title functions, again for collisions
248 __set_title $arg
aa55d823 » richo
2011-08-18 Move the cd hook in preexec to it's own specific zsh hook
249 }
250 add-zsh-hook chpwd __richo_chpwd
f91b7155 » richo
2011-09-06 Yet more rearranging. Apologies to anyone who was trying to keep in sync
251 # }}}
aa55d823 » richo
2011-08-18 Move the cd hook in preexec to it's own specific zsh hook
252
f91b7155 » richo
2011-09-06 Yet more rearranging. Apologies to anyone who was trying to keep in sync
253 function __richo_precmd() # {{{
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
254 {
f91b7155 » richo
2011-09-06 Yet more rearranging. Apologies to anyone who was trying to keep in sync
255 vcs_info 'prompt'
256 if [ -n "$reTITLE" -a -n "$INSCREEN" ]; then
257 __set_title $reTITLE
258 export reTITLE=""
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
259 fi
260 }
f91b7155 » richo
2011-09-06 Yet more rearranging. Apologies to anyone who was trying to keep in sync
261 add-zsh-hook precmd __richo_precmd
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
262 # }}}
f91b7155 » richo
2011-09-06 Yet more rearranging. Apologies to anyone who was trying to keep in sync
263
45fbc737 » richo
2011-10-12 Add some todo notes for myself
264 # XXX I know you want to change this. It doesn't look right. But it breaks old
265 # zsh versions and you just have to live with it until the next debian stable
266 # release.
c1d36fe0 » richo
2011-10-10 [[ <condition> && <condition> && <condition> ]] Borks old zsh
267 if [[ -n "$SSH_CONNECTION" ]] && [[ "$TERM" =~ "screen" ]] && [[ -z "$TMUX" ]]; then
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
268 export INSCREEN=yes
6fa2574b » richo
2011-08-19 Localise vars used
269 dTITLE=$sHost
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
270 t_prefix="$dTITLE: "
c7797889 » richo
2011-08-24 IUpdate to current api
271 __set_title
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
272 fi
273
274 # TODO This is just someone's template, fix.
275 # set formats
276 # %b - branchname
277 # %u - unstagedstr (see below)
278 # %c - stangedstr (see below)
279 # %a - action (e.g. rebase-i)
280 # %R - repository path
281 # %S - path in the repository
282 REPO_COLOR=${PR_CYAN}
283 # ^^ HAX?
fe17aa53 » richo
2011-12-22 Finally fixed multibyte madness
284 # # e.g. master¹²
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
285 FMT_ACTION="(${PR_CYAN}%a${PR_RESET}%)" # e.g. (rebase-i)
4a06c78a » richo
2011-10-25 Whitespace
286
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
287 # check-for-changes can be really slow.
4a06c78a » richo
2011-10-25 Whitespace
288 # you should disable it, if you work with large repositories
99bf57de » richo
2011-08-31 Fix zsh always showing git info if you're under a git dir
289 zstyle ':vcs_info:*' enable hg bzr svn git
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
290 zstyle ':vcs_info:*:prompt:*' check-for-changes true
fe17aa53 » richo
2011-12-22 Finally fixed multibyte madness
291 zstyle ':vcs_info:*:prompt:*' unstagedstr '¹' # display ¹ if there are unstaged changes
292 zstyle ':vcs_info:*:prompt:*' stagedstr '²' # display ² if there are staged changes
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
293 # Save this for later ³
294 # TODO - Show something if I have unpushed changes.
7c0428ed » richo
2011-08-26 Carry on renaming functions
295 function __richo_vcs_init(){
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
296 FMT_BRANCH="${REPO_COLOR}%b${PR_BRIGHT_CYAN}%u%c${PR_RESET}${PR_RED}%m${PR_RESET}"
297 zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}"
298 zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}"
4a06c78a » richo
2011-10-25 Whitespace
299 zstyle ':vcs_info:*:prompt:*' nvcsformats "" "%~"
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
300 }
7c0428ed » richo
2011-08-26 Carry on renaming functions
301 function __richo_svn_init(){
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
302 SVN_BRANCH="${REPO_COLOR}%b${PR_BRIGHT_CYAN}%u%c${PR_RESET}${PR_RED}%m${PR_RESET}"
303 zstyle ':vcs_info:svn:prompt:*' actionformats "${SVN_BRANCH}${FMT_ACTION}"
304 zstyle ':vcs_info:svn:prompt:*' formats "${SVN_BRANCH}"
305 }
7c0428ed » richo
2011-08-26 Carry on renaming functions
306 __richo_vcs_init
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
307
308 # Show remote ref name and number of commits ahead-of or behind
cd3dbb90 » richo
2011-06-24 Clean up the git hook a bit further
309 countl () { wc -l | sed $sed_r -e "s/^ +//" }
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
310 function +vi-git-st() { #{{{
311 local ahead remote msg origin
312 local -a gitstatus
313
314 # Are we on a remote-tracking branch?
315 remote=${$(git rev-parse --verify ${hook_com[branch]}@{upstream} \
316 --symbolic-full-name 2>/dev/null)/refs\/remotes\/}
317
318 msg=""
319
87697aef » richo
2011-08-30 Always pull git info, even when we don't have a remote
320 # for git prior to 1.7
321 # ahead=$(git rev-list origin/${hook_com[branch]}..HEAD | wc -l)
322 origin=$(git rev-list origin/${hook_com[branch]}..HEAD 2>/dev/null | countl)
323 (( $origin )) && msg+="+$origin"
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
324
87697aef » richo
2011-08-30 Always pull git info, even when we don't have a remote
325 ahead=$(git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | countl)
326 (( $ahead )) && msg+="|$ahead|"
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
327
87697aef » richo
2011-08-30 Always pull git info, even when we don't have a remote
328 behind=$(git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | countl)
329 (( $behind )) && msg+="-$behind"
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
330
87697aef » richo
2011-08-30 Always pull git info, even when we don't have a remote
331 stashes=$(git stash list 2>/dev/null | countl)
332 if [ "$stashes" -gt 0 ]; then
333 msg+="?${stashes}s"
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
334 fi
87697aef » richo
2011-08-30 Always pull git info, even when we don't have a remote
335
336 #(( $ahead )) && hook_com[misc]+=" (+$ahead)"
337 [ -n "$msg" ] && hook_com[misc]=" ($msg)"
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
338 } #}}}
339 function +vi-svn-nochanges() { #{{{
340 REPO_COLOR="${PR_YELLOW}"
7c0428ed » richo
2011-08-26 Carry on renaming functions
341 __richo_svn_init
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
342 zstyle ':vcs_info:svn*+set-message:*' hooks ""
343 } #}}}
344 function +vi-svn-untimeduncommitted() { #{{{
345 v=$(svnversion)
2405e5c3 » richo
2011-08-06 Use shell redirection instead of echo
346 if grep "M$" > /dev/null 2>&1 <<< $v; then
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
347 hook_com[misc]="**"
348 fi
349 } #}}}
350
351 function +vi-svn-uncommitted() { #{{{
6fa2574b » richo
2011-08-19 Localise vars used
352 local v=$(timeout $SVNVERSION_TIMEOUT svnversion)
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
353 case $? in
354 124)
355 +vi-svn-nochanges
356 ;;
357 0)
2405e5c3 » richo
2011-08-06 Use shell redirection instead of echo
358 if grep "M$" > /dev/null 2>&1 <<< $v; then
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
359 hook_com[misc]="**"
360 fi
361 ;;
362 esac
363 } #}}}
364
365 zstyle ':vcs_info:git*+set-message:*' hooks git-st
366 if which timeout >/dev/null; then
367 zstyle ':vcs_info:svn*+set-message:*' hooks svn-uncommitted
368 else
369 zstyle ':vcs_info:svn*+set-message:*' hooks svn-untimeduncommitted
370 fi
371
372 alias nochanges="zstyle ':vcs_info:svn*+set-message:*' hooks svn-nochanges"
373 alias changes="zstyle ':vcs_info:svn*+set-message:*' hooks svn-untimeduncommitted"
374
375 # FIXME!!!
f8f3fa94 » richo
2011-06-24 Now uses .svnignore and .gitignore to work out what not to commit
376 # This is horrid, and I'm clearly knackered. There /is/ an easier way to
377 # replace the newlines with pipe symbols. There is.
4a06c78a » richo
2011-10-25 Whitespace
378 [ -e ~/.gitignore ] &&
fc2ee171 » richo
2011-06-28 Only create these zstyle elements if the source files exist
379 zstyle ':completion:*:*:git-add:*' ignored-patterns `grep -v "^#" ~/.gitignore | xargs echo | sed -e 's/ /|/g'`
380 [ -e ~/.subversion/config ] &&
f0636b93 » richo
2011-07-06 Remogved an extra xargs
381 zstyle ':completion:*:*:svn-add:*' ignored-patterns `grep "^global-ignores" ~/.subversion/config | sed -e 's/^.*= //' -e 's/ /|/g'`
24c6267f » richo
2011-10-18 Don't complete to .o and .pyc files
382 zstyle ':completion:*:*:vim:*' ignored-patterns '*.o|*.pyc'
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
383 zstyle ':completion:*:functions' ignored-patterns '_*'
384 zstyle ':completion:*:*:kill:*' menu yes select
385 zstyle ':completion:*:kill:*' force-list always
386 # If we're spawning a shell in a urxvt, but we're NOT in shell, put the tty in
387 # the titlebar.
ec0a6153 » richo
2011-07-29 Clean up a test
388 if [[ "$TERM" =~ "-256color" && -z "$INSCREEN" ]]; then
106e3ba2 » richo
2011-08-18 Refactor title functions, again for collisions
389 __set_urxvt_title $rTITLE
aef0fc6e » richo
2011-06-21 A few files I've quickly checked for sanity
390 fi
391
392
fe60a366 » richo
2011-06-28 Allow for .hostname instead of .local
393 [ -e $HOME/.zshrc.$sHost ] && source $HOME/.zshrc.$sHost
49da8fba » richo
2011-08-15 Experimenting with tmuxinator
394 [[ -s $HOME/.tmuxinator/scripts/tmuxinator ]] && source $HOME/.tmuxinator/scripts/tmuxinator
3f9900db » richo
2011-10-11 Preserve window title hax
395
396 if [ -n "$WIN_E" ]; then
397 unset WIN_E
c90610f2 » richo
2011-11-18 Start a background process to keep my WM title updated with currently
398
399 tty | grep "/0$" > /dev/null &&
400 [ -n =music_watch ] &&
401 music_watch -t &!
402
3f9900db » richo
2011-10-11 Preserve window title hax
403 __richo_tmux_hook
c90610f2 » richo
2011-11-18 Start a background process to keep my WM title updated with currently
404 tmux
3f9900db » richo
2011-10-11 Preserve window title hax
405 fi
Something went wrong with that request. Please try again.