Commits

Jesse London  committed b49d115 Draft Merge

Automated merge with ssh://bitbucket.org/jester/dropbox

  • Participants
  • Parent commits 5f5c38a, f71abc8

Comments (0)

Files changed (44)

 syntax: glob
+*.swp
 *.pyc
+.vim/.netrwhist
+*.egg-info/*

File .vim/.netrwhist

-let g:netrw_dirhistmax  =10
-let g:netrw_dirhist_cnt =9
-let g:netrw_dirhist_1='/Users/jesse.london/work/qa/analyte/shared/apps/core/market/migrations'
-let g:netrw_dirhist_2='/Users/jesse.london/work/qa/analyte/shared/apps/core/migrations'
-let g:netrw_dirhist_3='/Users/jesse.london/work/qa/resources'
-let g:netrw_dirhist_4='/Users/jesse.london/work/qa/resources/scheduled_jobs'
-let g:netrw_dirhist_5='/Users/jesse.london/work/dev/analyte/shared/apps/core/migrations'
-let g:netrw_dirhist_6='/Users/jester/sandbox/analyte/qa/deploy'
-let g:netrw_dirhist_7='/Users/jester/sandbox/analyte/dev/analyte/shared/apps/core/commerce/views'
-let g:netrw_dirhist_8='/Users/jester/sandbox/tech/cs/parser'
-let g:netrw_dirhist_9='/Users/jesse.london/work/jesse/analyte/shared/mail/branded'

File .vim/bundle/ctrlp.vim/.git/HEAD

+ref: refs/heads/master

File .vim/bundle/ctrlp.vim/.git/config

+[core]
+	repositoryformatversion = 0
+	filemode = true
+	bare = false
+	logallrefupdates = true
+[remote "origin"]
+	fetch = +refs/heads/*:refs/remotes/origin/*
+	url = https://github.com/kien/ctrlp.vim.git
+[branch "master"]
+	remote = origin
+	merge = refs/heads/master

File .vim/bundle/ctrlp.vim/.git/description

+Unnamed repository; edit this file 'description' to name the repository.

File .vim/bundle/ctrlp.vim/.git/hooks/applypatch-msg.sample

+#!/bin/sh
+#
+# An example hook script to check the commit log message taken by
+# applypatch from an e-mail message.
+#
+# The hook should exit with non-zero status after issuing an
+# appropriate message if it wants to stop the commit.  The hook is
+# allowed to edit the commit message file.
+#
+# To enable this hook, rename this file to "applypatch-msg".
+
+. git-sh-setup
+test -x "$GIT_DIR/hooks/commit-msg" &&
+	exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
+:

File .vim/bundle/ctrlp.vim/.git/hooks/commit-msg.sample

+#!/bin/sh
+#
+# An example hook script to check the commit log message.
+# Called by git-commit with one argument, the name of the file
+# that has the commit message.  The hook should exit with non-zero
+# status after issuing an appropriate message if it wants to stop the
+# commit.  The hook is allowed to edit the commit message file.
+#
+# To enable this hook, rename this file to "commit-msg".
+
+# Uncomment the below to add a Signed-off-by line to the message.
+# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
+# hook is more suited to it.
+#
+# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
+# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
+
+# This example catches duplicate Signed-off-by lines.
+
+test "" = "$(grep '^Signed-off-by: ' "$1" |
+	 sort | uniq -c | sed -e '/^[ 	]*1[ 	]/d')" || {
+	echo >&2 Duplicate Signed-off-by lines.
+	exit 1
+}

File .vim/bundle/ctrlp.vim/.git/hooks/post-commit.sample

+#!/bin/sh
+#
+# An example hook script that is called after a successful
+# commit is made.
+#
+# To enable this hook, rename this file to "post-commit".
+
+: Nothing

File .vim/bundle/ctrlp.vim/.git/hooks/post-receive.sample

+#!/bin/sh
+#
+# An example hook script for the "post-receive" event.
+#
+# The "post-receive" script is run after receive-pack has accepted a pack
+# and the repository has been updated.  It is passed arguments in through
+# stdin in the form
+#  <oldrev> <newrev> <refname>
+# For example:
+#  aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
+#
+# see contrib/hooks/ for a sample, or uncomment the next line and
+# rename the file to "post-receive".
+
+#. /usr/share/doc/git-core/contrib/hooks/post-receive-email

File .vim/bundle/ctrlp.vim/.git/hooks/post-update.sample

+#!/bin/sh
+#
+# An example hook script to prepare a packed repository for use over
+# dumb transports.
+#
+# To enable this hook, rename this file to "post-update".
+
+exec git-update-server-info

File .vim/bundle/ctrlp.vim/.git/hooks/pre-applypatch.sample

+#!/bin/sh
+#
+# An example hook script to verify what is about to be committed
+# by applypatch from an e-mail message.
+#
+# The hook should exit with non-zero status after issuing an
+# appropriate message if it wants to stop the commit.
+#
+# To enable this hook, rename this file to "pre-applypatch".
+
+. git-sh-setup
+test -x "$GIT_DIR/hooks/pre-commit" &&
+	exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"}
+:

File .vim/bundle/ctrlp.vim/.git/hooks/pre-commit.sample

+#!/bin/sh
+#
+# An example hook script to verify what is about to be committed.
+# Called by git-commit with no arguments.  The hook should
+# exit with non-zero status after issuing an appropriate message if
+# it wants to stop the commit.
+#
+# To enable this hook, rename this file to "pre-commit".
+
+if git-rev-parse --verify HEAD >/dev/null 2>&1
+then
+	against=HEAD
+else
+	# Initial commit: diff against an empty tree object
+	against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
+fi
+
+# If you want to allow non-ascii filenames set this variable to true.
+allownonascii=$(git config hooks.allownonascii)
+
+# Cross platform projects tend to avoid non-ascii filenames; prevent
+# them from being added to the repository. We exploit the fact that the
+# printable range starts at the space character and ends with tilde.
+if [ "$allownonascii" != "true" ] &&
+	# Note that the use of brackets around a tr range is ok here, (it's
+	# even required, for portability to Solaris 10's /usr/bin/tr), since
+	# the square bracket bytes happen to fall in the designated range.
+	test "$(git diff --cached --name-only --diff-filter=A -z $against |
+	  LC_ALL=C tr -d '[ -~]\0')"
+then
+	echo "Error: Attempt to add a non-ascii file name."
+	echo
+	echo "This can cause problems if you want to work"
+	echo "with people on other platforms."
+	echo
+	echo "To be portable it is advisable to rename the file ..."
+	echo
+	echo "If you know what you are doing you can disable this"
+	echo "check using:"
+	echo
+	echo "  git config hooks.allownonascii true"
+	echo
+	exit 1
+fi
+
+exec git diff-index --check --cached $against --

File .vim/bundle/ctrlp.vim/.git/hooks/pre-rebase.sample

+#!/bin/sh
+#
+# Copyright (c) 2006, 2008 Junio C Hamano
+#
+# The "pre-rebase" hook is run just before "git-rebase" starts doing
+# its job, and can prevent the command from running by exiting with
+# non-zero status.
+#
+# The hook is called with the following parameters:
+#
+# $1 -- the upstream the series was forked from.
+# $2 -- the branch being rebased (or empty when rebasing the current branch).
+#
+# This sample shows how to prevent topic branches that are already
+# merged to 'next' branch from getting rebased, because allowing it
+# would result in rebasing already published history.
+
+publish=next
+basebranch="$1"
+if test "$#" = 2
+then
+	topic="refs/heads/$2"
+else
+	topic=`git symbolic-ref HEAD` ||
+	exit 0 ;# we do not interrupt rebasing detached HEAD
+fi
+
+case "$topic" in
+refs/heads/??/*)
+	;;
+*)
+	exit 0 ;# we do not interrupt others.
+	;;
+esac
+
+# Now we are dealing with a topic branch being rebased
+# on top of master.  Is it OK to rebase it?
+
+# Does the topic really exist?
+git show-ref -q "$topic" || {
+	echo >&2 "No such branch $topic"
+	exit 1
+}
+
+# Is topic fully merged to master?
+not_in_master=`git-rev-list --pretty=oneline ^master "$topic"`
+if test -z "$not_in_master"
+then
+	echo >&2 "$topic is fully merged to master; better remove it."
+	exit 1 ;# we could allow it, but there is no point.
+fi
+
+# Is topic ever merged to next?  If so you should not be rebasing it.
+only_next_1=`git-rev-list ^master "^$topic" ${publish} | sort`
+only_next_2=`git-rev-list ^master           ${publish} | sort`
+if test "$only_next_1" = "$only_next_2"
+then
+	not_in_topic=`git-rev-list "^$topic" master`
+	if test -z "$not_in_topic"
+	then
+		echo >&2 "$topic is already up-to-date with master"
+		exit 1 ;# we could allow it, but there is no point.
+	else
+		exit 0
+	fi
+else
+	not_in_next=`git-rev-list --pretty=oneline ^${publish} "$topic"`
+	perl -e '
+		my $topic = $ARGV[0];
+		my $msg = "* $topic has commits already merged to public branch:\n";
+		my (%not_in_next) = map {
+			/^([0-9a-f]+) /;
+			($1 => 1);
+		} split(/\n/, $ARGV[1]);
+		for my $elem (map {
+				/^([0-9a-f]+) (.*)$/;
+				[$1 => $2];
+			} split(/\n/, $ARGV[2])) {
+			if (!exists $not_in_next{$elem->[0]}) {
+				if ($msg) {
+					print STDERR $msg;
+					undef $msg;
+				}
+				print STDERR " $elem->[1]\n";
+			}
+		}
+	' "$topic" "$not_in_next" "$not_in_master"
+	exit 1
+fi
+
+exit 0
+
+################################################################
+
+This sample hook safeguards topic branches that have been
+published from being rewound.
+
+The workflow assumed here is:
+
+ * Once a topic branch forks from "master", "master" is never
+   merged into it again (either directly or indirectly).
+
+ * Once a topic branch is fully cooked and merged into "master",
+   it is deleted.  If you need to build on top of it to correct
+   earlier mistakes, a new topic branch is created by forking at
+   the tip of the "master".  This is not strictly necessary, but
+   it makes it easier to keep your history simple.
+
+ * Whenever you need to test or publish your changes to topic
+   branches, merge them into "next" branch.
+
+The script, being an example, hardcodes the publish branch name
+to be "next", but it is trivial to make it configurable via
+$GIT_DIR/config mechanism.
+
+With this workflow, you would want to know:
+
+(1) ... if a topic branch has ever been merged to "next".  Young
+    topic branches can have stupid mistakes you would rather
+    clean up before publishing, and things that have not been
+    merged into other branches can be easily rebased without
+    affecting other people.  But once it is published, you would
+    not want to rewind it.
+
+(2) ... if a topic branch has been fully merged to "master".
+    Then you can delete it.  More importantly, you should not
+    build on top of it -- other people may already want to
+    change things related to the topic as patches against your
+    "master", so if you need further changes, it is better to
+    fork the topic (perhaps with the same name) afresh from the
+    tip of "master".
+
+Let's look at this example:
+
+		   o---o---o---o---o---o---o---o---o---o "next"
+		  /       /           /           /
+		 /   a---a---b A     /           /
+		/   /               /           /
+	       /   /   c---c---c---c B         /
+	      /   /   /             \         /
+	     /   /   /   b---b C     \       /
+	    /   /   /   /             \     /
+    ---o---o---o---o---o---o---o---o---o---o---o "master"
+
+
+A, B and C are topic branches.
+
+ * A has one fix since it was merged up to "next".
+
+ * B has finished.  It has been fully merged up to "master" and "next",
+   and is ready to be deleted.
+
+ * C has not merged to "next" at all.
+
+We would want to allow C to be rebased, refuse A, and encourage
+B to be deleted.
+
+To compute (1):
+
+	git-rev-list ^master ^topic next
+	git-rev-list ^master        next
+
+	if these match, topic has not merged in next at all.
+
+To compute (2):
+
+	git-rev-list master..topic
+
+	if this is empty, it is fully merged to "master".

File .vim/bundle/ctrlp.vim/.git/hooks/prepare-commit-msg.sample

+#!/bin/sh
+#
+# An example hook script to prepare the commit log message.
+# Called by git-commit with the name of the file that has the
+# commit message, followed by the description of the commit
+# message's source.  The hook's purpose is to edit the commit
+# message file.  If the hook fails with a non-zero status,
+# the commit is aborted.
+#
+# To enable this hook, rename this file to "prepare-commit-msg".
+
+# This hook includes three examples.  The first comments out the
+# "Conflicts:" part of a merge commit.
+#
+# The second includes the output of "git diff --name-status -r"
+# into the message, just before the "git status" output.  It is
+# commented because it doesn't cope with --amend or with squashed
+# commits.
+#
+# The third example adds a Signed-off-by line to the message, that can
+# still be edited.  This is rarely a good idea.
+
+case "$2,$3" in
+  merge,)
+    perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
+
+# ,|template,)
+#   perl -i.bak -pe '
+#      print "\n" . `git diff --cached --name-status -r`
+#	 if /^#/ && $first++ == 0' "$1" ;;
+
+  *) ;;
+esac
+
+# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
+# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"

File .vim/bundle/ctrlp.vim/.git/hooks/update.sample

+#!/bin/sh
+#
+# An example hook script to blocks unannotated tags from entering.
+# Called by git-receive-pack with arguments: refname sha1-old sha1-new
+#
+# To enable this hook, rename this file to "update".
+#
+# Config
+# ------
+# hooks.allowunannotated
+#   This boolean sets whether unannotated tags will be allowed into the
+#   repository.  By default they won't be.
+# hooks.allowdeletetag
+#   This boolean sets whether deleting tags will be allowed in the
+#   repository.  By default they won't be.
+# hooks.allowmodifytag
+#   This boolean sets whether a tag may be modified after creation. By default
+#   it won't be.
+# hooks.allowdeletebranch
+#   This boolean sets whether deleting branches will be allowed in the
+#   repository.  By default they won't be.
+# hooks.denycreatebranch
+#   This boolean sets whether remotely creating branches will be denied
+#   in the repository.  By default this is allowed.
+#
+
+# --- Command line
+refname="$1"
+oldrev="$2"
+newrev="$3"
+
+# --- Safety check
+if [ -z "$GIT_DIR" ]; then
+	echo "Don't run this script from the command line." >&2
+	echo " (if you want, you could supply GIT_DIR then run" >&2
+	echo "  $0 <ref> <oldrev> <newrev>)" >&2
+	exit 1
+fi
+
+if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
+	echo "Usage: $0 <ref> <oldrev> <newrev>" >&2
+	exit 1
+fi
+
+# --- Config
+allowunannotated=$(git config --bool hooks.allowunannotated)
+allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
+denycreatebranch=$(git config --bool hooks.denycreatebranch)
+allowdeletetag=$(git config --bool hooks.allowdeletetag)
+allowmodifytag=$(git config --bool hooks.allowmodifytag)
+
+# check for no description
+projectdesc=$(sed -e '1q' "$GIT_DIR/description")
+case "$projectdesc" in
+"Unnamed repository"* | "")
+	echo "*** Project description file hasn't been set" >&2
+	exit 1
+	;;
+esac
+
+# --- Check types
+# if $newrev is 0000...0000, it's a commit to delete a ref.
+zero="0000000000000000000000000000000000000000"
+if [ "$newrev" = "$zero" ]; then
+	newrev_type=delete
+else
+	newrev_type=$(git-cat-file -t $newrev)
+fi
+
+case "$refname","$newrev_type" in
+	refs/tags/*,commit)
+		# un-annotated tag
+		short_refname=${refname##refs/tags/}
+		if [ "$allowunannotated" != "true" ]; then
+			echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
+			echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
+			exit 1
+		fi
+		;;
+	refs/tags/*,delete)
+		# delete tag
+		if [ "$allowdeletetag" != "true" ]; then
+			echo "*** Deleting a tag is not allowed in this repository" >&2
+			exit 1
+		fi
+		;;
+	refs/tags/*,tag)
+		# annotated tag
+		if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
+		then
+			echo "*** Tag '$refname' already exists." >&2
+			echo "*** Modifying a tag is not allowed in this repository." >&2
+			exit 1
+		fi
+		;;
+	refs/heads/*,commit)
+		# branch
+		if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
+			echo "*** Creating a branch is not allowed in this repository" >&2
+			exit 1
+		fi
+		;;
+	refs/heads/*,delete)
+		# delete branch
+		if [ "$allowdeletebranch" != "true" ]; then
+			echo "*** Deleting a branch is not allowed in this repository" >&2
+			exit 1
+		fi
+		;;
+	refs/remotes/*,commit)
+		# tracking branch
+		;;
+	refs/remotes/*,delete)
+		# delete tracking branch
+		if [ "$allowdeletebranch" != "true" ]; then
+			echo "*** Deleting a tracking branch is not allowed in this repository" >&2
+			exit 1
+		fi
+		;;
+	*)
+		# Anything else (is there anything else?)
+		echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
+		exit 1
+		;;
+esac
+
+# --- Finished
+exit 0

File .vim/bundle/ctrlp.vim/.git/index

Binary file added.

File .vim/bundle/ctrlp.vim/.git/info/exclude

+# git-ls-files --others --exclude-from=.git/info/exclude
+# Lines that start with '#' are comments.
+# For a project mostly in C, the following would be a good set of
+# exclude patterns (uncomment them if you want to use them):
+# *.[oa]
+# *~

File .vim/bundle/ctrlp.vim/.git/logs/HEAD

+0000000000000000000000000000000000000000 0d198fb5075ccd1dca4340a8b0e2725fb9a82bc8 Jesse London <jlondon@ubuntu.localdomain> 1347679130 -0700	clone: from https://github.com/kien/ctrlp.vim.git

File .vim/bundle/ctrlp.vim/.git/logs/refs/heads/master

+0000000000000000000000000000000000000000 0d198fb5075ccd1dca4340a8b0e2725fb9a82bc8 Jesse London <jlondon@ubuntu.localdomain> 1347679130 -0700	clone: from https://github.com/kien/ctrlp.vim.git

File .vim/bundle/ctrlp.vim/.git/objects/pack/pack-30483f94043b1c3626d4afeeb931041e4265a5f0.idx

Binary file added.

File .vim/bundle/ctrlp.vim/.git/objects/pack/pack-30483f94043b1c3626d4afeeb931041e4265a5f0.pack

Binary file added.

File .vim/bundle/ctrlp.vim/.git/packed-refs

+# pack-refs with: peeled 
+4d5b39c0cf005bc48e6d5916e631c0b444ebc419 refs/tags/1.78
+2826589dc60af4cf54544e5505cbe9f71f70f027 refs/tags/1.7.7
+e61e7d5b801ade5fcefeab3aca75c1f37d54bdf1 refs/tags/1.7.6
+194987f331b647f195c6666607927250263b9f0c refs/tags/1.7.5
+c4fe3045653877518ddbe776a9cb7cbd4fdd0bc8 refs/tags/1.7.4
+ea4c6021fc84ce023ce2f530579ca6a4dfb3b24d refs/tags/1.6.5
+64dca5ec7961cbd4a5a7da460890e70ae8716db4 refs/tags/1.6.4
+b1a8c3d21e69b972032c65bf89e72ec7758f852a refs/tags/1.6.3
+ef9e072c5fcd57f6fcebb39405a677b7aae48e8e refs/tags/1.6.2
+052b48bff68b36366c30fdaecc16106d776ec5b1 refs/tags/1.6.1
+0af1cdc7917813bbe846be7faa9dfbc55156c030 refs/tags/1.6.0
+b6764d7c0a821de174a8cad2f86669654a1be886 refs/tags/1.5.9
+ae6f1592b4a7f6ebe5c3cc7bfbbfdc0667d6baa0 refs/tags/1.5.8
+d24ed9c5a9fdd68c9044d1139acd1ed7bf149cb6 refs/tags/1.5.7
+0319703514482feaca31faa4f278a2a9370f9aaa refs/tags/1.5.6
+b44a699d2284848a384b803509662ab5ea948d36 refs/tags/1.5.5
+8d99466502b40d7a5270abe6d763cf59383f4683 refs/tags/1.5.4
+f3edbfbe567891c0677d6008225084b151028fc2 refs/tags/1.5.3
+1ebf85d96c01378e338917b870ca635b7b3dcca1 refs/tags/1.5.1
+1a2c3ee8d2fd412573a3adbff0e2e030b8128189 refs/tags/1.5
+0d198fb5075ccd1dca4340a8b0e2725fb9a82bc8 refs/remotes/origin/master
+31aa194b6fd406051fd00a5b3a9c7adb356eab36 refs/remotes/origin/gh-pages
+e20fd39d349d0c6c7022286bbd45dac841bf5e8f refs/remotes/origin/extensions

File .vim/bundle/ctrlp.vim/.git/refs/heads/master

+0d198fb5075ccd1dca4340a8b0e2725fb9a82bc8

File .vim/bundle/ctrlp.vim/.git/refs/remotes/origin/HEAD

+ref: refs/remotes/origin/master

File .vim/bundle/ctrlp.vim/.gitignore

+*.markdown
+*.zip
+note.txt
+tags
+.hg*
+tmp/*

File .vim/bundle/ctrlp.vim/.netrwhist

+let g:netrw_dirhistmax  =10
+let g:netrw_dirhist_cnt =6
+let g:netrw_dirhist_1='/home/jlondon/repo/main/jesse/analyte/shared/apps/core/market/migrations'
+let g:netrw_dirhist_2='/home/jlondon/repo/main/qa/projects/amp/views'
+let g:netrw_dirhist_3='/home/jlondon/repo/main/jesse/projects/amp/tests'
+let g:netrw_dirhist_4='/home/jlondon/repo/main/production/analyte/shared/mail'
+let g:netrw_dirhist_5='/home/jlondon/repo/main/qa/venv/lib/python2.6/site-packages/django/db/models'
+let g:netrw_dirhist_6='/home/jlondon/repo/main/jesse/projects/amp/templates/intake'

File .vim/bundle/ctrlp.vim/autoload/ctrlp.vim

+" =============================================================================
+" File:          autoload/ctrlp.vim
+" Description:   Fuzzy file, buffer, mru, tag, etc finder.
+" Author:        Kien Nguyen <github.com/kien>
+" Version:       1.78
+" =============================================================================
+
+" ** Static variables {{{1
+" s:ignore() {{{2
+fu! s:ignore()
+	let igdirs = [
+		\ '\.git',
+		\ '\.hg',
+		\ '\.svn',
+		\ '_darcs',
+		\ '\.bzr',
+		\ '\.cdv',
+		\ '\~\.dep',
+		\ '\~\.dot',
+		\ '\~\.nib',
+		\ '\~\.plst',
+		\ '\.pc',
+		\ '_MTN',
+		\ 'blib',
+		\ 'CVS',
+		\ 'RCS',
+		\ 'SCCS',
+		\ '_sgbak',
+		\ 'autom4te\.cache',
+		\ 'cover_db',
+		\ '_build',
+		\ ]
+	let igfiles = [
+		\ '\~$',
+		\ '#.+#$',
+		\ '[._].*\.swp$',
+		\ 'core\.\d+$',
+		\ '\.exe$',
+		\ '\.so$',
+		\ '\.bak$',
+		\ '\.png$',
+		\ '\.jpg$',
+		\ '\.gif$',
+		\ '\.zip$',
+		\ '\.rar$',
+		\ '\.tar\.gz$',
+		\ ]
+	retu {
+		\ 'dir': '\v[\/]('.join(igdirs, '|').')$',
+		\ 'file': '\v'.join(igfiles, '|'),
+		\ }
+endf
+" Script local vars {{{2
+let [s:pref, s:bpref, s:opts, s:new_opts, s:lc_opts] =
+	\ ['g:ctrlp_', 'b:ctrlp_', {
+	\ 'abbrev':                ['s:abbrev', {}],
+	\ 'arg_map':               ['s:argmap', 0],
+	\ 'buffer_func':           ['s:buffunc', {}],
+	\ 'by_filename':           ['s:byfname', 0],
+	\ 'custom_ignore':         ['s:usrign', s:ignore()],
+	\ 'default_input':         ['s:deftxt', 0],
+	\ 'dont_split':            ['s:nosplit', 'netrw'],
+	\ 'dotfiles':              ['s:showhidden', 0],
+	\ 'extensions':            ['s:extensions', []],
+	\ 'follow_symlinks':       ['s:folsym', 0],
+	\ 'highlight_match':       ['s:mathi', [1, 'CtrlPMatch']],
+	\ 'jump_to_buffer':        ['s:jmptobuf', 'Et'],
+	\ 'key_loop':              ['s:keyloop', 0],
+	\ 'lazy_update':           ['s:lazy', 0],
+	\ 'match_func':            ['s:matcher', {}],
+	\ 'match_window_bottom':   ['s:mwbottom', 1],
+	\ 'match_window_reversed': ['s:mwreverse', 1],
+	\ 'max_depth':             ['s:maxdepth', 40],
+	\ 'max_files':             ['s:maxfiles', 10000],
+	\ 'max_height':            ['s:mxheight', 10],
+	\ 'max_history':           ['s:maxhst', exists('+hi') ? &hi : 20],
+	\ 'mruf_default_order':    ['s:mrudef', 0],
+	\ 'open_func':             ['s:openfunc', {}],
+	\ 'open_multi':            ['s:opmul', '1v'],
+	\ 'open_new_file':         ['s:newfop', 'v'],
+	\ 'prompt_mappings':       ['s:urprtmaps', 0],
+	\ 'regexp_search':         ['s:regexp', 0],
+	\ 'root_markers':          ['s:rmarkers', []],
+	\ 'split_window':          ['s:splitwin', 0],
+	\ 'status_func':           ['s:status', {}],
+	\ 'tabpage_position':      ['s:tabpage', 'ac'],
+	\ 'use_caching':           ['s:caching', 1],
+	\ 'use_migemo':            ['s:migemo', 0],
+	\ 'user_command':          ['s:usrcmd', ''],
+	\ 'working_path_mode':     ['s:pathmode', 'ra'],
+	\ }, {
+	\ 'open_multiple_files':   's:opmul',
+	\ 'regexp':                's:regexp',
+	\ 'reuse_window':          's:nosplit',
+	\ 'show_hidden':           's:showhidden',
+	\ 'switch_buffer':         's:jmptobuf',
+	\ }, {
+	\ 'root_markers':          's:rmarkers',
+	\ 'user_command':          's:usrcmd',
+	\ 'working_path_mode':     's:pathmode',
+	\ }]
+
+" Global options
+let s:glbs = { 'magic': 1, 'to': 1, 'tm': 0, 'sb': 1, 'hls': 0, 'im': 0,
+	\ 'report': 9999, 'sc': 0, 'ss': 0, 'siso': 0, 'mfd': 200, 'mouse': 'n',
+	\ 'gcr': 'a:blinkon0', 'ic': 1, 'lmap': '', 'mousef': 0, 'imd': 1 }
+
+" Keymaps
+let [s:lcmap, s:prtmaps] = ['nn <buffer> <silent>', {
+	\ 'PrtBS()':              ['<bs>', '<c-]>'],
+	\ 'PrtDelete()':          ['<del>'],
+	\ 'PrtDeleteWord()':      ['<c-w>'],
+	\ 'PrtClear()':           ['<c-u>'],
+	\ 'PrtSelectMove("j")':   ['<c-j>', '<down>'],
+	\ 'PrtSelectMove("k")':   ['<c-k>', '<up>'],
+	\ 'PrtSelectMove("t")':   ['<Home>', '<kHome>'],
+	\ 'PrtSelectMove("b")':   ['<End>', '<kEnd>'],
+	\ 'PrtSelectMove("u")':   ['<PageUp>', '<kPageUp>'],
+	\ 'PrtSelectMove("d")':   ['<PageDown>', '<kPageDown>'],
+	\ 'PrtHistory(-1)':       ['<c-n>'],
+	\ 'PrtHistory(1)':        ['<c-p>'],
+	\ 'AcceptSelection("e")': ['<cr>', '<2-LeftMouse>'],
+	\ 'AcceptSelection("h")': ['<c-x>', '<c-cr>', '<c-s>'],
+	\ 'AcceptSelection("t")': ['<c-t>'],
+	\ 'AcceptSelection("v")': ['<c-v>', '<RightMouse>'],
+	\ 'ToggleFocus()':        ['<s-tab>'],
+	\ 'ToggleRegex()':        ['<c-r>'],
+	\ 'ToggleByFname()':      ['<c-d>'],
+	\ 'ToggleType(1)':        ['<c-f>', '<c-up>'],
+	\ 'ToggleType(-1)':       ['<c-b>', '<c-down>'],
+	\ 'PrtExpandDir()':       ['<tab>'],
+	\ 'PrtInsert("c")':       ['<MiddleMouse>', '<insert>'],
+	\ 'PrtInsert()':          ['<c-\>'],
+	\ 'PrtCurStart()':        ['<c-a>'],
+	\ 'PrtCurEnd()':          ['<c-e>'],
+	\ 'PrtCurLeft()':         ['<c-h>', '<left>', '<c-^>'],
+	\ 'PrtCurRight()':        ['<c-l>', '<right>'],
+	\ 'PrtClearCache()':      ['<F5>'],
+	\ 'PrtDeleteEnt()':       ['<F7>'],
+	\ 'CreateNewFile()':      ['<c-y>'],
+	\ 'MarkToOpen()':         ['<c-z>'],
+	\ 'OpenMulti()':          ['<c-o>'],
+	\ 'PrtExit()':            ['<esc>', '<c-c>', '<c-g>'],
+	\ }]
+
+if !has('gui_running')
+	cal add(s:prtmaps['PrtBS()'], remove(s:prtmaps['PrtCurLeft()'], 0))
+en
+
+let s:lash = ctrlp#utils#lash()
+
+let s:compare_lim = 3000
+
+let s:ficounts = {}
+
+let s:ccex = s:pref.'clear_cache_on_exit'
+
+" Regexp
+let s:fpats = {
+	\ '^\(\\|\)\|\(\\|\)$': '\\|',
+	\ '^\\\(zs\|ze\|<\|>\)': '^\\\(zs\|ze\|<\|>\)',
+	\ '^\S\*$': '\*',
+	\ '^\S\\?$': '\\?',
+	\ }
+
+" Keypad
+let s:kprange = {
+	\ 'Plus': '+',
+	\ 'Minus': '-',
+	\ 'Divide': '/',
+	\ 'Multiply': '*',
+	\ 'Point': '.',
+	\ }
+
+" Highlight groups
+let s:hlgrps = {
+	\ 'NoEntries': 'Error',
+	\ 'Mode1': 'Character',
+	\ 'Mode2': 'LineNr',
+	\ 'Stats': 'Function',
+	\ 'Match': 'Identifier',
+	\ 'PrtBase': 'Comment',
+	\ 'PrtText': 'Normal',
+	\ 'PrtCursor': 'Constant',
+	\ }
+" s:opts() {{{2
+fu! s:opts(...)
+	unl! s:usrign s:usrcmd s:urprtmaps
+	for each in ['byfname', 'regexp', 'extensions'] | if exists('s:'.each)
+		let {each} = s:{each}
+	en | endfo
+	for [ke, va] in items(s:opts)
+		let {va[0]} = exists(s:pref.ke) ? {s:pref.ke} : va[1]
+	endfo
+	unl va
+	for [ke, va] in items(s:new_opts)
+		let {va} = {exists(s:pref.ke) ? s:pref.ke : va}
+	endfo
+	unl va
+	for [ke, va] in items(s:lc_opts)
+		if exists(s:bpref.ke)
+			unl {va}
+			let {va} = {s:bpref.ke}
+		en
+	endfo
+	if a:0 && a:1 != {}
+		unl va
+		for [ke, va] in items(a:1)
+			let opke = substitute(ke, '\(\w:\)\?ctrlp_', '', '')
+			if has_key(s:lc_opts, opke)
+				let sva = s:lc_opts[opke]
+				unl {sva}
+				let {sva} = va
+			en
+		endfo
+	en
+	for each in ['byfname', 'regexp'] | if exists(each)
+		let s:{each} = {each}
+	en | endfo
+	if !exists('g:ctrlp_newcache') | let g:ctrlp_newcache = 0 | en
+	let s:maxdepth = min([s:maxdepth, 100])
+	let s:mxheight = max([s:mxheight, 1])
+	let s:glob = s:showhidden ? '.*\|*' : '*'
+	let s:igntype = empty(s:usrign) ? -1 : type(s:usrign)
+	if s:keyloop
+		let [s:lazy, s:glbs['imd']] = [0, 0]
+	en
+	if s:lazy
+		cal extend(s:glbs, { 'ut': ( s:lazy > 1 ? s:lazy : 250 ) })
+	en
+	" Extensions
+	if !( exists('extensions') && extensions == s:extensions )
+		for each in s:extensions
+			exe 'ru autoload/ctrlp/'.each.'.vim'
+		endfo
+	en
+	" Keymaps
+	if type(s:urprtmaps) == 4
+		cal extend(s:prtmaps, s:urprtmaps)
+	en
+endf
+"}}}1
+" * Open & Close {{{1
+fu! s:Open()
+	cal s:log(1)
+	cal s:getenv()
+	cal s:execextvar('enter')
+	sil! exe 'keepa' ( s:mwbottom ? 'bo' : 'to' ) '1new ControlP'
+	cal s:buffunc(1)
+	let [s:bufnr, s:winw] = [bufnr('%'), winwidth(0)]
+	let [s:focus, s:prompt] = [1, ['', '', '']]
+	abc <buffer>
+	if !exists('s:hstry')
+		let hst = filereadable(s:gethistloc()[1]) ? s:gethistdata() : ['']
+		let s:hstry = empty(hst) || !s:maxhst ? [''] : hst
+	en
+	for [ke, va] in items(s:glbs) | if exists('+'.ke)
+		sil! exe 'let s:glb_'.ke.' = &'.ke.' | let &'.ke.' = '.string(va)
+	en | endfo
+	if s:opmul != '0' && has('signs')
+		sign define ctrlpmark text=+> texthl=Search
+	en
+	cal s:setupblank()
+endf
+
+fu! s:Close()
+	cal s:buffunc(0)
+	try | bun!
+	cat | clo! | endt
+	cal s:unmarksigns()
+	for key in keys(s:glbs) | if exists('+'.key)
+		sil! exe 'let &'.key.' = s:glb_'.key
+	en | endfo
+	if exists('s:glb_acd') | let &acd = s:glb_acd | en
+	let g:ctrlp_lines = []
+	if s:winres[1] >= &lines && s:winres[2] == winnr('$')
+		exe s:winres[0]
+	en
+	unl! s:focus s:hisidx s:hstgot s:marked s:statypes s:cline s:init s:savestr
+		\ s:mrbs s:did_exp
+	cal ctrlp#recordhist()
+	cal s:execextvar('exit')
+	cal s:log(0)
+	let v:errmsg = s:ermsg
+	ec
+endf
+" * Clear caches {{{1
+fu! ctrlp#clr(...)
+	let [s:matches, g:ctrlp_new{ a:0 ? a:1 : 'cache' }] = [1, 1]
+endf
+
+fu! ctrlp#clra()
+	let cache_dir = ctrlp#utils#cachedir()
+	if isdirectory(cache_dir)
+		let cache_files = split(s:glbpath(cache_dir, '**', 1), "\n")
+		let eval = '!isdirectory(v:val) && fnamemodify(v:val, ":t") !~'
+			\ . ' ''\v^<cache>[.a-z]+$|\.log$'''
+		sil! cal map(filter(cache_files, eval), 'delete(v:val)')
+	en
+	cal ctrlp#clr()
+endf
+
+fu! s:Reset(args)
+	let opts = has_key(a:args, 'opts') ? [a:args['opts']] : []
+	cal call('s:opts', opts)
+	cal s:autocmds()
+	cal ctrlp#utils#opts()
+	cal s:execextvar('opts')
+endf
+" * Files {{{1
+fu! ctrlp#files()
+	let cafile = ctrlp#utils#cachefile()
+	if g:ctrlp_newcache || !filereadable(cafile) || s:nocache(cafile)
+		let [lscmd, s:initcwd, g:ctrlp_allfiles] = [s:lsCmd(), s:dyncwd, []]
+		" Get the list of files
+		if empty(lscmd)
+			cal s:GlobPath(s:dyncwd, 0)
+		el
+			sil! cal ctrlp#progress('Indexing...')
+			try | cal s:UserCmd(lscmd)
+			cat | retu [] | endt
+		en
+		" Remove base directory
+		cal ctrlp#rmbasedir(g:ctrlp_allfiles)
+		if len(g:ctrlp_allfiles) <= s:compare_lim
+			cal sort(g:ctrlp_allfiles, 'ctrlp#complen')
+		en
+		cal s:writecache(cafile)
+		let catime = getftime(cafile)
+	el
+		let catime = getftime(cafile)
+		if !( exists('s:initcwd') && s:initcwd == s:dyncwd )
+			\ || get(s:ficounts, s:dyncwd, [0, catime])[1] != catime
+			let s:initcwd = s:dyncwd
+			let g:ctrlp_allfiles = ctrlp#utils#readfile(cafile)
+		en
+	en
+	cal extend(s:ficounts, { s:dyncwd : [len(g:ctrlp_allfiles), catime] })
+	retu g:ctrlp_allfiles
+endf
+
+fu! s:GlobPath(dirs, depth)
+	let entries = split(globpath(a:dirs, s:glob), "\n")
+	let [dnf, depth] = [ctrlp#dirnfile(entries), a:depth + 1]
+	cal extend(g:ctrlp_allfiles, dnf[1])
+	if !empty(dnf[0]) && !s:maxf(len(g:ctrlp_allfiles)) && depth <= s:maxdepth
+		sil! cal ctrlp#progress(len(g:ctrlp_allfiles), 1)
+		cal s:GlobPath(join(dnf[0], ','), depth)
+	en
+endf
+
+fu! s:UserCmd(lscmd)
+	let [path, lscmd] = [s:dyncwd, a:lscmd]
+	if exists('+ssl') && &ssl
+		let [ssl, &ssl, path] = [&ssl, 0, tr(path, '/', '\')]
+	en
+	if has('win32') || has('win64')
+		let lscmd = substitute(lscmd, '\v(^|&&\s*)\zscd (/d)@!', 'cd /d ', '')
+	en
+	let path = exists('*shellescape') ? shellescape(path) : path
+	let g:ctrlp_allfiles = split(system(printf(lscmd, path)), "\n")
+	if exists('+ssl') && exists('ssl')
+		let &ssl = ssl
+		cal map(g:ctrlp_allfiles, 'tr(v:val, "\\", "/")')
+	en
+	if exists('s:vcscmd') && s:vcscmd
+		cal map(g:ctrlp_allfiles, 'tr(v:val, "/", "\\")')
+	en
+	if type(s:usrcmd) == 4 && has_key(s:usrcmd, 'ignore') && s:usrcmd['ignore']
+		if !empty(s:usrign)
+			let g:ctrlp_allfiles = ctrlp#dirnfile(g:ctrlp_allfiles)[1]
+		en
+		if &wig != ''
+			cal filter(g:ctrlp_allfiles, 'glob(v:val) != ""')
+		en
+	en
+endf
+
+fu! s:lsCmd()
+	let cmd = s:usrcmd
+	if type(cmd) == 1
+		retu cmd
+	elsei type(cmd) == 3 && len(cmd) >= 2 && cmd[:1] != ['', '']
+		if s:findroot(s:dyncwd, cmd[0], 0, 1) == []
+			retu len(cmd) == 3 ? cmd[2] : ''
+		en
+		let s:vcscmd = s:lash == '\' ? 1 : 0
+		retu cmd[1]
+	elsei type(cmd) == 4 && ( has_key(cmd, 'types') || has_key(cmd, 'fallback') )
+		let fndroot = []
+		if has_key(cmd, 'types') && cmd['types'] != {}
+			let [markrs, cmdtypes] = [[], values(cmd['types'])]
+			for pair in cmdtypes
+				cal add(markrs, pair[0])
+			endfo
+			let fndroot = s:findroot(s:dyncwd, markrs, 0, 1)
+		en
+		if fndroot == []
+			retu has_key(cmd, 'fallback') ? cmd['fallback'] : ''
+		en
+		for pair in cmdtypes
+			if pair[0] == fndroot[0] | brea | en
+		endfo
+		let s:vcscmd = s:lash == '\' ? 1 : 0
+		retu pair[1]
+	en
+endf
+" - Buffers {{{1
+fu! ctrlp#buffers(...)
+	let ids = sort(filter(range(1, bufnr('$')), 'empty(getbufvar(v:val, "&bt"))'
+		\ .' && getbufvar(v:val, "&bl") && strlen(bufname(v:val))'), 's:compmreb')
+	retu a:0 && a:1 == 'id' ? ids : map(ids, 'fnamemodify(bufname(v:val), ":.")')
+endf
+" * MatchedItems() {{{1
+fu! s:MatchIt(items, pat, limit, exc)
+	let [lines, id] = [[], 0]
+	let pat =
+		\ s:byfname ? map(split(a:pat, '^[^;]\+\\\@<!\zs;', 1), 's:martcs.v:val')
+		\ : s:martcs.a:pat
+	for item in a:items
+		let id += 1
+		try | if !( s:ispath && item == a:exc ) && call(s:mfunc, [item, pat]) >= 0
+			cal add(lines, item)
+		en | cat | brea | endt
+		if a:limit > 0 && len(lines) >= a:limit | brea | en
+	endfo
+	let s:mdata = [s:dyncwd, s:itemtype, s:regexp, s:sublist(a:items, id, -1)]
+	retu lines
+endf
+
+fu! s:MatchedItems(items, pat, limit)
+	let exc = exists('s:crfilerel') ? s:crfilerel : ''
+	let items = s:narrowable() ? s:matched + s:mdata[3] : a:items
+	if s:matcher != {}
+		let argms = [items, a:pat, a:limit, s:mmode(), s:ispath, exc, s:regexp]
+		let lines = call(s:matcher['match'], argms)
+	el
+		let lines = s:MatchIt(items, a:pat, a:limit, exc)
+	en
+	let s:matches = len(lines)
+	unl! s:did_exp
+	retu lines
+endf
+
+fu! s:SplitPattern(str)
+	let str = a:str
+	if s:migemo && s:regexp && len(str) > 0 && executable('cmigemo')
+		let str = s:migemo(str)
+	en
+	let s:savestr = str
+	if s:regexp
+		let pat = s:regexfilter(str)
+	el
+		let lst = split(str, '\zs')
+		if exists('+ssl') && !&ssl
+			cal map(lst, 'escape(v:val, ''\'')')
+		en
+		for each in ['^', '$', '.']
+			cal map(lst, 'escape(v:val, each)')
+		endfo
+	en
+	if exists('lst')
+		let pat = ''
+		if !empty(lst)
+			if s:byfname && index(lst, ';') > 0
+				let fbar = index(lst, ';')
+				let lst_1 = s:sublist(lst, 0, fbar - 1)
+				let lst_2 = len(lst) - 1 > fbar ? s:sublist(lst, fbar + 1, -1) : ['']
+				let pat = s:buildpat(lst_1).';'.s:buildpat(lst_2)
+			el
+				let pat = s:buildpat(lst)
+			en
+		en
+	en
+	retu escape(pat, '~')
+endf
+" * BuildPrompt() {{{1
+fu! s:Render(lines, pat)
+	let [&ma, lines, s:height] = [1, a:lines, min([len(a:lines), s:winh])]
+	let pat = s:byfname ? split(a:pat, '^[^;]\+\\\@<!\zs;', 1)[0] : a:pat
+	" Setup the match window
+	sil! exe '%d _ | res' s:height
+	" Print the new items
+	if empty(lines)
+		let [s:matched, s:lines] = [[], []]
+		cal setline(1, ' == NO ENTRIES ==')
+		setl noma nocul
+		cal s:unmarksigns()
+		if s:dohighlight() | cal clearmatches() | en
+		retu
+	en
+	let s:matched = copy(lines)
+	" Sorting
+	if !s:nosort()
+		let s:compat = s:martcs.pat
+		cal sort(lines, 's:mixedsort')
+		unl s:compat
+	en
+	if s:mwreverse | cal reverse(lines) | en
+	let s:lines = copy(lines)
+	cal map(lines, 's:formatline(v:val)')
+	cal setline(1, lines)
+	setl noma cul
+	exe 'keepj norm!' ( s:mwreverse ? 'G' : 'gg' ).'1|'
+	cal s:unmarksigns()
+	cal s:remarksigns()
+	if exists('s:cline') && s:nolim != 1
+		cal cursor(s:cline, 1)
+	en
+	" Highlighting
+	if s:dohighlight()
+		cal s:highlight(pat, s:mathi[1])
+	en
+endf
+
+fu! s:Update(str)
+	" Get the previous string if existed
+	let oldstr = exists('s:savestr') ? s:savestr : ''
+	" Get the new string sans tail
+	let str = s:sanstail(a:str)
+	" Stop if the string's unchanged
+	if str == oldstr && !empty(str) && !exists('s:force') | retu | en
+	let s:martcs = &scs && str =~ '\u' ? '\C' : ''
+	let pat = s:matcher == {} ? s:SplitPattern(str) : str
+	let lines = s:nolim == 1 && empty(str) ? copy(g:ctrlp_lines)
+		\ : s:MatchedItems(g:ctrlp_lines, pat, s:winh)
+	cal s:Render(lines, pat)
+endf
+
+fu! s:ForceUpdate()
+	sil! cal s:Update(escape(s:getinput(), '\'))
+endf
+
+fu! s:BuildPrompt(upd)
+	let base = ( s:regexp ? 'r' : '>' ).( s:byfname ? 'd' : '>' ).'> '
+	let str = escape(s:getinput(), '\')
+	let lazy = str == '' || exists('s:force') || !has('autocmd') ? 0 : s:lazy
+	if a:upd && !lazy && ( s:matches || s:regexp || exists('s:did_exp')
+		\ || str =~ '\(\\\(<\|>\)\|[*|]\)\|\(\\\:\([^:]\|\\:\)*$\)' )
+		sil! cal s:Update(str)
+	en
+	sil! cal ctrlp#statusline()
+	" Toggling
+	let [hiactive, hicursor, base] = s:focus
+		\ ? ['CtrlPPrtText', 'CtrlPPrtCursor', base]
+		\ : ['CtrlPPrtBase', 'CtrlPPrtBase', tr(base, '>', '-')]
+	let hibase = 'CtrlPPrtBase'
+	" Build it
+	redr
+	let prt = copy(s:prompt)
+	cal map(prt, 'escape(v:val, ''"\'')')
+	exe 'echoh' hibase '| echon "'.base.'"
+		\ | echoh' hiactive '| echon "'.prt[0].'"
+		\ | echoh' hicursor '| echon "'.prt[1].'"
+		\ | echoh' hiactive '| echon "'.prt[2].'" | echoh None'
+	" Append the cursor at the end
+	if empty(prt[1]) && s:focus
+		exe 'echoh' hibase '| echon "_" | echoh None'
+	en
+endf
+" - SetDefTxt() {{{1
+fu! s:SetDefTxt()
+	if s:deftxt == '0' || ( s:deftxt == 1 && !s:ispath ) | retu | en
+	let txt = s:deftxt
+	if !type(txt)
+		let txt = txt && !stridx(s:crfpath, s:dyncwd)
+			\ ? ctrlp#rmbasedir([s:crfpath])[0] : ''
+		let txt = txt != '' ? txt.s:lash(s:crfpath) : ''
+	el
+		let txt = expand(txt, 1)
+	en
+	let s:prompt[0] = txt
+endf
+" ** Prt Actions {{{1
+" Editing {{{2
+fu! s:PrtClear()
+	if !s:focus | retu | en
+	unl! s:hstgot
+	let [s:prompt, s:matches] = [['', '', ''], 1]
+	cal s:BuildPrompt(1)
+endf
+
+fu! s:PrtAdd(char)
+	unl! s:hstgot
+	let s:act_add = 1
+	let s:prompt[0] .= a:char
+	cal s:BuildPrompt(1)
+	unl s:act_add
+endf
+
+fu! s:PrtBS()
+	if !s:focus | retu | en
+	unl! s:hstgot
+	let [s:prompt[0], s:matches] = [substitute(s:prompt[0], '.$', '', ''), 1]
+	cal s:BuildPrompt(1)
+endf
+
+fu! s:PrtDelete()
+	if !s:focus | retu | en
+	unl! s:hstgot
+	let [prt, s:matches] = [s:prompt, 1]
+	let prt[1] = matchstr(prt[2], '^.')
+	let prt[2] = substitute(prt[2], '^.', '', '')
+	cal s:BuildPrompt(1)
+endf
+
+fu! s:PrtDeleteWord()
+	if !s:focus | retu | en
+	unl! s:hstgot
+	let [str, s:matches] = [s:prompt[0], 1]
+	let str = str =~ '\W\w\+$' ? matchstr(str, '^.\+\W\ze\w\+$')
+		\ : str =~ '\w\W\+$' ? matchstr(str, '^.\+\w\ze\W\+$')
+		\ : str =~ '\s\+$' ? matchstr(str, '^.*\S\ze\s\+$')
+		\ : str =~ '\v^(\S+|\s+)$' ? '' : str
+	let s:prompt[0] = str
+	cal s:BuildPrompt(1)
+endf
+
+fu! s:PrtInsert(...)
+	if !s:focus | retu | en
+	let type = !a:0 ? '' : a:1
+	if !a:0
+		let type = s:insertstr()
+		if type == 'cancel' | retu | en
+	en
+	if type ==# 'r'
+		let regcont = s:getregs()
+		if regcont < 0 | retu | en
+	en
+	unl! s:hstgot
+	let s:act_add = 1
+	let s:prompt[0] .= type ==# 'w' ? s:crword
+		\ : type ==# 'f' ? s:crgfile
+		\ : type ==# 's' ? s:regisfilter('/')
+		\ : type ==# 'v' ? s:crvisual
+		\ : type ==# 'c' ? s:regisfilter('+')
+		\ : type ==# 'r' ? regcont : ''
+	cal s:BuildPrompt(1)
+	unl s:act_add
+endf
+
+fu! s:PrtExpandDir()
+	if !s:focus | retu | en
+	let str = s:getinput('c')
+	if str =~ '\v^\@(cd|lc[hd]?|chd)\s.+' && s:spi
+		let hasat = split(str, '\v^\@(cd|lc[hd]?|chd)\s*\zs')
+		let str = get(hasat, 1, '')
+	en
+	if str == '' | retu | en
+	unl! s:hstgot
+	let s:act_add = 1
+	let [base, seed] = s:headntail(str)
+	let dirs = s:dircompl(base, seed)
+	if len(dirs) == 1
+		let str = dirs[0]
+	elsei len(dirs) > 1
+		let str .= s:findcommon(dirs, str)
+	en
+	let s:prompt[0] = exists('hasat') ? hasat[0].str : str
+	cal s:BuildPrompt(1)
+	unl s:act_add
+endf
+" Movement {{{2
+fu! s:PrtCurLeft()
+	if !s:focus | retu | en
+	let prt = s:prompt
+	if !empty(prt[0])
+		let s:prompt = [substitute(prt[0], '.$', '', ''), matchstr(prt[0], '.$'),
+			\ prt[1] . prt[2]]
+	en
+	cal s:BuildPrompt(0)
+endf
+
+fu! s:PrtCurRight()
+	if !s:focus | retu | en
+	let prt = s:prompt
+	let s:prompt = [prt[0] . prt[1], matchstr(prt[2], '^.'),
+		\ substitute(prt[2], '^.', '', '')]
+	cal s:BuildPrompt(0)
+endf
+
+fu! s:PrtCurStart()
+	if !s:focus | retu | en
+	let str = join(s:prompt, '')
+	let s:prompt = ['', matchstr(str, '^.'), substitute(str, '^.', '', '')]
+	cal s:BuildPrompt(0)
+endf
+
+fu! s:PrtCurEnd()
+	if !s:focus | retu | en
+	let s:prompt = [join(s:prompt, ''), '', '']
+	cal s:BuildPrompt(0)
+endf
+
+fu! s:PrtSelectMove(dir)
+	let wht = winheight(0)
+	let dirs = {'t': 'gg','b': 'G','j': 'j','k': 'k','u': wht.'k','d': wht.'j'}
+	exe 'keepj norm!' dirs[a:dir]
+	if s:nolim != 1 | let s:cline = line('.') | en
+	if line('$') > winheight(0) | cal s:BuildPrompt(0) | en
+endf
+
+fu! s:PrtSelectJump(char)
+	let lines = copy(s:lines)
+	if s:byfname
+		cal map(lines, 'split(v:val, ''[\/]\ze[^\/]\+$'')[-1]')
+	en
+	" Cycle through matches, use s:jmpchr to store last jump
+	let chr = escape(matchstr(a:char, '^.'), '.~')
+	let smartcs = &scs && chr =~ '\u' ? '\C' : ''
+	if match(lines, smartcs.'^'.chr) >= 0
+		" If not exists or does but not for the same char
+		let pos = match(lines, smartcs.'^'.chr)
+		if !exists('s:jmpchr') || ( exists('s:jmpchr') && s:jmpchr[0] != chr )
+			let [jmpln, s:jmpchr] = [pos, [chr, pos]]
+		elsei exists('s:jmpchr') && s:jmpchr[0] == chr
+			" Start of lines
+			if s:jmpchr[1] == -1 | let s:jmpchr[1] = pos | en
+			let npos = match(lines, smartcs.'^'.chr, s:jmpchr[1] + 1)
+			let [jmpln, s:jmpchr] = [npos == -1 ? pos : npos, [chr, npos]]
+		en
+		exe 'keepj norm!' ( jmpln + 1 ).'G'
+		if s:nolim != 1 | let s:cline = line('.') | en
+		if line('$') > winheight(0) | cal s:BuildPrompt(0) | en
+	en
+endf
+" Misc {{{2
+fu! s:PrtFocusMap(char)
+	cal call(( s:focus ? 's:PrtAdd' : 's:PrtSelectJump' ), [a:char])
+endf
+
+fu! s:PrtClearCache()
+	if s:itemtype == 0
+		cal ctrlp#clr()
+	elsei s:itemtype > 2
+		cal ctrlp#clr(s:statypes[s:itemtype][1])
+	en
+	if s:itemtype == 2
+		let g:ctrlp_lines = ctrlp#mrufiles#refresh()
+	el
+		cal ctrlp#setlines()
+	en
+	let s:force = 1
+	cal s:BuildPrompt(1)
+	unl s:force
+endf
+
+fu! s:PrtDeleteEnt()
+	if s:itemtype == 2
+		cal s:PrtDeleteMRU()
+	elsei type(s:getextvar('wipe')) == 1
+		cal s:delent(s:getextvar('wipe'))
+	en
+endf
+
+fu! s:PrtDeleteMRU()
+	if s:itemtype == 2
+		cal s:delent('ctrlp#mrufiles#remove')
+	en
+endf
+
+fu! s:PrtExit()
+	if !has('autocmd') | cal s:Close() | en
+	exe ( winnr('$') == 1 ? 'bw!' : 'winc p' )
+endf
+
+fu! s:PrtHistory(...)
+	if !s:focus || !s:maxhst | retu | en
+	let [str, hst, s:matches] = [join(s:prompt, ''), s:hstry, 1]
+	" Save to history if not saved before
+	let [hst[0], hslen] = [exists('s:hstgot') ? hst[0] : str, len(hst)]
+	let idx = exists('s:hisidx') ? s:hisidx + a:1 : a:1
+	" Limit idx within 0 and hslen
+	let idx = idx < 0 ? 0 : idx >= hslen ? hslen > 1 ? hslen - 1 : 0 : idx
+	let s:prompt = [hst[idx], '', '']
+	let [s:hisidx, s:hstgot, s:force] = [idx, 1, 1]
+	cal s:BuildPrompt(1)
+	unl s:force
+endf
+"}}}1
+" * Mappings {{{1
+fu! s:MapNorms()
+	if exists('s:nmapped') && s:nmapped == s:bufnr | retu | en
+	let pcmd = "nn \<buffer> \<silent> \<k%s> :\<c-u>cal \<SID>%s(\"%s\")\<cr>"
+	let cmd = substitute(pcmd, 'k%s', 'char-%d', '')
+	let pfunc = 'PrtFocusMap'
+	let ranges = [32, 33, 125, 126] + range(35, 91) + range(93, 123)
+	for each in [34, 92, 124]
+		exe printf(cmd, each, pfunc, escape(nr2char(each), '"|\'))
+	endfo
+	for each in ranges
+		exe printf(cmd, each, pfunc, nr2char(each))
+	endfo
+	for each in range(0, 9)
+		exe printf(pcmd, each, pfunc, each)
+	endfo
+	for [ke, va] in items(s:kprange)
+		exe printf(pcmd, ke, pfunc, va)
+	endfo
+	let s:nmapped = s:bufnr
+endf
+
+fu! s:MapSpecs()
+	if !( exists('s:smapped') && s:smapped == s:bufnr )
+		" Correct arrow keys in terminal
+		if ( has('termresponse') && v:termresponse =~ "\<ESC>" )
+			\ || &term =~? '\vxterm|<k?vt|gnome|screen|linux|ansi'
+			for each in ['\A <up>','\B <down>','\C <right>','\D <left>']
+				exe s:lcmap.' <esc>['.each
+			endfo
+		en
+	en
+	for [ke, va] in items(s:prtmaps) | for kp in va
+		exe s:lcmap kp ':<c-u>cal <SID>'.ke.'<cr>'
+	endfo | endfo
+	let s:smapped = s:bufnr
+endf
+
+fu! s:KeyLoop()
+	wh exists('s:init') && s:keyloop
+		redr
+		let nr = getchar()
+		let chr = !type(nr) ? nr2char(nr) : nr
+		if nr >=# 0x20
+			cal s:PrtFocusMap(chr)
+		el
+			let cmd = matchstr(maparg(chr), ':<C-U>\zs.\+\ze<CR>$')
+			exe ( cmd != '' ? cmd : 'norm '.chr )
+		en
+	endw
+endf
+" * Toggling {{{1
+fu! s:ToggleFocus()
+	let s:focus = !s:focus
+	cal s:BuildPrompt(0)
+endf
+
+fu! s:ToggleRegex()
+	let s:regexp = !s:regexp
+	cal s:PrtSwitcher()
+endf
+
+fu! s:ToggleByFname()
+	if s:ispath
+		let s:byfname = !s:byfname
+		let s:mfunc = s:mfunc()
+		cal s:PrtSwitcher()
+	en
+endf
+
+fu! s:ToggleType(dir)
+	let max = len(g:ctrlp_ext_vars) + 2
+	let next = s:walker(max, s:itemtype, a:dir)
+	cal ctrlp#syntax()
+	cal ctrlp#setlines(next)
+	cal s:PrtSwitcher()
+endf
+
+fu! s:ToggleKeyLoop()
+	let s:keyloop = !s:keyloop
+	if s:keyloop
+		let [&ut, s:lazy] = [0, 0]
+		cal s:KeyLoop()
+	elsei has_key(s:glbs, 'ut')
+		let [&ut, s:lazy] = [s:glbs['ut'], 1]
+	en
+endf
+
+fu! s:PrtSwitcher()
+	let [s:force, s:matches] = [1, 1]
+	cal s:BuildPrompt(1)
+	unl s:force
+endf
+" - SetWD() {{{1
+fu! s:SetWD(args)
+	if has_key(a:args, 'args') && stridx(a:args['args'], '--dir') >= 0
+		\ && exists('s:dyncwd')
+		cal ctrlp#setdir(s:dyncwd) | retu
+	en
+	if has_key(a:args, 'dir') && a:args['dir'] != ''
+		cal ctrlp#setdir(a:args['dir']) | retu
+	en
+	let pmode = has_key(a:args, 'mode') ? a:args['mode'] : s:pathmode
+	let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()]
+	if s:crfile =~ '^.\+://' | retu | en
+	if pmode =~ 'c' || ( pmode =~ 'a' && stridx(s:crfpath, s:cwd) < 0 )
+		\ || ( !type(pmode) && pmode )
+		if exists('+acd') | let [s:glb_acd, &acd] = [&acd, 0] | en
+		cal ctrlp#setdir(s:crfpath)
+	en
+	if pmode =~ 'r' || pmode == 2
+		let markers = ['.git', '.hg', '.svn', '.bzr', '_darcs']
+		let spath = pmode =~ 'd' ? s:dyncwd : pmode =~ 'w' ? s:cwd : s:crfpath
+		if type(s:rmarkers) == 3 && !empty(s:rmarkers)
+			if s:findroot(spath, s:rmarkers, 0, 0) != [] | retu | en
+			cal filter(markers, 'index(s:rmarkers, v:val) < 0')
+		en
+		cal s:findroot(spath, markers, 0, 0)
+	en
+endf
+" * AcceptSelection() {{{1
+fu! ctrlp#acceptfile(mode, line, ...)
+	let [md, filpath] = [a:mode, fnamemodify(a:line, ':p')]
+	cal s:PrtExit()
+	let [bufnr, tail] = [bufnr('^'.filpath.'$'), s:tail()]
+	let j2l = a:0 ? a:1 : matchstr(tail, '^ +\zs\d\+$')
+	if ( s:jmptobuf =~ md || ( s:jmptobuf && md =~ '[et]' ) ) && bufnr > 0
+		\ && !( md == 'e' && bufnr == bufnr('%') )
+		let [jmpb, bufwinnr] = [1, bufwinnr(bufnr)]
+		let buftab = ( s:jmptobuf =~# '[tTVH]' || s:jmptobuf > 1 )
+			\ ? s:buftab(bufnr, md) : [0, 0]
+	en
+	" Switch to existing buffer or open new one
+	if exists('jmpb') && bufwinnr > 0
+		\ && !( md == 't' && ( s:jmptobuf !~# toupper(md) || buftab[0] ) )
+		exe bufwinnr.'winc w'
+		if j2l | cal ctrlp#j2l(j2l) | en
+	elsei exists('jmpb') && buftab[0]
+		\ && !( md =~ '[evh]' && s:jmptobuf !~# toupper(md) )
+		exe 'tabn' buftab[0]
+		exe buftab[1].'winc w'
+		if j2l | cal ctrlp#j2l(j2l) | en
+	el
+		" Determine the command to use
+		let useb = bufnr > 0 && buflisted(bufnr) && empty(tail)
+		let cmd =
+			\ md == 't' || s:splitwin == 1 ? ( useb ? 'tab sb' : 'tabe' ) :
+			\ md == 'h' || s:splitwin == 2 ? ( useb ? 'sb' : 'new' ) :
+			\ md == 'v' || s:splitwin == 3 ? ( useb ? 'vert sb' : 'vne' ) :
+			\ call('ctrlp#normcmd', useb ? ['b', 'bo vert sb'] : ['e'])
+		" Reset &switchbuf option
+		let [swb, &swb] = [&swb, '']
+		" Open new window/buffer
+		let [fid, tail] = [( useb ? bufnr : filpath ), ( a:0 ? ' +'.a:1 : tail )]
+		let args = [cmd, fid, tail, 1, [useb, j2l]]
+		cal call('s:openfile', args)
+		let &swb = swb
+	en
+endf
+
+fu! s:SpecInputs(str)
+	if a:str =~ '\v^(\.\.([\/]\.\.)*[\/]?[.\/]*)$' && s:spi
+		let cwd = s:dyncwd
+		cal ctrlp#setdir(a:str =~ '^\.\.\.*$' ?
+			\ '../'.repeat('../', strlen(a:str) - 2) : a:str)
+		if cwd != s:dyncwd | cal ctrlp#setlines() | en
+		cal s:PrtClear()
+		retu 1
+	elsei a:str == s:lash && s:spi
+		cal s:SetWD({ 'mode': 'rd' })
+		cal ctrlp#setlines()
+		cal s:PrtClear()
+		retu 1
+	elsei a:str =~ '^@.\+' && s:spi
+		retu s:at(a:str)
+	elsei a:str == '?'
+		cal s:PrtExit()
+		let hlpwin = &columns > 159 ? '| vert res 80' : ''
+		sil! exe 'bo vert h ctrlp-mappings' hlpwin '| norm! 0'
+		retu 1
+	en
+	retu 0
+endf
+
+fu! s:AcceptSelection(mode)
+	if a:mode != 'e' && s:OpenMulti(a:mode) != -1 | retu | en
+	let str = s:getinput()
+	if a:mode == 'e' | if s:SpecInputs(str) | retu | en | en
+	" Get the selected line
+	let line = ctrlp#getcline()
+	if a:mode != 'e' && !s:itemtype && line == ''
+		\ && str !~ '\v^(\.\.([\/]\.\.)*[\/]?[.\/]*|/|\\|\?|\@.+)$'
+		cal s:CreateNewFile(a:mode) | retu
+	en
+	if empty(line) | retu | en
+	" Do something with it
+	if s:openfunc != {} && has_key(s:openfunc, s:ctype)
+		let actfunc = s:openfunc[s:ctype]
+	el
+		let actfunc = s:itemtype < 3 ? 'ctrlp#acceptfile' : s:getextvar('accept')
+	en
+	cal call(actfunc, [a:mode, line])
+endf
+" - CreateNewFile() {{{1
+fu! s:CreateNewFile(...)
+	let [md, str] = ['', s:getinput('n')]
+	if empty(str) | retu | en
+	if s:argmap && !a:0
+		" Get the extra argument
+		let md = s:argmaps(md, 1)
+		if md == 'cancel' | retu | en
+	en
+	let str = s:sanstail(str)
+	let [base, fname] = s:headntail(str)
+	if fname =~ '^[\/]$' | retu | en
+	if exists('s:marked') && len(s:marked)
+		" Use the first marked file's path
+		let path = fnamemodify(values(s:marked)[0], ':p:h')
+		let base = path.s:lash(path).base
+		let str = fnamemodify(base.s:lash.fname, ':.')
+	en
+	if base != '' | if isdirectory(ctrlp#utils#mkdir(base))
+		let optyp = str | en | el | let optyp = fname
+	en
+	if !exists('optyp') | retu | en
+	let [filpath, tail] = [fnamemodify(optyp, ':p'), s:tail()]
+	if !stridx(filpath, s:dyncwd) | cal s:insertcache(str) | en
+	cal s:PrtExit()
+	let cmd = md == 'r' ? ctrlp#normcmd('e') :
+		\ s:newfop =~ '1\|t' || ( a:0 && a:1 == 't' ) || md == 't' ? 'tabe' :
+		\ s:newfop =~ '2\|h' || ( a:0 && a:1 == 'h' ) || md == 'h' ? 'new' :
+		\ s:newfop =~ '3\|v' || ( a:0 && a:1 == 'v' ) || md == 'v' ? 'vne' :
+		\ ctrlp#normcmd('e')
+	cal s:openfile(cmd, filpath, tail, 1)
+endf
+" * OpenMulti() {{{1
+fu! s:MarkToOpen()
+	if s:bufnr <= 0 || s:opmul == '0'
+		\ || ( s:itemtype > 2 && s:getextvar('opmul') != 1 )
+		retu
+	en
+	let line = ctrlp#getcline()
+	if empty(line) | retu | en
+	let filpath = s:ispath ? fnamemodify(line, ':p') : line
+	if exists('s:marked') && s:dictindex(s:marked, filpath) > 0
+		" Unmark and remove the file from s:marked
+		let key = s:dictindex(s:marked, filpath)
+		cal remove(s:marked, key)
+		if empty(s:marked) | unl s:marked | en
+		if has('signs')
+			exe 'sign unplace' key 'buffer='.s:bufnr
+		en
+	el
+		" Add to s:marked and place a new sign
+		if exists('s:marked')
+			let vac = s:vacantdict(s:marked)
+			let key = empty(vac) ? len(s:marked) + 1 : vac[0]
+			let s:marked = extend(s:marked, { key : filpath })
+		el
+			let [key, s:marked] = [1, { 1 : filpath }]
+		en
+		if has('signs')
+			exe 'sign place' key 'line='.line('.').' name=ctrlpmark buffer='.s:bufnr
+		en
+	en
+	sil! cal ctrlp#statusline()
+endf
+
+fu! s:OpenMulti(...)
+	let has_marked = exists('s:marked')
+	if ( !has_marked && a:0 ) || s:opmul == '0' || !s:ispath
+		\ || ( s:itemtype > 2 && s:getextvar('opmul') != 1 )
+		retu -1
+	en
+	" Get the options
+	let [nr, md] = [matchstr(s:opmul, '\d\+'), matchstr(s:opmul, '[thvi]')]
+	let [ur, jf] = [s:opmul =~ 'r', s:opmul =~ 'j']
+	let md = a:0 ? a:1 : ( md == '' ? 'v' : md )
+	let nopt = exists('g:ctrlp_open_multiple_files')
+	if !has_marked
+		let line = ctrlp#getcline()
+		if line == '' | retu | en
+		let marked = { 1 : fnamemodify(line, ':p') }
+		let [nr, ur, jf, nopt] = ['1', 0, 0, 1]
+	en
+	if ( s:argmap || !has_marked ) && !a:0
+		let md = s:argmaps(md, !has_marked ? 2 : 0)
+		if md == 'c'
+			cal s:unmarksigns()
+			unl! s:marked
+			cal s:BuildPrompt(0)
+		elsei !has_marked && md =~ '[axd]'
+			retu s:OpenNoMarks(md, line)
+		en
+		if md =~ '\v^c(ancel)?$' | retu | en
+		let nr = nr == '0' ? ( nopt ? '' : '1' ) : nr
+		let ur = !has_marked && md == 'r' ? 1 : ur
+	en
+	let mkd = values(has_marked ? s:marked : marked)
+	cal s:sanstail(join(s:prompt, ''))
+	cal s:PrtExit()
+	if nr == '0' || md == 'i'
+		retu map(mkd, "s:openfile('bad', v:val, '', 0)")
+	en
+	let tail = s:tail()
+	let [emptytail, bufnr] = [empty(tail), bufnr('^'.mkd[0].'$')]
+	let useb = bufnr > 0 && buflisted(bufnr) && emptytail
+	" Move to a replaceable window
+	let ncmd = ( useb ? ['b', 'bo vert sb'] : ['e', 'bo vne'] )
+		\ + ( ur ? [] : ['ignruw'] )
+	let fst = call('ctrlp#normcmd', ncmd)
+	" Check if the current window has a replaceable buffer
+	let repabl = !( md == 't' && !ur ) && empty(bufname('%')) && empty(&l:ft)
+	" Commands for the rest of the files
+	let [ic, cmds] = [1, { 'v': ['vert sb', 'vne'], 'h': ['sb', 'new'],
+		\ 't': ['tab sb', 'tabe'] }]
+	let [swb, &swb] = [&swb, '']
+	if md == 't' && ctrlp#tabcount() < tabpagenr()
+		let s:tabct = ctrlp#tabcount()
+	en
+	" Open the files
+	for va in mkd
+		let bufnr = bufnr('^'.va.'$')
+		if bufnr < 0 && getftype(va) == '' | con | en
+		let useb = bufnr > 0 && buflisted(bufnr) && emptytail
+		let snd = md != '' && has_key(cmds, md) ?
+			\ ( useb ? cmds[md][0] : cmds[md][1] ) : ( useb ? 'vert sb' : 'vne' )
+		let cmd = ic == 1 && ( !( !ur && fst =~ '^[eb]$' ) || repabl ) ? fst : snd
+		let conds = [( nr != '' && nr > 1 && nr < ic ) || ( nr == '' && ic > 1 ),
+			\ nr != '' && nr < ic]
+		if conds[nopt]
+			if !buflisted(bufnr) | cal s:openfile('bad', va, '', 0) | en
+		el
+			cal s:openfile(cmd, useb ? bufnr : va, tail, ic == 1 ? 1 : 0)
+			if jf | if ic == 1
+				let crpos = [tabpagenr(), winnr()]
+			el
+				let crpos[0] += tabpagenr() <= crpos[0]
+				let crpos[1] += winnr() <= crpos[1]
+			en | en
+			let ic += 1
+		en
+	endfo
+	if jf && exists('crpos') && ic > 2
+		exe ( md == 't' ? 'tabn '.crpos[0] : crpos[1].'winc w' )
+	en
+	let &swb = swb
+	unl! s:tabct
+endf
+
+fu! s:OpenNoMarks(md, line)
+	if a:md == 'a'
+		let [s:marked, key] = [{}, 1]
+		for line in s:lines
+			let s:marked = extend(s:marked, { key : fnamemodify(line, ':p') })
+			let key += 1
+		endfo
+		cal s:remarksigns()
+		cal s:BuildPrompt(0)
+	elsei a:md == 'x'
+		cal call(s:openfunc[s:ctype], [a:md, a:line])
+	elsei a:md == 'd'
+		let dir = fnamemodify(a:line, ':h')
+		if isdirectory(dir)
+			cal ctrlp#setdir(dir)
+			cal ctrlp#switchtype(0)
+			cal ctrlp#recordhist()
+			cal s:PrtClear()
+		en
+	en
+endf
+" ** Helper functions {{{1
+" Sorting {{{2
+fu! ctrlp#complen(...)
+	" By length
+	let [len1, len2] = [strlen(a:1), strlen(a:2)]
+	retu len1 == len2 ? 0 : len1 > len2 ? 1 : -1
+endf
+
+fu! s:compmatlen(...)
+	" By match length
+	let mln1 = s:shortest(s:matchlens(a:1, s:compat))
+	let mln2 = s:shortest(s:matchlens(a:2, s:compat))
+	retu mln1 == mln2 ? 0 : mln1 > mln2 ? 1 : -1
+endf
+
+fu! s:comptime(...)
+	" By last modified time
+	let [time1, time2] = [getftime(a:1), getftime(a:2)]
+	retu time1 == time2 ? 0 : time1 < time2 ? 1 : -1
+endf
+
+fu! s:compmreb(...)
+	" By last entered time (bufnr)
+	let [id1, id2] = [index(s:mrbs, a:1), index(s:mrbs, a:2)]
+	retu id1 == id2 ? 0 : id1 > id2 ? 1 : -1
+endf
+
+fu! s:compmref(...)
+	" By last entered time (MRU)
+	let [id1, id2] = [index(g:ctrlp_lines, a:1), index(g:ctrlp_lines, a:2)]
+	retu id1 == id2 ? 0 : id1 > id2 ? 1 : -1
+endf
+
+fu! s:comparent(...)
+	" By same parent dir
+	if !stridx(s:crfpath, s:dyncwd)
+		let [as1, as2] = [s:dyncwd.s:lash().a:1, s:dyncwd.s:lash().a:2]
+		let [loc1, loc2] = [s:getparent(as1), s:getparent(as2)]
+		if loc1 == s:crfpath && loc2 != s:crfpath | retu -1 | en
+		if loc2 == s:crfpath && loc1 != s:crfpath | retu 1  | en
+		retu 0
+	en
+	retu 0
+endf
+
+fu! s:compfnlen(...)
+	" By filename length
+	let len1 = strlen(split(a:1, s:lash)[-1])
+	let len2 = strlen(split(a:2, s:lash)[-1])
+	retu len1 == len2 ? 0 : len1 > len2 ? 1 : -1
+endf
+
+fu! s:matchlens(str, pat, ...)
+	if empty(a:pat) || index(['^', '$'], a:pat) >= 0 | retu {} | en
+	let st   = a:0 ? a:1 : 0
+	let lens = a:0 >= 2 ? a:2 : {}
+	let nr   = a:0 >= 3 ? a:3 : 0
+	if nr > 20 | retu {} | en
+	if match(a:str, a:pat, st) >= 0
+		let [mst, mnd] = [matchstr(a:str, a:pat, st), matchend(a:str, a:pat, st)]
+		let lens = extend(lens, { nr : [strlen(mst), mst] })
+		let lens = s:matchlens(a:str, a:pat, mnd, lens, nr + 1)
+	en
+	retu lens
+endf
+
+fu! s:shortest(lens)
+	retu min(map(values(a:lens), 'v:val[0]'))
+endf
+
+fu! s:mixedsort(...)
+	let [cln, cml] = [ctrlp#complen(a:1, a:2), s:compmatlen(a:1, a:2)]
+	if s:ispath
+		let ms = []
+		if s:height < 21
+			let ms += [s:compfnlen(a:1, a:2)]
+			if s:itemtype !~ '^[12]$' | let ms += [s:comptime(a:1, a:2)] | en
+			if !s:itemtype | let ms += [s:comparent(a:1, a:2)] | en
+		en
+		if s:itemtype =~ '^[12]$'
+			let ms += [s:compmref(a:1, a:2)]
+			let cln = cml ? cln : 0
+		en
+		let ms += [cml, 0, 0, 0]
+		let mp = call('s:multipliers', ms[:3])
+		retu cln + ms[0] * mp[0] + ms[1] * mp[1] + ms[2] * mp[2] + ms[3] * mp[3]
+	en
+	retu cln + cml * 2
+endf
+
+fu! s:multipliers(...)
+	let mp0 = !a:1 ? 0 : 2
+	let mp1 = !a:2 ? 0 : 1 + ( !mp0 ? 1 : mp0 )
+	let mp2 = !a:3 ? 0 : 1 + ( !( mp0 + mp1 ) ? 1 : ( mp0 + mp1 ) )
+	let mp3 = !a:4 ? 0 : 1 + ( !( mp0 + mp1 + mp2 ) ? 1 : ( mp0 + mp1 + mp2 ) )
+	retu [mp0, mp1, mp2, mp3]
+endf
+
+fu! s:compval(...)
+	retu a:1 - a:2
+endf
+" Statusline {{{2
+fu! ctrlp#statusline()
+	if !exists('s:statypes')
+		let s:statypes = [
+			\ ['files', 'fil'],
+			\ ['buffers', 'buf'],
+			\ ['mru files', 'mru'],
+			\ ]
+		if !empty(g:ctrlp_ext_vars)
+			cal map(copy(g:ctrlp_ext_vars),
+				\ 'add(s:statypes, [ v:val["lname"], v:val["sname"] ])')
+		en
+	en
+	let tps = s:statypes
+	let max = len(tps) - 1
+	let nxt = tps[s:walker(max, s:itemtype,  1)][1]
+	let prv = tps[s:walker(max, s:itemtype, -1)][1]
+	let s:ctype = tps[s:itemtype][0]
+	let focus   = s:focus ? 'prt'  : 'win'
+	let byfname = s:byfname ? 'file' : 'path'
+	let marked  = s:opmul != '0' ?