[from now] 2013/10/07 12:58:42

diff --git a/.zsh/z.sh b/.zsh/z.sh
index 883ed3d..f3d5cea 100755
--- a/.zsh/z.sh
+++ b/.zsh/z.sh
@@ -1,224 +1,935 @@
-# Copyright (c) 2009 rupa deadwyler under the WTFPL license
-
-# maintains a jump-list of the directories you actually use
-#
-# INSTALL:
-#   * put something like this in your .bashrc/.zshrc:
-#     . /path/to/z.sh
-#   * cd around for a while to build up the db
-#   * PROFIT!!
-#   * optionally:
-#     set $_Z_CMD in .bashrc/.zshrc to change the command (default z).
-#     set $_Z_DATA in .bashrc/.zshrc to change the datafile (default ~/.z).
-#     set $_Z_NO_RESOLVE_SYMLINKS to prevent symlink resolution.
-#     set $_Z_NO_PROMPT_COMMAND if you're handling PROMPT_COMMAND yourself.
-#     set $_Z_EXCLUDE_DIRS to an array of directories to exclude.
-#
-# USE:
-#   * z foo     # cd to most frecent dir matching foo
-#   * z foo bar # cd to most frecent dir matching foo and bar
-#   * z -r foo  # cd to highest ranked dir matching foo
-#   * z -t foo  # cd to most recently accessed dir matching foo
-#   * z -l foo  # list matches instead of cd
-#   * z -c foo  # restrict matches to subdirs of $PWD
-
-[ -d "${_Z_DATA:-$HOME/.z}" ] && {
-    echo "ERROR: z.sh's datafile (${_Z_DATA:-$HOME/.z}) is a directory."
-}
-
-_z() {
-
- local datafile="${_Z_DATA:-$HOME/.z}"
-
- # bail out if we don't own ~/.z (we're another user but our ENV is still set)
- [ -f "$datafile" -a ! -O "$datafile" ] && return
-
- # add entries
- if [ "$1" = "--add" ]; then
-  shift
-
-  # $HOME isn't worth matching
-  [ "$*" = "$HOME" ] && return
-
-  # don't track excluded dirs
-  local exclude
-  for exclude in "${_Z_EXCLUDE_DIRS[@]}"; do
-   [ "$*" = "$exclude" ] && return
-  done
-
-  # maintain the file
-  local tempfile
-  tempfile="$(mktemp "$datafile.XXXXXX")" || return
-  while read line; do
-   [ -d "${line%%\|*}" ] && echo $line
-  done < "$datafile" | awk -v path="$*" -v now="$(date +%s)" -F"|" '
-   BEGIN {
-    rank[path] = 1
-    time[path] = now
-   }
-   $2 >= 1 {
-    if( $1 == path ) {
-     rank[$1] = $2 + 1
-     time[$1] = now
-    } else {
-     rank[$1] = $2
-     time[$1] = $3
-    }
-    count += $2
-   }
-   END {
-    if( count > 6000 ) {
-     for( i in rank ) print i "|" 0.99*rank[i] "|" time[i] # aging
-    } else for( i in rank ) print i "|" rank[i] "|" time[i]
-   }
-  ' 2>/dev/null >| "$tempfile"
-  if [ $? -ne 0 -a -f "$datafile" ]; then
-   env rm -f "$tempfile"
-  else
-   env mv -f "$tempfile" "$datafile" || env rm -f "$tmpfile"
-  fi
-
- # tab completion
- elif [ "$1" = "--complete" ]; then
-  while read line; do
-   [ -d "${line%%\|*}" ] && echo $line
-  done < "$datafile" | awk -v q="$2" -F"|" '
-   BEGIN {
-    if( q == tolower(q) ) nocase = 1
-    split(substr(q,3),fnd," ")
-   }
-   {
-    if( nocase ) {
-     for( i in fnd ) tolower($1) !~ tolower(fnd[i]) && $1 = ""
-    } else {
-     for( i in fnd ) $1 !~ fnd[i] && $1 = ""
-    }
-    if( $1 ) print $1
-   }
-  ' 2>/dev/null
-
- else
-  # list/go
-  while [ "$1" ]; do case "$1" in
-   --) while [ "$1" ]; do shift; local fnd="$fnd $1";done;;
-   -*) local opt=${1:1}; while [ "$opt" ]; do case ${opt:0:1} in
-        c) local fnd="^$PWD $fnd";;
-        h) echo "${_Z_CMD:-z} [-chlrtx] args" >&2; return;;
-        x) sed -i "\:^${PWD}|.*:d" "$datafile";;
-        l) local list=1;;
-        r) local typ="rank";;
-        t) local typ="recent";;
-       esac; opt=${opt:1}; done;;
-    *) local fnd="$fnd $1";;
-  esac; local last=$1; shift; done
-  [ "$fnd" -a "$fnd" != "^$PWD " ] || local list=1
-
-  # if we hit enter on a completion just go there
-  case "$last" in
-   # completions will always start with /
-   /*) [ -z "$list" -a -d "$last" ] && cd "$last" && return;;
-  esac
-
-  # no file yet
-  [ -f "$datafile" ] || return
-
-  local cd
-  cd="$(while read line; do
-   [ -d "${line%%\|*}" ] && echo $line
-  done < "$datafile" | awk -v t="$(date +%s)" -v list="$list" -v typ="$typ" -v q="$fnd" -F"|" '
-   function frecent(rank, time) {
-    dx = t-time
-    if( dx < 3600 ) return rank*4
-    if( dx < 86400 ) return rank*2
-    if( dx < 604800 ) return rank/2
-    return rank/4
-   }
-   function output(files, toopen, override) {
-    if( list ) {
-     cmd = "sort -n >&2"
-     for( i in files ) if( files[i] ) printf "%-10s %s\n", files[i], i | cmd
-     if( override ) printf "%-10s %s\n", "common:", override > "/dev/stderr"
-    } else {
-     if( override ) toopen = override
-     print toopen
-    }
-   }
-   function common(matches) {
-    # shortest match
-    for( i in matches ) {
-     if( matches[i] && (!short || length(i) < length(short)) ) short = i
-    }
-    if( short == "/" ) return
-    # shortest match must be common to each match. escape special characters in
-    # a copy when testing, so we can return the original.
-    clean_short = short
-    gsub(/[\(\)\[\]\|]/, "\\\\&", clean_short)
-    for( i in matches ) if( matches[i] && i !~ clean_short ) return
-    return short
-   }
-   BEGIN { split(q, a, " "); oldf = noldf = -9999999999 }
-   {
-    if( typ == "rank" ) {
-     f = $2
-    } else if( typ == "recent" ) {
-     f = $3-t
-    } else f = frecent($2, $3)
-    wcase[$1] = nocase[$1] = f
-    for( i in a ) {
-     if( $1 !~ a[i] ) delete wcase[$1]
-     if( tolower($1) !~ tolower(a[i]) ) delete nocase[$1]
-    }
-    if( wcase[$1] && wcase[$1] > oldf ) {
-     cx = $1
-     oldf = wcase[$1]
-    } else if( nocase[$1] && nocase[$1] > noldf ) {
-     ncx = $1
-     noldf = nocase[$1]
-    }
-   }
-   END {
-    if( cx ) {
-     output(wcase, cx, common(wcase))
-    } else if( ncx ) output(nocase, ncx, common(nocase))
-   }
-  ')"
-  [ $? -gt 0 ] && return
-  [ "$cd" ] && cd "$cd"
- fi
-}
-
-alias ${_Z_CMD:-z}='_z 2>&1'
-
-[ "$_Z_NO_RESOLVE_SYMLINKS" ] || _Z_RESOLVE_SYMLINKS="-P"
-
-if compctl &> /dev/null; then
- [ "$_Z_NO_PROMPT_COMMAND" ] || {
-  # zsh populate directory list, avoid clobbering any other precmds
-  if [ "$_Z_NO_RESOLVE_SYMLINKS" ]; then
-    _z_precmd() {
-      _z --add "${PWD:a}"
-    }
-  else
-    _z_precmd() {
-      _z --add "${PWD:A}"
-    }
-  fi
-  precmd_functions+=(_z_precmd)
- }
- # zsh tab completion
- _z_zsh_tab_completion() {
-  local compl
-  read -l compl
-  reply=(${(f)"$(_z --complete "$compl")"})
- }
- compctl -U -K _z_zsh_tab_completion _z
-elif complete &> /dev/null; then
- # bash tab completion
- complete -o filenames -C '_z --complete "$COMP_LINE"' ${_Z_CMD:-z}
- [ "$_Z_NO_PROMPT_COMMAND" ] || {
-  # bash populate directory list. avoid clobbering other PROMPT_COMMANDs.
-  echo $PROMPT_COMMAND | grep -q "_z --add" || {
-   PROMPT_COMMAND='_z --add "$(pwd '$_Z_RESOLVE_SYMLINKS' 2>/dev/null)" 2>/dev/null;'"$PROMPT_COMMAND"
-  }
- }
-fi
+
+
+
+<!DOCTYPE html>
+<html>
+  <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# githubog: http://ogp.me/ns/fb/githubog#">
+    <meta charset='utf-8'>
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+        <title>z/z.sh at master · rupa/z · GitHub</title>
+    <link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub" />
+    <link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub" />
+    <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-114.png" />
+    <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114.png" />
+    <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-144.png" />
+    <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144.png" />
+    <link rel="logo" type="image/svg" href="https://github-media-downloads.s3.amazonaws.com/github-logo.svg" />
+    <meta property="og:image" content="https://github.global.ssl.fastly.net/images/modules/logos_page/Octocat.png">
+    <meta name="hostname" content="github-fe132-cp1-prd.iad.github.net">
+    <meta name="ruby" content="ruby 1.9.3p194-tcs-github-tcmalloc (2012-05-25, TCS patched 2012-05-27, GitHub v1.0.36) [x86_64-linux]">
+    <link rel="assets" href="https://github.global.ssl.fastly.net/">
+    <link rel="conduit-xhr" href="https://ghconduit.com:25035/">
+    <link rel="xhr-socket" href="/_sockets" />
+
+
+
+    <meta name="msapplication-TileImage" content="/windows-tile.png" />
+    <meta name="msapplication-TileColor" content="#ffffff" />
+    <meta name="selected-link" value="repo_source" data-pjax-transient />
+    <meta content="collector.githubapp.com" name="octolytics-host" /><meta content="github" name="octolytics-app-id" /><meta content="3C256F18:3B8F:6D34F1D:52523152" name="octolytics-dimension-request_id" />
+
+
+
+
+    <link rel="icon" type="image/x-icon" href="/favicon.ico" />
+
+    <meta content="authenticity_token" name="csrf-param" />
+<meta content="PCW338Cjb4zdK7DA6A4A3cEhAbkHphTyiBgOCQVCIXA=" name="csrf-token" />
+
+    <link href="https://github.global.ssl.fastly.net/assets/github-05a75a572a86cfef8425f698ed0e5b891f24118e.css" media="all" rel="stylesheet" type="text/css" />
+    <link href="https://github.global.ssl.fastly.net/assets/github2-5270ba98127dece0c192c0a6c0aa3d40b92efaf0.css" media="all" rel="stylesheet" type="text/css" />
+
+
+
+
+      <script src="https://github.global.ssl.fastly.net/assets/frameworks-c4f8e49c5f967e72dd0ab79195971321e5adb6cc.js" type="text/javascript"></script>
+      <script src="https://github.global.ssl.fastly.net/assets/github-21bf8455822c013e37748552e4a1bbd19bcb4c3b.js" type="text/javascript"></script>
+
+      <meta http-equiv="x-pjax-version" content="8689b59389e7e38906fa435431068773">
+
+        <link data-pjax-transient rel='permalink' href='/rupa/z/blob/f1500aa03df7781a6cf920a10a2585436b225859/z.sh'>
+  <meta property="og:title" content="z"/>
+  <meta property="og:type" content="githubog:gitrepository"/>
+  <meta property="og:url" content="https://github.com/rupa/z"/>
+  <meta property="og:image" content="https://github.global.ssl.fastly.net/images/gravatars/gravatar-user-420.png"/>
+  <meta property="og:site_name" content="GitHub"/>
+  <meta property="og:description" content="z is the new j, yo"/>
+
+  <meta name="description" content="z is the new j, yo" />
+
+  <meta content="46809" name="octolytics-dimension-user_id" /><meta content="rupa" name="octolytics-dimension-user_login" /><meta content="236571" name="octolytics-dimension-repository_id" /><meta content="rupa/z" name="octolytics-dimension-repository_nwo" /><meta content="true" name="octolytics-dimension-repository_public" /><meta content="false" name="octolytics-dimension-repository_is_fork" /><meta content="236571" name="octolytics-dimension-repository_network_root_id" /><meta content="rupa/z" name="octolytics-dimension-repository_network_root_nwo" />
+  <link href="https://github.com/rupa/z/commits/master.atom" rel="alternate" title="Recent Commits to z:master" type="application/atom+xml" />
+
+  </head>
+
+
+  <body class="logged_out  env-production  vis-public  page-blob">
+    <div class="wrapper">
+
+
+
+
+
+
+      <div class="header header-logged-out">
+  <div class="container clearfix">
+
+    <a class="header-logo-wordmark" href="https://github.com/">
+      <span class="mega-octicon octicon-logo-github"></span>
+    </a>
+
+    <div class="header-actions">
+        <a class="button primary" href="/signup">Sign up</a>
+      <a class="button signin" href="/login?return_to=%2Frupa%2Fz%2Fblob%2Fmaster%2Fz.sh">Sign in</a>
+    </div>
+
+    <div class="command-bar js-command-bar  in-repository">
+
+      <ul class="top-nav">
+          <li class="explore"><a href="/explore">Explore</a></li>
+        <li class="features"><a href="/features">Features</a></li>
+          <li class="enterprise"><a href="https://enterprise.github.com/">Enterprise</a></li>
+          <li class="blog"><a href="/blog">Blog</a></li>
+      </ul>
+        <form accept-charset="UTF-8" action="/search" class="command-bar-form" id="top_search_form" method="get">
+
+<input type="text" data-hotkey="/ s" name="q" id="js-command-bar-field" placeholder="Search or type a command" tabindex="1" autocapitalize="off"
+
+
+      data-repo="rupa/z"
+      data-branch="master"
+      data-sha="82f3029e6bbef324bbc95b65dcd5245eb50c74aa"
+  >
+
+    <input type="hidden" name="nwo" value="rupa/z" />
+
+    <div class="select-menu js-menu-container js-select-menu search-context-select-menu">
+      <span class="minibutton select-menu-button js-menu-target">
+        <span class="js-select-button">This repository</span>
+      </span>
+
+      <div class="select-menu-modal-holder js-menu-content js-navigation-container">
+        <div class="select-menu-modal">
+
+          <div class="select-menu-item js-navigation-item js-this-repository-navigation-item selected">
+            <span class="select-menu-item-icon octicon octicon-check"></span>
+            <input type="radio" class="js-search-this-repository" name="search_target" value="repository" checked="checked" />
+            <div class="select-menu-item-text js-select-button-text">This repository</div>
+          </div> <!-- /.select-menu-item -->
+
+          <div class="select-menu-item js-navigation-item js-all-repositories-navigation-item">
+            <span class="select-menu-item-icon octicon octicon-check"></span>
+            <input type="radio" name="search_target" value="global" />
+            <div class="select-menu-item-text js-select-button-text">All repositories</div>
+          </div> <!-- /.select-menu-item -->
+
+        </div>
+      </div>
+    </div>
+
+  <span class="octicon help tooltipped downwards" title="Show command bar help">
+    <span class="octicon octicon-question"></span>
+  </span>
+
+
+  <input type="hidden" name="ref" value="cmdform">
+
+</form>
+    </div>
+
+  </div>
+</div>
+
+
+
+
+
+          <div class="site" itemscope itemtype="http://schema.org/WebPage">
+
+    <div class="pagehead repohead instapaper_ignore readability-menu">
+      <div class="container">
+
+
+<ul class="pagehead-actions">
+
+
+  <li>
+  <a href="/login?return_to=%2Frupa%2Fz"
+  class="minibutton with-count js-toggler-target star-button entice tooltipped upwards"
+  title="You must be signed in to use this feature" rel="nofollow">
+  <span class="octicon octicon-star"></span>Star
+</a>
+<a class="social-count js-social-count" href="/rupa/z/stargazers">
+  1,988
+</a>
+
+  </li>
+
+    <li>
+      <a href="/login?return_to=%2Frupa%2Fz"
+        class="minibutton with-count js-toggler-target fork-button entice tooltipped upwards"
+        title="You must be signed in to fork a repository" rel="nofollow">
+        <span class="octicon octicon-git-branch"></span>Fork
+      </a>
+      <a href="/rupa/z/network" class="social-count">
+        167
+      </a>
+    </li>
+</ul>
+
+        <h1 itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="entry-title public">
+          <span class="repo-label"><span>public</span></span>
+          <span class="mega-octicon octicon-repo"></span>
+          <span class="author">
+            <a href="/rupa" class="url fn" itemprop="url" rel="author"><span itemprop="title">rupa</span></a></span
+          ><span class="repohead-name-divider">/</span><strong
+          ><a href="/rupa/z" class="js-current-repository js-repo-home-link">z</a></strong>
+
+          <span class="page-context-loader">
+            <img alt="Octocat-spinner-32" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
+          </span>
+
+        </h1>
+      </div><!-- /.container -->
+    </div><!-- /.repohead -->
+
+    <div class="container">
+
+      <div class="repository-with-sidebar repo-container ">
+
+        <div class="repository-sidebar">
+
+
+<div class="repo-nav repo-nav-full js-repository-container-pjax js-octicon-loaders">
+  <div class="repo-nav-contents">
+    <ul class="repo-menu">
+      <li class="tooltipped leftwards" title="Code">
+        <a href="/rupa/z" aria-label="Code" class="js-selected-navigation-item selected" data-gotokey="c" data-pjax="true" data-selected-links="repo_source repo_downloads repo_commits repo_tags repo_branches /rupa/z">
+          <span class="octicon octicon-code"></span> <span class="full-word">Code</span>
+          <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
+</a>      </li>
+
+        <li class="tooltipped leftwards" title="Issues">
+          <a href="/rupa/z/issues" aria-label="Issues" class="js-selected-navigation-item js-disable-pjax" data-gotokey="i" data-selected-links="repo_issues /rupa/z/issues">
+            <span class="octicon octicon-issue-opened"></span> <span class="full-word">Issues</span>
+            <span class='counter'>23</span>
+            <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
+</a>        </li>
+
+      <li class="tooltipped leftwards" title="Pull Requests"><a href="/rupa/z/pulls" aria-label="Pull Requests" class="js-selected-navigation-item js-disable-pjax" data-gotokey="p" data-selected-links="repo_pulls /rupa/z/pulls">
+            <span class="octicon octicon-git-pull-request"></span> <span class="full-word">Pull Requests</span>
+            <span class='counter'>3</span>
+            <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
+</a>      </li>
+
+
+        <li class="tooltipped leftwards" title="Wiki">
+          <a href="/rupa/z/wiki" aria-label="Wiki" class="js-selected-navigation-item " data-pjax="true" data-selected-links="repo_wiki /rupa/z/wiki">
+            <span class="octicon octicon-book"></span> <span class="full-word">Wiki</span>
+            <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
+</a>        </li>
+    </ul>
+    <div class="repo-menu-separator"></div>
+    <ul class="repo-menu">
+
+      <li class="tooltipped leftwards" title="Pulse">
+        <a href="/rupa/z/pulse" aria-label="Pulse" class="js-selected-navigation-item " data-pjax="true" data-selected-links="pulse /rupa/z/pulse">
+          <span class="octicon octicon-pulse"></span> <span class="full-word">Pulse</span>
+          <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
+</a>      </li>
+
+      <li class="tooltipped leftwards" title="Graphs">
+        <a href="/rupa/z/graphs" aria-label="Graphs" class="js-selected-navigation-item " data-pjax="true" data-selected-links="repo_graphs repo_contributors /rupa/z/graphs">
+          <span class="octicon octicon-graph"></span> <span class="full-word">Graphs</span>
+          <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
+</a>      </li>
+
+      <li class="tooltipped leftwards" title="Network">
+        <a href="/rupa/z/network" aria-label="Network" class="js-selected-navigation-item js-disable-pjax" data-selected-links="repo_network /rupa/z/network">
+          <span class="octicon octicon-git-branch"></span> <span class="full-word">Network</span>
+          <img alt="Octocat-spinner-32" class="mini-loader" height="16" src="https://github.global.ssl.fastly.net/images/spinners/octocat-spinner-32.gif" width="16" />
+</a>      </li>
+    </ul>
+
+
+  </div>
+</div>
+
+            <div class="only-with-full-nav">
+
+
+
+
+<div class="clone-url open"
+  data-protocol-type="http"
+  data-url="/users/set_protocol?protocol_selector=http&amp;protocol_type=clone">
+  <h3><strong>HTTPS</strong> clone URL</h3>
+  <div class="clone-url-box">
+    <input type="text" class="clone js-url-field"
+           value="https://github.com/rupa/z.git" readonly="readonly">
+
+    <span class="js-zeroclipboard url-box-clippy minibutton zeroclipboard-button" data-clipboard-text="https://github.com/rupa/z.git" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>
+  </div>
+</div>
+
+
+
+<div class="clone-url "
+  data-protocol-type="subversion"
+  data-url="/users/set_protocol?protocol_selector=subversion&amp;protocol_type=clone">
+  <h3><strong>Subversion</strong> checkout URL</h3>
+  <div class="clone-url-box">
+    <input type="text" class="clone js-url-field"
+           value="https://github.com/rupa/z" readonly="readonly">
+
+    <span class="js-zeroclipboard url-box-clippy minibutton zeroclipboard-button" data-clipboard-text="https://github.com/rupa/z" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>
+  </div>
+</div>
+
+
+<p class="clone-options">You can clone with
+      <a href="#" class="js-clone-selector" data-protocol="http">HTTPS</a>,
+      or <a href="#" class="js-clone-selector" data-protocol="subversion">Subversion</a>.
+  <span class="octicon help tooltipped upwards" title="Get help on which URL is right for you.">
+    <a href="https://help.github.com/articles/which-remote-url-should-i-use">
+    <span class="octicon octicon-question"></span>
+    </a>
+  </span>
+</p>
+
+
+
+              <a href="/rupa/z/archive/master.zip"
+                 class="minibutton sidebar-button"
+                 title="Download this repository as a zip file"
+                 rel="nofollow">
+                <span class="octicon octicon-cloud-download"></span>
+                Download ZIP
+              </a>
+            </div>
+        </div><!-- /.repository-sidebar -->
+
+        <div id="js-repo-pjax-container" class="repository-content context-loader-container" data-pjax-container>
+
+
+
+<!-- blob contrib key: blob_contributors:v21:5c183ea510a120283c031b97b1419d6a -->
+
+<p title="This is a placeholder element" class="js-history-link-replace hidden"></p>
+
+<a href="/rupa/z/find/master" data-pjax data-hotkey="t" class="js-show-file-finder" style="display:none">Show File Finder</a>
+
+<div class="file-navigation">
+
+
+
+<div class="select-menu js-menu-container js-select-menu" >
+  <span class="minibutton select-menu-button js-menu-target" data-hotkey="w"
+    data-master-branch="master"
+    data-ref="master"
+    role="button" aria-label="Switch branches or tags" tabindex="0">
+    <span class="octicon octicon-git-branch"></span>
+    <i>branch:</i>
+    <span class="js-select-button">master</span>
+  </span>
+
+  <div class="select-menu-modal-holder js-menu-content js-navigation-container" data-pjax>
+
+    <div class="select-menu-modal">
+      <div class="select-menu-header">
+        <span class="select-menu-title">Switch branches/tags</span>
+        <span class="octicon octicon-remove-close js-menu-close"></span>
+      </div> <!-- /.select-menu-header -->
+
+      <div class="select-menu-filters">
+        <div class="select-menu-text-filter">
+          <input type="text" aria-label="Filter branches/tags" id="context-commitish-filter-field" class="js-filterable-field js-navigation-enable" placeholder="Filter branches/tags">
+        </div>
+        <div class="select-menu-tabs">
+          <ul>
+            <li class="select-menu-tab">
+              <a href="#" data-tab-filter="branches" class="js-select-menu-tab">Branches</a>
+            </li>
+            <li class="select-menu-tab">
+              <a href="#" data-tab-filter="tags" class="js-select-menu-tab">Tags</a>
+            </li>
+          </ul>
+        </div><!-- /.select-menu-tabs -->
+      </div><!-- /.select-menu-filters -->
+
+      <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket" data-tab-filter="branches">
+
+        <div data-filterable-for="context-commitish-filter-field" data-filterable-type="substring">
+
+
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/rupa/z/blob/cleanup/z.sh"
+                 data-name="cleanup"
+                 data-skip-pjax="true"
+                 rel="nofollow"
+                 class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
+                 title="cleanup">cleanup</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/rupa/z/blob/dev/z.sh"
+                 data-name="dev"
+                 data-skip-pjax="true"
+                 rel="nofollow"
+                 class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
+                 title="dev">dev</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item selected">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/rupa/z/blob/master/z.sh"
+                 data-name="master"
+                 data-skip-pjax="true"
+                 rel="nofollow"
+                 class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
+                 title="master">master</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/rupa/z/blob/ordered_args/z.sh"
+                 data-name="ordered_args"
+                 data-skip-pjax="true"
+                 rel="nofollow"
+                 class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
+                 title="ordered_args">ordered_args</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/rupa/z/blob/prompt_command_append/z.sh"
+                 data-name="prompt_command_append"
+                 data-skip-pjax="true"
+                 rel="nofollow"
+                 class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
+                 title="prompt_command_append">prompt_command_append</a>
+            </div> <!-- /.select-menu-item -->
+        </div>
+
+          <div class="select-menu-no-results">Nothing to show</div>
+      </div> <!-- /.select-menu-list -->
+
+      <div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket" data-tab-filter="tags">
+        <div data-filterable-for="context-commitish-filter-field" data-filterable-type="substring">
+
+
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/rupa/z/tree/v1.8/z.sh"
+                 data-name="v1.8"
+                 data-skip-pjax="true"
+                 rel="nofollow"
+                 class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
+                 title="v1.8">v1.8</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/rupa/z/tree/v1.7/z.sh"
+                 data-name="v1.7"
+                 data-skip-pjax="true"
+                 rel="nofollow"
+                 class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
+                 title="v1.7">v1.7</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/rupa/z/tree/v1.6/z.sh"
+                 data-name="v1.6"
+                 data-skip-pjax="true"
+                 rel="nofollow"
+                 class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
+                 title="v1.6">v1.6</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/rupa/z/tree/v1.5/z.sh"
+                 data-name="v1.5"
+                 data-skip-pjax="true"
+                 rel="nofollow"
+                 class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
+                 title="v1.5">v1.5</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/rupa/z/tree/v1.4/z.sh"
+                 data-name="v1.4"
+                 data-skip-pjax="true"
+                 rel="nofollow"
+                 class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
+                 title="v1.4">v1.4</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/rupa/z/tree/v1.3/z.sh"
+                 data-name="v1.3"
+                 data-skip-pjax="true"
+                 rel="nofollow"
+                 class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
+                 title="v1.3">v1.3</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/rupa/z/tree/v1.2/z.sh"
+                 data-name="v1.2"
+                 data-skip-pjax="true"
+                 rel="nofollow"
+                 class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
+                 title="v1.2">v1.2</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/rupa/z/tree/v1.1/z.sh"
+                 data-name="v1.1"
+                 data-skip-pjax="true"
+                 rel="nofollow"
+                 class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
+                 title="v1.1">v1.1</a>
+            </div> <!-- /.select-menu-item -->
+            <div class="select-menu-item js-navigation-item ">
+              <span class="select-menu-item-icon octicon octicon-check"></span>
+              <a href="/rupa/z/tree/v1.0/z.sh"
+                 data-name="v1.0"
+                 data-skip-pjax="true"
+                 rel="nofollow"
+                 class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target"
+                 title="v1.0">v1.0</a>
+            </div> <!-- /.select-menu-item -->
+        </div>
+
+        <div class="select-menu-no-results">Nothing to show</div>
+      </div> <!-- /.select-menu-list -->
+
+    </div> <!-- /.select-menu-modal -->
+  </div> <!-- /.select-menu-modal-holder -->
+</div> <!-- /.select-menu -->
+
+  <div class="breadcrumb">
+    <span class='repo-root js-repo-root'><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/rupa/z" data-branch="master" data-direction="back" data-pjax="true" itemscope="url"><span itemprop="title">z</span></a></span></span><span class="separator"> / </span><strong class="final-path">z.sh</strong> <span class="js-zeroclipboard minibutton zeroclipboard-button" data-clipboard-text="z.sh" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>
+  </div>
+</div>
+
+
+
+  <div class="commit file-history-tease">
+    <img class="main-avatar" height="24" src="https://0.gravatar.com/avatar/c1079a3218e18c1a302547276fdc5f16?d=https%3A%2F%2Fidenticons.github.com%2F49701d39d51b7a1bea8b17f15a3f447d.png&amp;s=140" width="24" />
+    <span class="author"><a href="/rupa" rel="author">rupa</a></span>
+    <time class="js-relative-date" datetime="2013-08-23T07:22:07-07:00" title="2013-08-23 07:22:07">August 23, 2013</time>
+    <div class="commit-title">
+        <a href="/rupa/z/commit/f1500aa03df7781a6cf920a10a2585436b225859" class="message" data-pjax="true" title="Typo fix. Closes #115.">Typo fix. Closes</a> <a href="https://github.com/rupa/z/issues/115" class="issue-link" title="typo: $tmpfile should be $tempfile">#115</a><a href="/rupa/z/commit/f1500aa03df7781a6cf920a10a2585436b225859" class="message" data-pjax="true" title="Typo fix. Closes #115.">.</a>
+    </div>
+
+    <div class="participation">
+      <p class="quickstat"><a href="#blob_contributors_box" rel="facebox"><strong>8</strong> contributors</a></p>
+          <a class="avatar tooltipped downwards" title="rupa" href="/rupa/z/commits/master/z.sh?author=rupa"><img height="20" src="https://0.gravatar.com/avatar/c1079a3218e18c1a302547276fdc5f16?d=https%3A%2F%2Fidenticons.github.com%2F49701d39d51b7a1bea8b17f15a3f447d.png&amp;s=140" width="20" /></a>
+    <a class="avatar tooltipped downwards" title="Enlik" href="/rupa/z/commits/master/z.sh?author=Enlik"><img height="20" src="https://2.gravatar.com/avatar/1e7768393be106cc651e05edd2562c64?d=https%3A%2F%2Fidenticons.github.com%2Ff918171b3dbc6abc7f036b8b15898cc0.png&amp;s=140" width="20" /></a>
+    <a class="avatar tooltipped downwards" title="uchida" href="/rupa/z/commits/master/z.sh?author=uchida"><img height="20" src="https://0.gravatar.com/avatar/9fedc5d6e822afb5936c2f4a4a512d3a?d=https%3A%2F%2Fidenticons.github.com%2Fc2b836a21bb0c1dcd1a26ea9c4e05c39.png&amp;s=140" width="20" /></a>
+    <a class="avatar tooltipped downwards" title="simonair" href="/rupa/z/commits/master/z.sh?author=simonair"><img height="20" src="https://2.gravatar.com/avatar/3f89b3779f5a08e970aebf3c397eac26?d=https%3A%2F%2Fidenticons.github.com%2Fbecf1709d039694459f09484afdb200c.png&amp;s=140" width="20" /></a>
+    <a class="avatar tooltipped downwards" title="baskerville" href="/rupa/z/commits/master/z.sh?author=baskerville"><img height="20" src="https://2.gravatar.com/avatar/d98f6069879675a0cbf44e248609f4f7?d=https%3A%2F%2Fidenticons.github.com%2Fa6f9cf6e7fb8463521455115c2ed87a9.png&amp;s=140" width="20" /></a>
+    <a class="avatar tooltipped downwards" title="matthiasgoergens" href="/rupa/z/commits/master/z.sh?author=matthiasgoergens"><img height="20" src="https://1.gravatar.com/avatar/8ef0ad802ffe6f866dd560bb6e820fcf?d=https%3A%2F%2Fidenticons.github.com%2F75e97099a364d359180be2e67912dc66.png&amp;s=140" width="20" /></a>
+    <a class="avatar tooltipped downwards" title="joshdick" href="/rupa/z/commits/master/z.sh?author=joshdick"><img height="20" src="https://0.gravatar.com/avatar/b650ae503f6dea798345e9da56bb1994?d=https%3A%2F%2Fidenticons.github.com%2Fc08ab0ff99440cf5cf33246ce0e72eab.png&amp;s=140" width="20" /></a>
+    <a class="avatar tooltipped downwards" title="nmeum" href="/rupa/z/commits/master/z.sh?author=nmeum"><img height="20" src="https://1.gravatar.com/avatar/13a21c787291911bbb690e83d3b3c0c3?d=https%3A%2F%2Fidenticons.github.com%2F93ecdd64c47e20dc8ae08edcdb694988.png&amp;s=140" width="20" /></a>
+
+
+    </div>
+    <div id="blob_contributors_box" style="display:none">
+      <h2 class="facebox-header">Users who have contributed to this file</h2>
+      <ul class="facebox-user-list">
+        <li class="facebox-user-list-item">
+          <img height="24" src="https://0.gravatar.com/avatar/c1079a3218e18c1a302547276fdc5f16?d=https%3A%2F%2Fidenticons.github.com%2F49701d39d51b7a1bea8b17f15a3f447d.png&amp;s=140" width="24" />
+          <a href="/rupa">rupa</a>
+        </li>
+        <li class="facebox-user-list-item">
+          <img height="24" src="https://2.gravatar.com/avatar/1e7768393be106cc651e05edd2562c64?d=https%3A%2F%2Fidenticons.github.com%2Ff918171b3dbc6abc7f036b8b15898cc0.png&amp;s=140" width="24" />
+          <a href="/Enlik">Enlik</a>
+        </li>
+        <li class="facebox-user-list-item">
+          <img height="24" src="https://0.gravatar.com/avatar/9fedc5d6e822afb5936c2f4a4a512d3a?d=https%3A%2F%2Fidenticons.github.com%2Fc2b836a21bb0c1dcd1a26ea9c4e05c39.png&amp;s=140" width="24" />
+          <a href="/uchida">uchida</a>
+        </li>
+        <li class="facebox-user-list-item">
+          <img height="24" src="https://2.gravatar.com/avatar/3f89b3779f5a08e970aebf3c397eac26?d=https%3A%2F%2Fidenticons.github.com%2Fbecf1709d039694459f09484afdb200c.png&amp;s=140" width="24" />
+          <a href="/simonair">simonair</a>
+        </li>
+        <li class="facebox-user-list-item">
+          <img height="24" src="https://2.gravatar.com/avatar/d98f6069879675a0cbf44e248609f4f7?d=https%3A%2F%2Fidenticons.github.com%2Fa6f9cf6e7fb8463521455115c2ed87a9.png&amp;s=140" width="24" />
+          <a href="/baskerville">baskerville</a>
+        </li>
+        <li class="facebox-user-list-item">
+          <img height="24" src="https://1.gravatar.com/avatar/8ef0ad802ffe6f866dd560bb6e820fcf?d=https%3A%2F%2Fidenticons.github.com%2F75e97099a364d359180be2e67912dc66.png&amp;s=140" width="24" />
+          <a href="/matthiasgoergens">matthiasgoergens</a>
+        </li>
+        <li class="facebox-user-list-item">
+          <img height="24" src="https://0.gravatar.com/avatar/b650ae503f6dea798345e9da56bb1994?d=https%3A%2F%2Fidenticons.github.com%2Fc08ab0ff99440cf5cf33246ce0e72eab.png&amp;s=140" width="24" />
+          <a href="/joshdick">joshdick</a>
+        </li>
+        <li class="facebox-user-list-item">
+          <img height="24" src="https://1.gravatar.com/avatar/13a21c787291911bbb690e83d3b3c0c3?d=https%3A%2F%2Fidenticons.github.com%2F93ecdd64c47e20dc8ae08edcdb694988.png&amp;s=140" width="24" />
+          <a href="/nmeum">nmeum</a>
+        </li>
+      </ul>
+    </div>
+  </div>
+
+<div id="files" class="bubble">
+  <div class="file">
+    <div class="meta">
+      <div class="info">
+        <span class="icon"><b class="octicon octicon-file-text"></b></span>
+        <span class="mode" title="File Mode">file</span>
+          <span>243 lines (225 sloc)</span>
+        <span>8.71 kb</span>
+      </div>
+      <div class="actions">
+        <div class="button-group">
+              <a class="minibutton disabled js-entice" href=""
+                 data-entice="You must be signed in to make or propose changes">Edit</a>
+          <a href="/rupa/z/raw/master/z.sh" class="button minibutton " id="raw-url">Raw</a>
+            <a href="/rupa/z/blame/master/z.sh" class="button minibutton ">Blame</a>
+          <a href="/rupa/z/commits/master/z.sh" class="button minibutton " rel="nofollow">History</a>
+        </div><!-- /.button-group -->
+            <a class="minibutton danger empty-icon js-entice" href=""
+               data-entice="You must be signed in and on a branch to make or propose changes">
+            Delete
+          </a>
+      </div><!-- /.actions -->
+
+    </div>
+        <div class="blob-wrapper data type-shell js-blob-data">
+        <table class="file-code file-diff">
+          <tr class="file-code-line">
+            <td class="blob-line-nums">
+              <span id="L1" rel="#L1">1</span>
+<span id="L2" rel="#L2">2</span>
+<span id="L3" rel="#L3">3</span>
+<span id="L4" rel="#L4">4</span>
+<span id="L5" rel="#L5">5</span>
+<span id="L6" rel="#L6">6</span>
+<span id="L7" rel="#L7">7</span>
+<span id="L8" rel="#L8">8</span>
+<span id="L9" rel="#L9">9</span>
+<span id="L10" rel="#L10">10</span>
+<span id="L11" rel="#L11">11</span>
+<span id="L12" rel="#L12">12</span>
+<span id="L13" rel="#L13">13</span>
+<span id="L14" rel="#L14">14</span>
+<span id="L15" rel="#L15">15</span>
+<span id="L16" rel="#L16">16</span>
+<span id="L17" rel="#L17">17</span>
+<span id="L18" rel="#L18">18</span>
+<span id="L19" rel="#L19">19</span>
+<span id="L20" rel="#L20">20</span>
+<span id="L21" rel="#L21">21</span>
+<span id="L22" rel="#L22">22</span>
+<span id="L23" rel="#L23">23</span>
+<span id="L24" rel="#L24">24</span>
+<span id="L25" rel="#L25">25</span>
+<span id="L26" rel="#L26">26</span>
+<span id="L27" rel="#L27">27</span>
+<span id="L28" rel="#L28">28</span>
+<span id="L29" rel="#L29">29</span>
+<span id="L30" rel="#L30">30</span>
+<span id="L31" rel="#L31">31</span>
+<span id="L32" rel="#L32">32</span>
+<span id="L33" rel="#L33">33</span>
+<span id="L34" rel="#L34">34</span>
+<span id="L35" rel="#L35">35</span>
+<span id="L36" rel="#L36">36</span>
+<span id="L37" rel="#L37">37</span>
+<span id="L38" rel="#L38">38</span>
+<span id="L39" rel="#L39">39</span>
+<span id="L40" rel="#L40">40</span>
+<span id="L41" rel="#L41">41</span>
+<span id="L42" rel="#L42">42</span>
+<span id="L43" rel="#L43">43</span>
+<span id="L44" rel="#L44">44</span>
+<span id="L45" rel="#L45">45</span>
+<span id="L46" rel="#L46">46</span>
+<span id="L47" rel="#L47">47</span>
+<span id="L48" rel="#L48">48</span>
+<span id="L49" rel="#L49">49</span>
+<span id="L50" rel="#L50">50</span>
+<span id="L51" rel="#L51">51</span>
+<span id="L52" rel="#L52">52</span>
+<span id="L53" rel="#L53">53</span>
+<span id="L54" rel="#L54">54</span>
+<span id="L55" rel="#L55">55</span>
+<span id="L56" rel="#L56">56</span>
+<span id="L57" rel="#L57">57</span>
+<span id="L58" rel="#L58">58</span>
+<span id="L59" rel="#L59">59</span>
+<span id="L60" rel="#L60">60</span>
+<span id="L61" rel="#L61">61</span>
+<span id="L62" rel="#L62">62</span>
+<span id="L63" rel="#L63">63</span>
+<span id="L64" rel="#L64">64</span>
+<span id="L65" rel="#L65">65</span>
+<span id="L66" rel="#L66">66</span>
+<span id="L67" rel="#L67">67</span>
+<span id="L68" rel="#L68">68</span>
+<span id="L69" rel="#L69">69</span>
+<span id="L70" rel="#L70">70</span>
+<span id="L71" rel="#L71">71</span>
+<span id="L72" rel="#L72">72</span>
+<span id="L73" rel="#L73">73</span>
+<span id="L74" rel="#L74">74</span>
+<span id="L75" rel="#L75">75</span>
+<span id="L76" rel="#L76">76</span>
+<span id="L77" rel="#L77">77</span>
+<span id="L78" rel="#L78">78</span>
+<span id="L79" rel="#L79">79</span>
+<span id="L80" rel="#L80">80</span>
+<span id="L81" rel="#L81">81</span>
+<span id="L82" rel="#L82">82</span>
+<span id="L83" rel="#L83">83</span>
+<span id="L84" rel="#L84">84</span>
+<span id="L85" rel="#L85">85</span>
+<span id="L86" rel="#L86">86</span>
+<span id="L87" rel="#L87">87</span>
+<span id="L88" rel="#L88">88</span>
+<span id="L89" rel="#L89">89</span>
+<span id="L90" rel="#L90">90</span>
+<span id="L91" rel="#L91">91</span>
+<span id="L92" rel="#L92">92</span>
+<span id="L93" rel="#L93">93</span>
+<span id="L94" rel="#L94">94</span>
+<span id="L95" rel="#L95">95</span>
+<span id="L96" rel="#L96">96</span>
+<span id="L97" rel="#L97">97</span>
+<span id="L98" rel="#L98">98</span>
+<span id="L99" rel="#L99">99</span>
+<span id="L100" rel="#L100">100</span>
+<span id="L101" rel="#L101">101</span>
+<span id="L102" rel="#L102">102</span>
+<span id="L103" rel="#L103">103</span>
+<span id="L104" rel="#L104">104</span>
+<span id="L105" rel="#L105">105</span>
+<span id="L106" rel="#L106">106</span>
+<span id="L107" rel="#L107">107</span>
+<span id="L108" rel="#L108">108</span>
+<span id="L109" rel="#L109">109</span>
+<span id="L110" rel="#L110">110</span>
+<span id="L111" rel="#L111">111</span>
+<span id="L112" rel="#L112">112</span>
+<span id="L113" rel="#L113">113</span>
+<span id="L114" rel="#L114">114</span>
+<span id="L115" rel="#L115">115</span>
+<span id="L116" rel="#L116">116</span>
+<span id="L117" rel="#L117">117</span>
+<span id="L118" rel="#L118">118</span>
+<span id="L119" rel="#L119">119</span>
+<span id="L120" rel="#L120">120</span>
+<span id="L121" rel="#L121">121</span>
+<span id="L122" rel="#L122">122</span>
+<span id="L123" rel="#L123">123</span>
+<span id="L124" rel="#L124">124</span>
+<span id="L125" rel="#L125">125</span>
+<span id="L126" rel="#L126">126</span>
+<span id="L127" rel="#L127">127</span>
+<span id="L128" rel="#L128">128</span>
+<span id="L129" rel="#L129">129</span>
+<span id="L130" rel="#L130">130</span>
+<span id="L131" rel="#L131">131</span>
+<span id="L132" rel="#L132">132</span>
+<span id="L133" rel="#L133">133</span>
+<span id="L134" rel="#L134">134</span>
+<span id="L135" rel="#L135">135</span>
+<span id="L136" rel="#L136">136</span>
+<span id="L137" rel="#L137">137</span>
+<span id="L138" rel="#L138">138</span>
+<span id="L139" rel="#L139">139</span>
+<span id="L140" rel="#L140">140</span>
+<span id="L141" rel="#L141">141</span>
+<span id="L142" rel="#L142">142</span>
+<span id="L143" rel="#L143">143</span>
+<span id="L144" rel="#L144">144</span>
+<span id="L145" rel="#L145">145</span>
+<span id="L146" rel="#L146">146</span>
+<span id="L147" rel="#L147">147</span>
+<span id="L148" rel="#L148">148</span>
+<span id="L149" rel="#L149">149</span>
+<span id="L150" rel="#L150">150</span>
+<span id="L151" rel="#L151">151</span>
+<span id="L152" rel="#L152">152</span>
+<span id="L153" rel="#L153">153</span>
+<span id="L154" rel="#L154">154</span>
+<span id="L155" rel="#L155">155</span>
+<span id="L156" rel="#L156">156</span>
+<span id="L157" rel="#L157">157</span>
+<span id="L158" rel="#L158">158</span>
+<span id="L159" rel="#L159">159</span>
+<span id="L160" rel="#L160">160</span>
+<span id="L161" rel="#L161">161</span>
+<span id="L162" rel="#L162">162</span>
+<span id="L163" rel="#L163">163</span>
+<span id="L164" rel="#L164">164</span>
+<span id="L165" rel="#L165">165</span>
+<span id="L166" rel="#L166">166</span>
+<span id="L167" rel="#L167">167</span>
+<span id="L168" rel="#L168">168</span>
+<span id="L169" rel="#L169">169</span>
+<span id="L170" rel="#L170">170</span>
+<span id="L171" rel="#L171">171</span>
+<span id="L172" rel="#L172">172</span>
+<span id="L173" rel="#L173">173</span>
+<span id="L174" rel="#L174">174</span>
+<span id="L175" rel="#L175">175</span>
+<span id="L176" rel="#L176">176</span>
+<span id="L177" rel="#L177">177</span>
+<span id="L178" rel="#L178">178</span>
+<span id="L179" rel="#L179">179</span>
+<span id="L180" rel="#L180">180</span>
+<span id="L181" rel="#L181">181</span>
+<span id="L182" rel="#L182">182</span>
+<span id="L183" rel="#L183">183</span>
+<span id="L184" rel="#L184">184</span>
+<span id="L185" rel="#L185">185</span>
+<span id="L186" rel="#L186">186</span>
+<span id="L187" rel="#L187">187</span>
+<span id="L188" rel="#L188">188</span>
+<span id="L189" rel="#L189">189</span>
+<span id="L190" rel="#L190">190</span>
+<span id="L191" rel="#L191">191</span>
+<span id="L192" rel="#L192">192</span>
+<span id="L193" rel="#L193">193</span>
+<span id="L194" rel="#L194">194</span>
+<span id="L195" rel="#L195">195</span>
+<span id="L196" rel="#L196">196</span>
+<span id="L197" rel="#L197">197</span>
+<span id="L198" rel="#L198">198</span>
+<span id="L199" rel="#L199">199</span>
+<span id="L200" rel="#L200">200</span>
+<span id="L201" rel="#L201">201</span>
+<span id="L202" rel="#L202">202</span>
+<span id="L203" rel="#L203">203</span>
+<span id="L204" rel="#L204">204</span>
+<span id="L205" rel="#L205">205</span>
+<span id="L206" rel="#L206">206</span>
+<span id="L207" rel="#L207">207</span>
+<span id="L208" rel="#L208">208</span>
+<span id="L209" rel="#L209">209</span>
+<span id="L210" rel="#L210">210</span>
+<span id="L211" rel="#L211">211</span>
+<span id="L212" rel="#L212">212</span>
+<span id="L213" rel="#L213">213</span>
+<span id="L214" rel="#L214">214</span>
+<span id="L215" rel="#L215">215</span>
+<span id="L216" rel="#L216">216</span>
+<span id="L217" rel="#L217">217</span>
+<span id="L218" rel="#L218">218</span>
+<span id="L219" rel="#L219">219</span>
+<span id="L220" rel="#L220">220</span>
+<span id="L221" rel="#L221">221</span>
+<span id="L222" rel="#L222">222</span>
+<span id="L223" rel="#L223">223</span>
+<span id="L224" rel="#L224">224</span>
+<span id="L225" rel="#L225">225</span>
+<span id="L226" rel="#L226">226</span>
+<span id="L227" rel="#L227">227</span>
+<span id="L228" rel="#L228">228</span>
+<span id="L229" rel="#L229">229</span>
+<span id="L230" rel="#L230">230</span>
+<span id="L231" rel="#L231">231</span>
+<span id="L232" rel="#L232">232</span>
+<span id="L233" rel="#L233">233</span>
+<span id="L234" rel="#L234">234</span>
+<span id="L235" rel="#L235">235</span>
+<span id="L236" rel="#L236">236</span>
+<span id="L237" rel="#L237">237</span>
+<span id="L238" rel="#L238">238</span>
+<span id="L239" rel="#L239">239</span>
+<span id="L240" rel="#L240">240</span>
+<span id="L241" rel="#L241">241</span>
+<span id="L242" rel="#L242">242</span>
+
+            </td>
+            <td class="blob-line-code">
+                    <div class="highlight"><pre><div class='line' id='LC1'><span class="c"># Copyright (c) 2009 rupa deadwyler under the WTFPL license</span></div><div class='line' id='LC2'><br/></div><div class='line' id='LC3'><span class="c"># maintains a jump-list of the directories you actually use</span></div><div class='line' id='LC4'><span class="c">#</span></div><div class='line' id='LC5'><span class="c"># INSTALL:</span></div><div class='line' id='LC6'><span class="c">#     * put something like this in your .bashrc/.zshrc:</span></div><div class='line' id='LC7'><span class="c">#         . /path/to/z.sh</span></div><div class='line' id='LC8'><span class="c">#     * cd around for a while to build up the db</span></div><div class='line' id='LC9'><span class="c">#     * PROFIT!!</span></div><div class='line' id='LC10'><span class="c">#     * optionally:</span></div><div class='line' id='LC11'><span class="c">#         set $_Z_CMD in .bashrc/.zshrc to change the command (default z).</span></div><div class='line' id='LC12'><span class="c">#         set $_Z_DATA in .bashrc/.zshrc to change the datafile (default ~/.z).</span></div><div class='line' id='LC13'><span class="c">#         set $_Z_NO_RESOLVE_SYMLINKS to prevent symlink resolution.</span></div><div class='line' id='LC14'><span class="c">#         set $_Z_NO_PROMPT_COMMAND if you&#39;re handling PROMPT_COMMAND yourself.</span></div><div class='line' id='LC15'><span class="c">#         set $_Z_EXCLUDE_DIRS to an array of directories to exclude.</span></div><div class='line' id='LC16'><span class="c">#</span></div><div class='line' id='LC17'><span class="c"># USE:</span></div><div class='line' id='LC18'><span class="c">#     * z foo     # cd to most frecent dir matching foo</span></div><div class='line' id='LC19'><span class="c">#     * z foo bar # cd to most frecent dir matching foo and bar</span></div><div class='line' id='LC20'><span class="c">#     * z -r foo  # cd to highest ranked dir matching foo</span></div><div class='line' id='LC21'><span class="c">#     * z -t foo  # cd to most recently accessed dir matching foo</span></div><div class='line' id='LC22'><span class="c">#     * z -l foo  # list matches instead of cd</span></div><div class='line' id='LC23'><span class="c">#     * z -c foo  # restrict matches to subdirs of $PWD</span></div><div class='line' id='LC24'><br/></div><div class='line' id='LC25'><span class="o">[</span> -d <span class="s2">&quot;${_Z_DATA:-$HOME/.z}&quot;</span> <span class="o">]</span> <span class="o">&amp;&amp;</span> <span class="o">{</span></div><div class='line' id='LC26'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nb">echo</span> <span class="s2">&quot;ERROR: z.sh&#39;s datafile (${_Z_DATA:-$HOME/.z}) is a directory.&quot;</span></div><div class='line' id='LC27'><span class="o">}</span></div><div class='line' id='LC28'><br/></div><div class='line' id='LC29'>_z<span class="o">()</span> <span class="o">{</span></div><div class='line' id='LC30'><br/></div><div class='line' id='LC31'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nb">local </span><span class="nv">datafile</span><span class="o">=</span><span class="s2">&quot;${_Z_DATA:-$HOME/.z}&quot;</span></div><div class='line' id='LC32'><br/></div><div class='line' id='LC33'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c"># bail if we don&#39;t own ~/.z (we&#39;re another user but our ENV is still set)</span></div><div class='line' id='LC34'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">[</span> -f <span class="s2">&quot;$datafile&quot;</span> -a ! -O <span class="s2">&quot;$datafile&quot;</span> <span class="o">]</span> <span class="o">&amp;&amp;</span> <span class="k">return</span></div><div class='line' id='LC35'><br/></div><div class='line' id='LC36'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c"># add entries</span></div><div class='line' id='LC37'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="o">[</span> <span class="s2">&quot;$1&quot;</span> <span class="o">=</span> <span class="s2">&quot;--add&quot;</span> <span class="o">]</span>; <span class="k">then</span></div><div class='line' id='LC38'><span class="k">        </span><span class="nb">shift</span></div><div class='line' id='LC39'><br/></div><div class='line' id='LC40'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c"># $HOME isn&#39;t worth matching</span></div><div class='line' id='LC41'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">[</span> <span class="s2">&quot;$*&quot;</span> <span class="o">=</span> <span class="s2">&quot;$HOME&quot;</span> <span class="o">]</span> <span class="o">&amp;&amp;</span> <span class="k">return</span></div><div class='line' id='LC42'><br/></div><div class='line' id='LC43'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c"># don&#39;t track excluded dirs</span></div><div class='line' id='LC44'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nb">local </span>exclude</div><div class='line' id='LC45'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">for </span>exclude in <span class="s2">&quot;${_Z_EXCLUDE_DIRS[@]}&quot;</span>; <span class="k">do</span></div><div class='line' id='LC46'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">[</span> <span class="s2">&quot;$*&quot;</span> <span class="o">=</span> <span class="s2">&quot;$exclude&quot;</span> <span class="o">]</span> <span class="o">&amp;&amp;</span> <span class="k">return</span></div><div class='line' id='LC47'><span class="k">        done</span></div><div class='line' id='LC48'><br/></div><div class='line' id='LC49'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c"># maintain the data file</span></div><div class='line' id='LC50'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nb">local </span><span class="nv">tempfile</span><span class="o">=</span><span class="s2">&quot;$datafile.$RANDOM&quot;</span></div><div class='line' id='LC51'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">while </span><span class="nb">read </span>line; <span class="k">do</span></div><div class='line' id='LC52'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c"># only count directories</span></div><div class='line' id='LC53'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">[</span> -d <span class="s2">&quot;${line%%\|*}&quot;</span> <span class="o">]</span> <span class="o">&amp;&amp;</span> <span class="nb">echo</span> <span class="nv">$line</span></div><div class='line' id='LC54'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">done</span> &lt; <span class="s2">&quot;$datafile&quot;</span> | awk -v <span class="nv">path</span><span class="o">=</span><span class="s2">&quot;$*&quot;</span> -v <span class="nv">now</span><span class="o">=</span><span class="s2">&quot;$(date +%s)&quot;</span> -F<span class="s2">&quot;|&quot;</span> <span class="s1">&#39;</span></div><div class='line' id='LC55'><span class="s1">            BEGIN {</span></div><div class='line' id='LC56'><span class="s1">                rank[path] = 1</span></div><div class='line' id='LC57'><span class="s1">                time[path] = now</span></div><div class='line' id='LC58'><span class="s1">            }</span></div><div class='line' id='LC59'><span class="s1">            $2 &gt;= 1 {</span></div><div class='line' id='LC60'><span class="s1">                # drop ranks below 1</span></div><div class='line' id='LC61'><span class="s1">                if( $1 == path ) {</span></div><div class='line' id='LC62'><span class="s1">                    rank[$1] = $2 + 1</span></div><div class='line' id='LC63'><span class="s1">                    time[$1] = now</span></div><div class='line' id='LC64'><span class="s1">                } else {</span></div><div class='line' id='LC65'><span class="s1">                    rank[$1] = $2</span></div><div class='line' id='LC66'><span class="s1">                    time[$1] = $3</span></div><div class='line' id='LC67'><span class="s1">                }</span></div><div class='line' id='LC68'><span class="s1">                count += $2</span></div><div class='line' id='LC69'><span class="s1">            }</span></div><div class='line' id='LC70'><span class="s1">            END {</span></div><div class='line' id='LC71'><span class="s1">                if( count &gt; 6000 ) {</span></div><div class='line' id='LC72'><span class="s1">                    # aging</span></div><div class='line' id='LC73'><span class="s1">                    for( x in rank ) print x &quot;|&quot; 0.99*rank[x] &quot;|&quot; time[x]</span></div><div class='line' id='LC74'><span class="s1">                } else for( x in rank ) print x &quot;|&quot; rank[x] &quot;|&quot; time[x]</span></div><div class='line' id='LC75'><span class="s1">            }</span></div><div class='line' id='LC76'><span class="s1">        &#39;</span> 2&gt;/dev/null &gt;| <span class="s2">&quot;$tempfile&quot;</span></div><div class='line' id='LC77'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c"># do our best to avoid clobbering the datafile in a race condition</span></div><div class='line' id='LC78'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="o">[</span> <span class="nv">$?</span> -ne 0 -a -f <span class="s2">&quot;$datafile&quot;</span> <span class="o">]</span>; <span class="k">then</span></div><div class='line' id='LC79'><span class="k">            </span>env rm -f <span class="s2">&quot;$tempfile&quot;</span></div><div class='line' id='LC80'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">else</span></div><div class='line' id='LC81'><span class="k">            </span>env mv -f <span class="s2">&quot;$tempfile&quot;</span> <span class="s2">&quot;$datafile&quot;</span> <span class="o">||</span> env rm -f <span class="s2">&quot;$tempfile&quot;</span></div><div class='line' id='LC82'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">fi</span></div><div class='line' id='LC83'><br/></div><div class='line' id='LC84'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c"># tab completion</span></div><div class='line' id='LC85'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">elif</span> <span class="o">[</span> <span class="s2">&quot;$1&quot;</span> <span class="o">=</span> <span class="s2">&quot;--complete&quot;</span> <span class="o">]</span>; <span class="k">then</span></div><div class='line' id='LC86'><span class="k">        while </span><span class="nb">read </span>line; <span class="k">do</span></div><div class='line' id='LC87'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">[</span> -d <span class="s2">&quot;${line%%\|*}&quot;</span> <span class="o">]</span> <span class="o">&amp;&amp;</span> <span class="nb">echo</span> <span class="nv">$line</span></div><div class='line' id='LC88'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">done</span> &lt; <span class="s2">&quot;$datafile&quot;</span> | awk -v <span class="nv">q</span><span class="o">=</span><span class="s2">&quot;$2&quot;</span> -F<span class="s2">&quot;|&quot;</span> <span class="s1">&#39;</span></div><div class='line' id='LC89'><span class="s1">            BEGIN {</span></div><div class='line' id='LC90'><span class="s1">                if( q == tolower(q) ) imatch = 1</span></div><div class='line' id='LC91'><span class="s1">                split(substr(q, 3), fnd, &quot; &quot;)</span></div><div class='line' id='LC92'><span class="s1">            }</span></div><div class='line' id='LC93'><span class="s1">            {</span></div><div class='line' id='LC94'><span class="s1">                if( imatch ) {</span></div><div class='line' id='LC95'><span class="s1">                    for( x in fnd ) tolower($1) !~ tolower(fnd[x]) &amp;&amp; $1 = &quot;&quot;</span></div><div class='line' id='LC96'><span class="s1">                } else {</span></div><div class='line' id='LC97'><span class="s1">                    for( x in fnd ) $1 !~ fnd[x] &amp;&amp; $1 = &quot;&quot;</span></div><div class='line' id='LC98'><span class="s1">                }</span></div><div class='line' id='LC99'><span class="s1">                if( $1 ) print $1</span></div><div class='line' id='LC100'><span class="s1">            }</span></div><div class='line' id='LC101'><span class="s1">        &#39;</span> 2&gt;/dev/null</div><div class='line' id='LC102'><br/></div><div class='line' id='LC103'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">else</span></div><div class='line' id='LC104'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c"># list/go</span></div><div class='line' id='LC105'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">while</span> <span class="o">[</span> <span class="s2">&quot;$1&quot;</span> <span class="o">]</span>; <span class="k">do case</span> <span class="s2">&quot;$1&quot;</span> in</div><div class='line' id='LC106'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--<span class="o">)</span> <span class="k">while</span> <span class="o">[</span> <span class="s2">&quot;$1&quot;</span> <span class="o">]</span>; <span class="k">do </span><span class="nb">shift</span>; <span class="nb">local </span><span class="nv">fnd</span><span class="o">=</span><span class="s2">&quot;$fnd${fnd:+ }$1&quot;</span>;<span class="k">done</span>;;</div><div class='line' id='LC107'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-*<span class="o">)</span> <span class="nb">local </span><span class="nv">opt</span><span class="o">=</span><span class="k">${</span><span class="nv">1</span><span class="p">:</span><span class="nv">1</span><span class="k">}</span>; <span class="k">while</span> <span class="o">[</span> <span class="s2">&quot;$opt&quot;</span> <span class="o">]</span>; <span class="k">do case</span> <span class="k">${</span><span class="nv">opt</span><span class="p">:</span><span class="nv">0</span><span class="p">:</span><span class="nv">1</span><span class="k">}</span> in</div><div class='line' id='LC108'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c<span class="o">)</span> <span class="nb">local </span><span class="nv">fnd</span><span class="o">=</span><span class="s2">&quot;^$PWD $fnd&quot;</span>;;</div><div class='line' id='LC109'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;h<span class="o">)</span> <span class="nb">echo</span> <span class="s2">&quot;${_Z_CMD:-z} [-chlrtx] args&quot;</span> &gt;&amp;2; <span class="k">return</span>;;</div><div class='line' id='LC110'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;x<span class="o">)</span> sed -i <span class="s2">&quot;\:^${PWD}|.*:d&quot;</span> <span class="s2">&quot;$datafile&quot;</span>;;</div><div class='line' id='LC111'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;l<span class="o">)</span> <span class="nb">local </span><span class="nv">list</span><span class="o">=</span>1;;</div><div class='line' id='LC112'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;r<span class="o">)</span> <span class="nb">local </span><span class="nv">typ</span><span class="o">=</span><span class="s2">&quot;rank&quot;</span>;;</div><div class='line' id='LC113'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;t<span class="o">)</span> <span class="nb">local </span><span class="nv">typ</span><span class="o">=</span><span class="s2">&quot;recent&quot;</span>;;</div><div class='line' id='LC114'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">esac</span>; <span class="nv">opt</span><span class="o">=</span><span class="k">${</span><span class="nv">opt</span><span class="p">:</span><span class="nv">1</span><span class="k">}</span>; <span class="k">done</span>;;</div><div class='line' id='LC115'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*<span class="o">)</span> <span class="nb">local </span><span class="nv">fnd</span><span class="o">=</span><span class="s2">&quot;$fnd${fnd:+ }$1&quot;</span>;;</div><div class='line' id='LC116'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">esac</span>; <span class="nb">local </span><span class="nv">last</span><span class="o">=</span><span class="nv">$1</span>; <span class="nb">shift</span>; <span class="k">done</span></div><div class='line' id='LC117'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">[</span> <span class="s2">&quot;$fnd&quot;</span> -a <span class="s2">&quot;$fnd&quot;</span> !<span class="o">=</span> <span class="s2">&quot;^$PWD &quot;</span> <span class="o">]</span> <span class="o">||</span> <span class="nb">local </span><span class="nv">list</span><span class="o">=</span>1</div><div class='line' id='LC118'><br/></div><div class='line' id='LC119'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c"># if we hit enter on a completion just go there</span></div><div class='line' id='LC120'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">case</span> <span class="s2">&quot;$last&quot;</span> in</div><div class='line' id='LC121'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c"># completions will always start with /</span></div><div class='line' id='LC122'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*<span class="o">)</span> <span class="o">[</span> -z <span class="s2">&quot;$list&quot;</span> -a -d <span class="s2">&quot;$last&quot;</span> <span class="o">]</span> <span class="o">&amp;&amp;</span> <span class="nb">cd</span> <span class="s2">&quot;$last&quot;</span> <span class="o">&amp;&amp;</span> <span class="k">return</span>;;</div><div class='line' id='LC123'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">esac</span></div><div class='line' id='LC124'><br/></div><div class='line' id='LC125'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c"># no file yet</span></div><div class='line' id='LC126'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">[</span> -f <span class="s2">&quot;$datafile&quot;</span> <span class="o">]</span> <span class="o">||</span> <span class="k">return</span></div><div class='line' id='LC127'><br/></div><div class='line' id='LC128'><span class="k">        </span><span class="nb">local cd</span></div><div class='line' id='LC129'><span class="nb">        cd</span><span class="o">=</span><span class="s2">&quot;$(while read line; do</span></div><div class='line' id='LC130'><span class="s2">            [ -d &quot;</span><span class="k">${</span><span class="nv">line</span><span class="p">%%\|*</span><span class="k">}</span><span class="s2">&quot; ] &amp;&amp; echo $line</span></div><div class='line' id='LC131'><span class="s2">        done &lt; &quot;</span><span class="nv">$datafile</span><span class="s2">&quot; | awk -v t=&quot;</span><span class="k">$(</span>date +%s<span class="k">)</span><span class="s2">&quot; -v list=&quot;</span><span class="nv">$list</span><span class="s2">&quot; -v typ=&quot;</span><span class="nv">$typ</span><span class="s2">&quot; -v q=&quot;</span><span class="nv">$fnd</span><span class="s2">&quot; -F&quot;</span>|<span class="s2">&quot; &#39;</span></div><div class='line' id='LC132'><span class="s2">            function frecent(rank, time) {</span></div><div class='line' id='LC133'><span class="s2">                # relate frequency and time</span></div><div class='line' id='LC134'><span class="s2">                dx = t - time</span></div><div class='line' id='LC135'><span class="s2">                if( dx &lt; 3600 ) return rank * 4</span></div><div class='line' id='LC136'><span class="s2">                if( dx &lt; 86400 ) return rank * 2</span></div><div class='line' id='LC137'><span class="s2">                if( dx &lt; 604800 ) return rank / 2</span></div><div class='line' id='LC138'><span class="s2">                return rank / 4</span></div><div class='line' id='LC139'><span class="s2">            }</span></div><div class='line' id='LC140'><span class="s2">            function output(files, out, common) {</span></div><div class='line' id='LC141'><span class="s2">                # list or return the desired directory</span></div><div class='line' id='LC142'><span class="s2">                if( list ) {</span></div><div class='line' id='LC143'><span class="s2">                    cmd = &quot;</span>sort -n &gt;&amp;2<span class="s2">&quot;</span></div><div class='line' id='LC144'><span class="s2">                    for( x in files ) {</span></div><div class='line' id='LC145'><span class="s2">                        if( files[x] ) printf &quot;</span>%-10s %s<span class="se">\n</span><span class="s2">&quot;, files[x], x | cmd</span></div><div class='line' id='LC146'><span class="s2">                    }</span></div><div class='line' id='LC147'><span class="s2">                    if( common ) {</span></div><div class='line' id='LC148'><span class="s2">                        printf &quot;</span>%-10s %s<span class="se">\n</span><span class="s2">&quot;, &quot;</span>common:<span class="s2">&quot;, common &gt; &quot;</span>/dev/stderr<span class="s2">&quot;</span></div><div class='line' id='LC149'><span class="s2">                    }</span></div><div class='line' id='LC150'><span class="s2">                } else {</span></div><div class='line' id='LC151'><span class="s2">                    if( common ) out = common</span></div><div class='line' id='LC152'><span class="s2">                    print out</span></div><div class='line' id='LC153'><span class="s2">                }</span></div><div class='line' id='LC154'><span class="s2">            }</span></div><div class='line' id='LC155'><span class="s2">            function common(matches) {</span></div><div class='line' id='LC156'><span class="s2">                # find the common root of a list of matches, if it exists</span></div><div class='line' id='LC157'><span class="s2">                for( x in matches ) {</span></div><div class='line' id='LC158'><span class="s2">                    if( matches[x] &amp;&amp; (!short || length(x) &lt; length(short)) ) {</span></div><div class='line' id='LC159'><span class="s2">                        short = x</span></div><div class='line' id='LC160'><span class="s2">                    }</span></div><div class='line' id='LC161'><span class="s2">                }</span></div><div class='line' id='LC162'><span class="s2">                if( short == &quot;</span>/<span class="s2">&quot; ) return</span></div><div class='line' id='LC163'><span class="s2">                # use a copy to escape special characters, as we want to return</span></div><div class='line' id='LC164'><span class="s2">                # the original. yeah, this escaping is awful.</span></div><div class='line' id='LC165'><span class="s2">                clean_short = short</span></div><div class='line' id='LC166'><span class="s2">                gsub(/[\(\)\[\]\|]/, &quot;</span><span class="se">\\\\</span>&amp;<span class="s2">&quot;, clean_short)</span></div><div class='line' id='LC167'><span class="s2">                for( x in matches ) if( matches[x] &amp;&amp; x !~ clean_short ) return</span></div><div class='line' id='LC168'><span class="s2">                return short</span></div><div class='line' id='LC169'><span class="s2">            }</span></div><div class='line' id='LC170'><span class="s2">            BEGIN { split(q, words, &quot;</span> <span class="s2">&quot;); hi_rank = ihi_rank = -9999999999 }</span></div><div class='line' id='LC171'><span class="s2">            {</span></div><div class='line' id='LC172'><span class="s2">                if( typ == &quot;</span>rank<span class="s2">&quot; ) {</span></div><div class='line' id='LC173'><span class="s2">                    rank = $2</span></div><div class='line' id='LC174'><span class="s2">                } else if( typ == &quot;</span>recent<span class="s2">&quot; ) {</span></div><div class='line' id='LC175'><span class="s2">                    rank = $3 - t</span></div><div class='line' id='LC176'><span class="s2">                } else rank = frecent($2, $3)</span></div><div class='line' id='LC177'><span class="s2">                matches[$1] = imatches[$1] = rank</span></div><div class='line' id='LC178'><span class="s2">                for( x in words ) {</span></div><div class='line' id='LC179'><span class="s2">                    if( $1 !~ words[x] ) delete matches[$1]</span></div><div class='line' id='LC180'><span class="s2">                    if( tolower($1) !~ tolower(words[x]) ) delete imatches[$1]</span></div><div class='line' id='LC181'><span class="s2">                }</span></div><div class='line' id='LC182'><span class="s2">                if( matches[$1] &amp;&amp; matches[$1] &gt; hi_rank ) {</span></div><div class='line' id='LC183'><span class="s2">                    best_match = $1</span></div><div class='line' id='LC184'><span class="s2">                    hi_rank = matches[$1]</span></div><div class='line' id='LC185'><span class="s2">                } else if( imatches[$1] &amp;&amp; imatches[$1] &gt; ihi_rank ) {</span></div><div class='line' id='LC186'><span class="s2">                    ibest_match = $1</span></div><div class='line' id='LC187'><span class="s2">                    ihi_rank = imatches[$1]</span></div><div class='line' id='LC188'><span class="s2">                }</span></div><div class='line' id='LC189'><span class="s2">            }</span></div><div class='line' id='LC190'><span class="s2">            END {</span></div><div class='line' id='LC191'><span class="s2">                # prefer case sensitive</span></div><div class='line' id='LC192'><span class="s2">                if( best_match ) {</span></div><div class='line' id='LC193'><span class="s2">                    output(matches, best_match, common(matches))</span></div><div class='line' id='LC194'><span class="s2">                } else if( ibest_match ) {</span></div><div class='line' id='LC195'><span class="s2">                    output(imatches, ibest_match, common(imatches))</span></div><div class='line' id='LC196'><span class="s2">                }</span></div><div class='line' id='LC197'><span class="s2">            }</span></div><div class='line' id='LC198'><span class="s2">        &#39;)&quot;</span></div><div class='line' id='LC199'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">[</span> <span class="nv">$?</span> -gt 0 <span class="o">]</span> <span class="o">&amp;&amp;</span> <span class="k">return</span></div><div class='line' id='LC200'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">[</span> <span class="s2">&quot;$cd&quot;</span> <span class="o">]</span> <span class="o">&amp;&amp;</span> <span class="nb">cd</span> <span class="s2">&quot;$cd&quot;</span></div><div class='line' id='LC201'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">fi</span></div><div class='line' id='LC202'><span class="o">}</span></div><div class='line' id='LC203'><br/></div><div class='line' id='LC204'><span class="nb">alias</span> <span class="k">${</span><span class="nv">_Z_CMD</span><span class="k">:-</span><span class="nv">z</span><span class="k">}</span><span class="o">=</span><span class="s1">&#39;_z 2&gt;&amp;1&#39;</span></div><div class='line' id='LC205'><br/></div><div class='line' id='LC206'><span class="o">[</span> <span class="s2">&quot;$_Z_NO_RESOLVE_SYMLINKS&quot;</span> <span class="o">]</span> <span class="o">||</span> <span class="nv">_Z_RESOLVE_SYMLINKS</span><span class="o">=</span><span class="s2">&quot;-P&quot;</span></div><div class='line' id='LC207'><br/></div><div class='line' id='LC208'><span class="k">if </span>compctl &gt;/dev/null 2&gt;&amp;1; <span class="k">then</span></div><div class='line' id='LC209'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c"># zsh</span></div><div class='line' id='LC210'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">[</span> <span class="s2">&quot;$_Z_NO_PROMPT_COMMAND&quot;</span> <span class="o">]</span> <span class="o">||</span> <span class="o">{</span></div><div class='line' id='LC211'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c"># populate directory list, avoid clobbering any other precmds.</span></div><div class='line' id='LC212'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span> <span class="o">[</span> <span class="s2">&quot;$_Z_NO_RESOLVE_SYMLINKS&quot;</span> <span class="o">]</span>; <span class="k">then</span></div><div class='line' id='LC213'><span class="k">            </span>_z_precmd<span class="o">()</span> <span class="o">{</span></div><div class='line' id='LC214'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_z --add <span class="s2">&quot;${PWD:a}&quot;</span></div><div class='line' id='LC215'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">}</span></div><div class='line' id='LC216'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">else</span></div><div class='line' id='LC217'><span class="k">            </span>_z_precmd<span class="o">()</span> <span class="o">{</span></div><div class='line' id='LC218'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_z --add <span class="s2">&quot;${PWD:A}&quot;</span></div><div class='line' id='LC219'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">}</span></div><div class='line' id='LC220'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">fi</span></div><div class='line' id='LC221'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">[[</span> -n <span class="s2">&quot;${precmd_functions[(r)_z_precmd]}&quot;</span> <span class="o">]]</span> <span class="o">||</span> <span class="o">{</span></div><div class='line' id='LC222'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;precmd_functions+<span class="o">=(</span>_z_precmd<span class="o">)</span></div><div class='line' id='LC223'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">}</span></div><div class='line' id='LC224'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">}</span></div><div class='line' id='LC225'>&nbsp;&nbsp;&nbsp;&nbsp;_z_zsh_tab_completion<span class="o">()</span> <span class="o">{</span></div><div class='line' id='LC226'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c"># tab completion</span></div><div class='line' id='LC227'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nb">local </span>compl</div><div class='line' id='LC228'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nb">read</span> -l compl</div><div class='line' id='LC229'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">reply</span><span class="o">=(</span><span class="k">${</span><span class="p">(f)</span><span class="s2">&quot;$(_z --complete &quot;</span><span class="nv">$compl</span><span class="s2">&quot;)&quot;</span><span class="k">}</span><span class="o">)</span></div><div class='line' id='LC230'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">}</span></div><div class='line' id='LC231'>&nbsp;&nbsp;&nbsp;&nbsp;compctl -U -K _z_zsh_tab_completion _z</div><div class='line' id='LC232'><span class="k">elif </span><span class="nb">complete</span> &gt;/dev/null 2&gt;&amp;1; <span class="k">then</span></div><div class='line' id='LC233'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c"># bash</span></div><div class='line' id='LC234'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="c"># tab completion</span></div><div class='line' id='LC235'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nb">complete</span> -o filenames -C <span class="s1">&#39;_z --complete &quot;$COMP_LINE&quot;&#39;</span> <span class="k">${</span><span class="nv">_Z_CMD</span><span class="k">:-</span><span class="nv">z</span><span class="k">}</span></div><div class='line' id='LC236'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">[</span> <span class="s2">&quot;$_Z_NO_PROMPT_COMMAND&quot;</span> <span class="o">]</span> <span class="o">||</span> <span class="o">{</span></div><div class='line' id='LC237'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c"># populate directory list. avoid clobbering other PROMPT_COMMANDs.</span></div><div class='line' id='LC238'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;grep <span class="s2">&quot;_z --add&quot;</span> <span class="o">&lt;&lt;&lt;</span> <span class="s2">&quot;$PROMPT_COMMAND&quot;</span> &gt;/dev/null <span class="o">||</span> <span class="o">{</span></div><div class='line' id='LC239'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nv">PROMPT_COMMAND</span><span class="o">=</span><span class="s2">&quot;$PROMPT_COMMAND&quot;</span><span class="s1">$&#39;\n&#39;&#39;_z --add &quot;$(pwd &#39;</span><span class="nv">$_Z_RESOLVE_SYMLINKS</span><span class="s1">&#39; 2&gt;/dev/null)&quot; 2&gt;/dev/null;&#39;</span></div><div class='line' id='LC240'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">}</span></div><div class='line' id='LC241'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">}</span></div><div class='line' id='LC242'><span class="k">fi</span></div></pre></div>
+            </td>
+          </tr>
+        </table>
+  </div>
+
+  </div>
+</div>
+
+<a href="#jump-to-line" rel="facebox[.linejump]" data-hotkey="l" class="js-jump-to-line" style="display:none">Jump to Line</a>
+<div id="jump-to-line" style="display:none">
+  <form accept-charset="UTF-8" class="js-jump-to-line-form">
+    <input class="linejump-input js-jump-to-line-field" type="text" placeholder="Jump to line&hellip;" autofocus>
+    <button type="submit" class="button">Go</button>
+  </form>
+</div>
+
+        </div>
+
+      </div><!-- /.repo-container -->
+      <div class="modal-backdrop"></div>
+    </div><!-- /.container -->
+  </div><!-- /.site -->
+
+
+    </div><!-- /.wrapper -->
+
+      <div class="container">
+  <div class="site-footer">
+    <ul class="site-footer-links right">
+      <li><a href="https://status.github.com/">Status</a></li>
+      <li><a href="http://developer.github.com">API</a></li>
+      <li><a href="http://training.github.com">Training</a></li>
+      <li><a href="http://shop.github.com">Shop</a></li>
+      <li><a href="/blog">Blog</a></li>
+      <li><a href="/about">About</a></li>
+
+    </ul>
+
+    <a href="/">
+      <span class="mega-octicon octicon-mark-github"></span>
+    </a>
+
+    <ul class="site-footer-links">
+      <li>&copy; 2013 <span title="0.02088s from github-fe132-cp1-prd.iad.github.net">GitHub</span>, Inc.</li>
+        <li><a href="/site/terms">Terms</a></li>
+        <li><a href="/site/privacy">Privacy</a></li>
+        <li><a href="/security">Security</a></li>
+        <li><a href="/contact">Contact</a></li>
+    </ul>
+  </div><!-- /.site-footer -->
+</div><!-- /.container -->
+
+
+    <div class="fullscreen-overlay js-fullscreen-overlay" id="fullscreen_overlay">
+  <div class="fullscreen-container js-fullscreen-container">
+    <div class="textarea-wrap">
+      <textarea name="fullscreen-contents" id="fullscreen-contents" class="js-fullscreen-contents" placeholder="" data-suggester="fullscreen_suggester"></textarea>
+          <div class="suggester-container">
+              <div class="suggester fullscreen-suggester js-navigation-container" id="fullscreen_suggester"
+                 data-url="/rupa/z/suggestions/commit">
+              </div>
+          </div>
+    </div>
+  </div>
+  <div class="fullscreen-sidebar">
+    <a href="#" class="exit-fullscreen js-exit-fullscreen tooltipped leftwards" title="Exit Zen Mode">
+      <span class="mega-octicon octicon-screen-normal"></span>
+    </a>
+    <a href="#" class="theme-switcher js-theme-switcher tooltipped leftwards"
+      title="Switch themes">
+      <span class="octicon octicon-color-mode"></span>
+    </a>
+  </div>
+</div>
+
+
+
+    <div id="ajax-error-message" class="flash flash-error">
+      <span class="octicon octicon-alert"></span>
+      <a href="#" class="octicon octicon-remove-close close ajax-error-dismiss"></a>
+      Something went wrong with that request. Please try again.
+    </div>
+
+  </body>
+</html>
+