Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 420 lines (382 sloc) 12.325 kb
88df6f0 @richo Github, whyfor you break multibyte chracter?!
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
121 # This function has a few variables that it throws around.
122 # I'm thinking pretty seriously about building this show into it's own module and calling that, but load times could become an issue
123 #
124 # reTITLE
125 # -------
126 # This is what the title will be set to after this command finishes
127 #
128 # sTITLE
129 # ------
130 # This is the current value of the title "at rest" (Including things like the prefix)
f91b715 @richo Yet more rearranging. Apologies to anyone who was trying to keep in sync
richo authored
131 {
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
132 # Potential TODO:
133 # Set a variable for commands where we care about return status
134 # if returnstatus and $! -> Add something to sTITLE
135 reTITLE=$sTITLE
136 case $1 in
137 # Rails kludges
138 "rails "*)
2405e5c @richo Use shell redirection instead of echo
richo authored
139 work=`sed -e 's/^rails //' <<< $1`
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
140 case $work in
141 "s"|"server")
142 arg="WEBRICK"
143 ;;
144 esac
145 ;;
6738685 @richo Teach the shell stuff about my aliases
richo authored
146 "be"*|"bundle exec"*)
147 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
148 ;;
41edfb3 @richo Show a useful title wen I ./serve
richo authored
149 "./serve"*) # Special case
bb03b03 @richo Let t_prefix take precedence over the pwd when serving
richo authored
150 arg="serve"
151 if [ -z "$t_prefix" ] &&
152 arg="`basename $PWD`: $arg"
153 ;;
aa55d82 @richo Move the cd hook in preexec to it's own specific zsh hook
richo authored
154 "cd"*|"ls"*|"cp"*|"mv"*|"echo"*|"wiki"*|"screen"*|"dig"*|"rm"*|"mkdir"*|"tinfo"*)
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
155 reTITLE=""
156 return ;;
7ad248b @richo clear clears title ( Patch from @onlysamurai )
richo authored
157 "clear"*)
158 arg="zsh";;
4a06c78 @richo Whitespace
richo authored
159
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
160 # If we're doing it to everything, the command is more interesting than
161 # the target
162 *"*")
2405e5c @richo Use shell redirection instead of echo
richo authored
163 arg=$(awk '{print $1}' <<< $1);;
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
164 # Catch kill early
165 "kill "*)
166 reTITLE=""
2405e5c @richo Use shell redirection instead of echo
richo authored
167 arg=$(awk '{print $NF}' <<< $1);;
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
168 "ctags"*|"killall"*|"screen"*)
169 return ;;
170 "tmux"*)
3f9900d @richo Preserve window title hax
richo authored
171 __richo_tmux_hook
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
172 ;;
173 "man"*)
174 arg=$1;;
175 "watchr"*)
176 arg="WATCHR";;
177 # For Source control I want the whole line, I think...
178 "svn"*|"git"*|"hg"*|"cvs"*)
179 arg=$1;;
180
181 "make"*)
182 arg=$(pwd | grep -o "[^/]*/[^/]*$");;
183
184 # TODO Include host
185 "cap"*)
186 # hax
187 #arg=$(echo $1 | grep -o "(deploy[^ ]*)");;
2405e5c @richo Use shell redirection instead of echo
richo authored
188 arg=$(awk '{print $2}' <<< $1);;
e489bc9 @richo Follow the same path for vimpc as ncmpc
richo authored
189 "ncmpc"*|"vimpc"*)
2405e5c @richo Use shell redirection instead of echo
richo authored
190 arg=$(sed $sed_r -e 's/ ?-h */:/' <<< $1);;
4a06c78 @richo Whitespace
richo authored
191
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
192 # Webby stuffs
193 "lynx"*|"links"*)
2405e5c @richo Use shell redirection instead of echo
richo authored
194 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
195
196 "su"*)
197 arg="!root!"
198 export reTITLE=$sTITLE
199 ;;
200 "ssh"*)
2405e5c @richo Use shell redirection instead of echo
richo authored
201 arg=$(awk '{print $NF}' <<< $1)
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
202 # Don't care where in the local fs we are
203 export t_prefix=""
204 export reTITLE=$sTITLE
205 ;;
206 "vim"*)
207 # Vim likes to play funny buggers with my terminal. Show that
208 # bastage who's in charge.
209 export reTITLE=$sTITLE
210 # Don't bother setting a title- handles it.
211 ;;
5565ef3 @richo Now that twat -f is a usable feed parser thing
richo authored
212 "twat"*)
213 arg='twat';;
ffedfa0 @richo Mutt now shows which account you're connected to
richo authored
214 "mutt"*)
215 arg=`awk '{ print $1 ":" $2 }' <<< $1`;;
a64046c @richo Put thor commands in window title more intelligently
richo authored
216 "_thor"*|"thor"*)
eedd226 @richo Added thor titling
richo authored
217 export reTITLE=$sTITLE
2405e5c @richo Use shell redirection instead of echo
richo authored
218 arg=`sed $sed_r -e 's/^_?thor //' -e 's/ /:/' <<< $1`
eedd226 @richo Added thor titling
richo authored
219 if [ -z "$INSCREEN" ]; then
106e3ba @richo Refactor title functions, again for collisions
richo authored
220 __set_urxvt_title "$arg: "
eedd226 @richo Added thor titling
richo authored
221 fi
222 ;;
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
223 *)
2405e5c @richo Use shell redirection instead of echo
richo authored
224 arg=$(awk '{print $NF}' <<< $1);;
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
225 esac
226
106e3ba @richo Refactor title functions, again for collisions
richo authored
227 __set_title $arg
b4a072f @richo Rename this function to avoid potentiall collisions
richo authored
228 }
229 add-zsh-hook preexec __richo_preexec
230 # }}}
f91b715 @richo Yet more rearranging. Apologies to anyone who was trying to keep in sync
richo authored
231 function __richo_chpwd() # {{{
aa55d82 @richo Move the cd hook in preexec to it's own specific zsh hook
richo authored
232 {
9fd1a3b @richo Refactor the hacks to ignore the right files for add
richo authored
233 [ -f .gitignore ] &&
234 __git_ignore_hook
aa55d82 @richo Move the cd hook in preexec to it's own specific zsh hook
richo authored
235 # Clear title if we're going home
236 if [ "$PWD" = "$HOME" ]; then
237 export t_prefix=""
238 arg=$sTITLE
239 else
240 if [ -e .title ]; then
241 export pdir=$PWD
242 # XXX Should this happen for all titles?
243 dTITLE=$(cat .title | sed $sed_r 's/[\r\n]//g')
244 export t_prefix="$dTITLE: "
245 arg=""
246 fi
247 if [ -n "$AUTOTAGS" -a -f .autotags ]; then
248 # TODO
249 # Store some more info about the tags, command to run and
250 # git branch, and use the stat time of the file, rather
251 # than the contents to work out timing
7c0428e @richo Carry on renaming functions
richo authored
252 if [ $((`cat .autotags` + $TAGS_LIFETIME)) -lt `__richo_time` ]; then
253 __richo_time > .autotags
aa55d82 @richo Move the cd hook in preexec to it's own specific zsh hook
richo authored
254 echo "Tags are mad old, regenerating."
282344c @richo Make the background/disown happen in the context of the function
richo authored
255 __richo_bg_tags $PWD
aa55d82 @richo Move the cd hook in preexec to it's own specific zsh hook
richo authored
256 fi
257 fi
258 fi
106e3ba @richo Refactor title functions, again for collisions
richo authored
259 __set_title $arg
aa55d82 @richo Move the cd hook in preexec to it's own specific zsh hook
richo authored
260 }
261 add-zsh-hook chpwd __richo_chpwd
f91b715 @richo Yet more rearranging. Apologies to anyone who was trying to keep in sync
richo authored
262 # }}}
263 function __richo_precmd() # {{{
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
264 {
f91b715 @richo Yet more rearranging. Apologies to anyone who was trying to keep in sync
richo authored
265 vcs_info 'prompt'
266 if [ -n "$reTITLE" -a -n "$INSCREEN" ]; then
267 __set_title $reTITLE
268 export reTITLE=""
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
269 fi
270 }
f91b715 @richo Yet more rearranging. Apologies to anyone who was trying to keep in sync
richo authored
271 add-zsh-hook precmd __richo_precmd
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
272 # }}}
f91b715 @richo Yet more rearranging. Apologies to anyone who was trying to keep in sync
richo authored
273
45fbc73 @richo Add some todo notes for myself
richo authored
274 # XXX I know you want to change this. It doesn't look right. But it breaks old
275 # zsh versions and you just have to live with it until the next debian stable
276 # release.
c1d36fe @richo [[ <condition> && <condition> && <condition> ]] Borks old zsh
richo authored
277 if [[ -n "$SSH_CONNECTION" ]] && [[ "$TERM" =~ "screen" ]] && [[ -z "$TMUX" ]]; then
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
278 export INSCREEN=yes
6fa2574 @richo Localise vars used
richo authored
279 dTITLE=$sHost
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
280 t_prefix="$dTITLE: "
c779788 @richo IUpdate to current api
richo authored
281 __set_title
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
282 fi
283
284 # TODO This is just someone's template, fix.
285 # set formats
952eabd @richo Cleanup
richo authored
286 # %b - branchname | %u - unstagedstr (see below)
287 # %c - stangedstr (see below) | %a - action (e.g. rebase-i)
288 # %R - repository path | %S - path in the repository
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
289 REPO_COLOR=${PR_CYAN}
290 FMT_ACTION="(${PR_CYAN}%a${PR_RESET}%)" # e.g. (rebase-i)
4a06c78 @richo Whitespace
richo authored
291
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
292 # check-for-changes can be really slow.
4a06c78 @richo Whitespace
richo authored
293 # you should disable it, if you work with large repositories
99bf57d @richo Fix zsh always showing git info if you're under a git dir
richo authored
294 zstyle ':vcs_info:*' enable hg bzr svn git
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
295 zstyle ':vcs_info:*:prompt:*' check-for-changes true
fe17aa5 @richo Finally fixed multibyte madness
richo authored
296 zstyle ':vcs_info:*:prompt:*' unstagedstr '¹' # display ¹ if there are unstaged changes
297 zstyle ':vcs_info:*:prompt:*' stagedstr '²' # display ² if there are staged changes
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
298 # Save this for later ³
299 # TODO - Show something if I have unpushed changes.
7c0428e @richo Carry on renaming functions
richo authored
300 function __richo_vcs_init(){
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
301 FMT_BRANCH="${REPO_COLOR}%b${PR_BRIGHT_CYAN}%u%c${PR_RESET}${PR_RED}%m${PR_RESET}"
302 zstyle ':vcs_info:*:prompt:*' actionformats "${FMT_BRANCH}${FMT_ACTION}"
303 zstyle ':vcs_info:*:prompt:*' formats "${FMT_BRANCH}"
4a06c78 @richo Whitespace
richo authored
304 zstyle ':vcs_info:*:prompt:*' nvcsformats "" "%~"
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
305 }
7c0428e @richo Carry on renaming functions
richo authored
306 function __richo_svn_init(){
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
307 SVN_BRANCH="${REPO_COLOR}%b${PR_BRIGHT_CYAN}%u%c${PR_RESET}${PR_RED}%m${PR_RESET}"
308 zstyle ':vcs_info:svn:prompt:*' actionformats "${SVN_BRANCH}${FMT_ACTION}"
309 zstyle ':vcs_info:svn:prompt:*' formats "${SVN_BRANCH}"
310 }
7c0428e @richo Carry on renaming functions
richo authored
311 __richo_vcs_init
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
312
313 # Show remote ref name and number of commits ahead-of or behind
cd3dbb9 @richo Clean up the git hook a bit further
richo authored
314 countl () { wc -l | sed $sed_r -e "s/^ +//" }
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
315 function +vi-git-st() { #{{{
316 local ahead remote msg origin
317 local -a gitstatus
318
319 # Are we on a remote-tracking branch?
320 remote=${$(git rev-parse --verify ${hook_com[branch]}@{upstream} \
321 --symbolic-full-name 2>/dev/null)/refs\/remotes\/}
322
323 msg=""
324
87697ae @richo Always pull git info, even when we don't have a remote
richo authored
325 # for git prior to 1.7
326 # ahead=$(git rev-list origin/${hook_com[branch]}..HEAD | wc -l)
327 origin=$(git rev-list origin/${hook_com[branch]}..HEAD 2>/dev/null | countl)
328 (( $origin )) && msg+="+$origin"
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
329
87697ae @richo Always pull git info, even when we don't have a remote
richo authored
330 ahead=$(git rev-list ${hook_com[branch]}@{upstream}..HEAD 2>/dev/null | countl)
331 (( $ahead )) && msg+="|$ahead|"
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
332
87697ae @richo Always pull git info, even when we don't have a remote
richo authored
333 behind=$(git rev-list HEAD..${hook_com[branch]}@{upstream} 2>/dev/null | countl)
334 (( $behind )) && msg+="-$behind"
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 stashes=$(git stash list 2>/dev/null | countl)
337 if [ "$stashes" -gt 0 ]; then
338 msg+="?${stashes}s"
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
339 fi
87697ae @richo Always pull git info, even when we don't have a remote
richo authored
340
341 #(( $ahead )) && hook_com[misc]+=" (+$ahead)"
342 [ -n "$msg" ] && hook_com[misc]=" ($msg)"
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
343 } #}}}
344 function +vi-svn-nochanges() { #{{{
345 REPO_COLOR="${PR_YELLOW}"
7c0428e @richo Carry on renaming functions
richo authored
346 __richo_svn_init
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
347 zstyle ':vcs_info:svn*+set-message:*' hooks ""
348 } #}}}
349 function +vi-svn-untimeduncommitted() { #{{{
350 v=$(svnversion)
2405e5c @richo Use shell redirection instead of echo
richo authored
351 if grep "M$" > /dev/null 2>&1 <<< $v; then
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
352 hook_com[misc]="**"
353 fi
354 } #}}}
355 function +vi-svn-uncommitted() { #{{{
6fa2574 @richo Localise vars used
richo authored
356 local v=$(timeout $SVNVERSION_TIMEOUT svnversion)
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
357 case $? in
358 124)
359 +vi-svn-nochanges
360 ;;
361 0)
2405e5c @richo Use shell redirection instead of echo
richo authored
362 if grep "M$" > /dev/null 2>&1 <<< $v; then
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
363 hook_com[misc]="**"
364 fi
365 ;;
366 esac
367 } #}}}
368
369 zstyle ':vcs_info:git*+set-message:*' hooks git-st
370 if which timeout >/dev/null; then
371 zstyle ':vcs_info:svn*+set-message:*' hooks svn-uncommitted
372 else
373 zstyle ':vcs_info:svn*+set-message:*' hooks svn-untimeduncommitted
374 fi
375
376 alias nochanges="zstyle ':vcs_info:svn*+set-message:*' hooks svn-nochanges"
377 alias changes="zstyle ':vcs_info:svn*+set-message:*' hooks svn-untimeduncommitted"
378
379 # FIXME!!!
f8f3fa9 @richo Now uses .svnignore and .gitignore to work out what not to commit
richo authored
380 # This is horrid, and I'm clearly knackered. There /is/ an easier way to
381 # replace the newlines with pipe symbols. There is.
9fd1a3b @richo Refactor the hacks to ignore the right files for add
richo authored
382 function __git_ignore_hook() #{{{
383 {
384 local global_ignore=`grep -v "^#" ~/.gitignore | xargs echo | sed -e 's/ /|/g'`
385 [ -f .gitignore ] &&
386 global_ignore+="|`grep -v "^#" .gitignore | xargs echo | sed -e 's/ /|/g'`"
387 zstyle ':completion:*:*:git-add:*' ignored-patterns $global_ignore
388 }
389 [ -f ~/.gitignore ] &&
390 __git_ignore_hook #}}}
391
392 [ -f ~/.subversion/config ] &&
393 zstyle ':completion:*:*:svn-add:*' ignored-patterns \
394 `grep "^global-ignores" ~/.subversion/config | sed -e 's/^.*= //' -e 's/ /|/g'`
395
24c6267 @richo Don't complete to .o and .pyc files
richo authored
396 zstyle ':completion:*:*:vim:*' ignored-patterns '*.o|*.pyc'
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
397 zstyle ':completion:*:functions' ignored-patterns '_*'
398 zstyle ':completion:*:*:kill:*' menu yes select
399 zstyle ':completion:*:kill:*' force-list always
400 # If we're spawning a shell in a urxvt, but we're NOT in shell, put the tty in
401 # the titlebar.
ec0a615 @richo Clean up a test
richo authored
402 if [[ "$TERM" =~ "-256color" && -z "$INSCREEN" ]]; then
106e3ba @richo Refactor title functions, again for collisions
richo authored
403 __set_urxvt_title $rTITLE
aef0fc6 @richo A few files I've quickly checked for sanity
richo authored
404 fi
405
406
fe60a36 @richo Allow for .hostname instead of .local
richo authored
407 [ -e $HOME/.zshrc.$sHost ] && source $HOME/.zshrc.$sHost
49da8fb @richo Experimenting with tmuxinator
richo authored
408 [[ -s $HOME/.tmuxinator/scripts/tmuxinator ]] && source $HOME/.tmuxinator/scripts/tmuxinator
3f9900d @richo Preserve window title hax
richo authored
409
410 if [ -n "$WIN_E" ]; then
411 unset WIN_E
c90610f @richo Start a background process to keep my WM title updated with currently
richo authored
412
413 tty | grep "/0$" > /dev/null &&
414 [ -n =music_watch ] &&
415 music_watch -t &!
416
3f9900d @richo Preserve window title hax
richo authored
417 __richo_tmux_hook
c90610f @richo Start a background process to keep my WM title updated with currently
richo authored
418 tmux
3f9900d @richo Preserve window title hax
richo authored
419 fi
Something went wrong with that request. Please try again.