Skip to content

HTTPS clone URL

Subversion checkout URL

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