Commits

Jean-Philippe Thierry committed 73110d9

Further cleanup

  • Participants
  • Parent commits 0fef1f4
  • Branches sw_to_pathogen

Comments (0)

Files changed (6)

 bundle/syntastic = [git]git://github.com/scrooloose/syntastic.git
 bundle/nerdcommenter = [git]git://github.com/scrooloose/nerdcommenter.git
 bundle/surround = [git]git://github.com/tpope/vim-surround.git
+bundle/repeat = [git]git://github.com/tpope/vim-repeat.git
 b12afdeac7695b1e4563011687d4e31fe4abe314 bundle/python-coverage
 e309caf6a625df3e26a578e90ef922e2539f5122 bundle/python-syntax
 0877af4dffe6d86439f8069b510129527ce38b27 bundle/python_fn
+d75a544b786710705f0db0d8d8fd66ca4a5a7239 bundle/repeat
 44cb45865f33fd932216dd851b4a66ba92f08a5c bundle/rest-syntax
 bca739a6b1b12b99e4764dd1de83cb6679ec9050 bundle/ropevim
 f5a75d075d3c005ebe69e3f5e56cf99516e8aa3b bundle/snipmate

File doc/tags

-CommandT	command-t.txt	/*CommandT*
-CommandTFlush	command-t.txt	/*CommandTFlush*
-command-t	command-t.txt	/*command-t*
-command-t-always-show-dot-files	command-t.txt	/*command-t-always-show-dot-files*
-command-t-author	command-t.txt	/*command-t-author*
-command-t-commands	command-t.txt	/*command-t-commands*
-command-t-contents	command-t.txt	/*command-t-contents*
-command-t-donations	command-t.txt	/*command-t-donations*
-command-t-flush	command-t.txt	/*command-t-flush*
-command-t-history	command-t.txt	/*command-t-history*
-command-t-installation	command-t.txt	/*command-t-installation*
-command-t-license	command-t.txt	/*command-t-license*
-command-t-mappings	command-t.txt	/*command-t-mappings*
-command-t-max-depth	command-t.txt	/*command-t-max-depth*
-command-t-max-files	command-t.txt	/*command-t-max-files*
-command-t-max-height	command-t.txt	/*command-t-max-height*
-command-t-never-show-dot-files	command-t.txt	/*command-t-never-show-dot-files*
-command-t-options	command-t.txt	/*command-t-options*
-command-t-requirements	command-t.txt	/*command-t-requirements*
-command-t-scan-dot-directories	command-t.txt	/*command-t-scan-dot-directories*
-command-t-usage	command-t.txt	/*command-t-usage*
-command-t-website	command-t.txt	/*command-t-website*
-command-t-wildignore	command-t.txt	/*command-t-wildignore*
-command-t.txt	command-t.txt	/*command-t.txt*
-cs	surround.txt	/*cs*
-ds	surround.txt	/*ds*
-i_CTRL-G_S	surround.txt	/*i_CTRL-G_S*
-i_CTRL-G_s	surround.txt	/*i_CTRL-G_s*
-project	project.txt	/*project*
-project-adding-mappings	project.txt	/*project-adding-mappings*
-project-example	project.txt	/*project-example*
-project-flags	project.txt	/*project-flags*
-project-inheritance	project.txt	/*project-inheritance*
-project-invoking	project.txt	/*project-invoking*
-project-mappings	project.txt	/*project-mappings*
-project-plugin	project.txt	/*project-plugin*
-project-settings	project.txt	/*project-settings*
-project-syntax	project.txt	/*project-syntax*
-project-tips	project.txt	/*project-tips*
-project.txt	project.txt	/*project.txt*
-surround	surround.txt	/*surround*
-surround-author	surround.txt	/*surround-author*
-surround-customizing	surround.txt	/*surround-customizing*
-surround-issues	surround.txt	/*surround-issues*
-surround-mappings	surround.txt	/*surround-mappings*
-surround-replacements	surround.txt	/*surround-replacements*
-surround-targets	surround.txt	/*surround-targets*
-surround.txt	surround.txt	/*surround.txt*
-vs	surround.txt	/*vs*
-yS	surround.txt	/*yS*
-ySS	surround.txt	/*ySS*
-ys	surround.txt	/*ys*
-yss	surround.txt	/*yss*

File plugin/DirDiff.vim

-" -*- vim -*-
-" FILE: "/home/wlee/.vim/plugin/DirDiff.vim" {{{
-" LAST MODIFICATION: "Mon, 20 Oct 2008 09:04:59 -0500 (wlee)"
-" HEADER MAINTAINED BY: N/A
-" VERSION: 1.1.2
-" (C) 2001-2006 by William Lee, <wl1012@yahoo.com>
-" }}}
-
-
-" PURPOSE: {{{
-"   - Diffing a directory recursively and enable easy merging, copying and
-"   deleting of files and directories.
-"
-" REQUIREMENTS:
-"   - Make sure you have GNU diff in your path on Unix and Windows. I only
-"     tested this on cygwin's version on Windows.  If you have a diff that
-"     doesn't support -x or -I flag, do not set variable g:DirDiffExcludes and
-"     g:DirDiffIgnore to "".  It should still work.
-"   - On Windows, you need to have "xcopy", "copy", "del", and "rd" in your
-"     path.
-"   - On Unix, you need to have "rm" and "cp" in your path.
-"
-" USAGE:
-"   Put this file in your ~/.vim/plugin
-" 
-"   Doing the following will generate a diff window.
-"
-"       :DirDiff <A:Src Directory> <B:Src Directory>
-"   e.g.
-"       :DirDiff ../something/dir1 /usr/bin/somethingelse/dir2
-"
-"   The following commands can be used inside the diff window:
-"   'Enter','o' - Diff open: open the diff file(s) where your cursor is at
-"   's' - Synchronize the current diff.  You can also select
-"         a range (through visual) and press 's' to synchronize differences
-"         across a range.
-"
-"         - There are 6 Options you can choose when you hit 's':
-"           1. A -> B
-"              Copy A to overwrite B
-"              If A's file actually points to a directory, it'll copy it to B
-"              recursively.
-"           2. B -> A
-"              Copy B to overwrite A
-"              If B's file actually points to a directory, it'll copy it to A
-"              recursively.
-"           3. Always A
-"              For the rest of the items that you've selected,
-"              synchronize like (1).
-"           4. Always B
-"              For the rest of the items that you've selected,
-"              synchronize like (2).
-"           5. Skip
-"              Skip this diff entry.
-"           6. Cancel
-"              Quit the loop and exit.
-"
-"   'u' - Diff update: update the diff window
-"   'x' - Sets the exclude pattern, separated by ','
-"   'i' - Sets the ignore pattern, separated by ','
-"   'a' - Sets additional arguments for diff, eg. -w to ignore white space,
-"         etc.
-"   'q' - Quit DirDiff
-"    
-"   The following comamnds can be used in the Vim diff mode
-"   \dg - Diff get: maps to :diffget<CR>
-"   \dp - Diff put: maps to :diffput<CR>
-"   \dj - Diff next: (think j for down) 
-"   \dk - Diff previous: (think k for up)
-"
-"   You can set the following DirDiff variables.  You can add the following
-"   "let" lines in your .vimrc file.
-"
-"   Sets default exclude pattern:
-"       let g:DirDiffExcludes = "CVS,*.class,*.exe,.*.swp"
-"
-"   Sets default ignore pattern:
-"       let g:DirDiffIgnore = "Id:,Revision:,Date:"
-"
-"   If DirDiffSort is set to 1, sorts the diff lines.
-"       let g:DirDiffSort = 1
-"
-"   Sets the diff window (bottom window) height (rows)
-"       let g:DirDiffWindowSize = 14
-"
-"   Ignore case during diff
-"       let g:DirDiffIgnoreCase = 0
-"
-"   Dynamically figure out the diff text.  If you are using and i18n version
-"   of diff, this will try to get the specific diff text during runtime.  It's
-"   turned off by default.  If you are always targetting a specific version of
-"   diff, you can turn this off and set the DirDiffText* variables
-"   accordingly.
-"       let g:DirDiffDynamicDiffText = 0
-"
-"   String used for the English equivalent "Files "
-"       let g:DirDiffTextFiles = "Files "
-
-"   String used for the English equivalent " and "
-"       let g:DirDiffTextAnd = " and "
-"
-"   String used for the English equivalent " differ")
-"       let g:DirDiffTextDiffer = " differ"
-"
-"   String used for the English equivalent "Only in ")
-"       let g:DirDiffTextOnlyIn = "Only in "
-"
-" NOTES:
-"   This script can copy and remove your files.  This can be powerful (or too
-"   powerful) at times.  Please do not blame me if you use this and
-"   disintegrate your hard work.  Be warned!
-"
-" CREDITS:
-"
-"   Please mail any comment/suggestion/patch to 
-"   William Lee <wl1012@yahoo.com>
-"
-" LICENSE:
-"   Copyright (c) 2001-2006 William Lee
-"   All rights reserved.
-"
-"   Redistribution and use in source and binary forms, with or without
-"   modification, are permitted provided that the following conditions are
-"   met:
-"
-"     * Redistributions of source code must retain the above copyright
-"       notice, this list of conditions and the following disclaimer.
-"     * Redistributions in binary form must reproduce the above copyright
-"       notice, this list of conditions and the following disclaimer in the
-"       documentation and/or other materials provided with the distribution.
-"     * Neither the name William Lee nor the names of its contributors may be
-"       used to endorse or promote products derived from this software without
-"       specific prior written permission.
-"
-"   THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-"   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-"   AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-"   WILLIAM LEE AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-"   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-"   NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-"   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-"   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-"   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-"   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-"
-" THANKS:
-"
-"   Florian Delizy for the i18n diff patch
-"   Robert Webb for his sorting function
-"   Salman Halim, Yosuke Kimura, and others for their suggestions
-"
-" HISTORY:
-"  1.1.2  - Applied the patch to 1.1.0 instead of 1.0.2. Please do not use
-"           1.1.1
-"  1.1.1  - Make it work with filename with spaces. (Thanks to Atte Kojo)
-"  1.1.0  - Added support for i18n (tested on a French version for now only).
-"           Can dynamically figure out the diff strings output by diff.
-"  1.0.2  - Fixed a small typo bug in the quit function.
-"  1.0.1  - Ensure the path separator is correct when running in W2K
-"  1.0  - Fixed a bug that flags errors if the user use the nowrapscan option.
-"         Implements a quit function that exit the diff windows.
-"  0.94 - Fixed a bug where the diff will give incorrect A and B file due to
-"         similarity of directory names.  Allow you to modify the diff
-"         argument.
-"  0.93 - Opps, messed up the key mapping usage.
-"  0.92 - Doesn't use n and p mappings since it confuses the search next key
-"         mapping and causes some bugs.  Minor modification to change the
-"         exclude and ignore pattern.
-"  0.91 - Clean up delete routine.
-"       - Added interactive mode.
-"       - Added multiple entries of exclude and ignore pattern.  
-"       - Custom configuration through global variables.
-"       - Change exclude and ignore patterns on the fly.
-"        
-"  0.9  - Reorganization of the interface.  Much simplier dialog for
-"         synchronization.  Support for range synchronization option (REALLY
-"         powerful)
-"       - Removed unnecessary key bindings.  All key bindings are local to
-"         the diff window. (except for the \dg and \dp)
-"
-"  0.8  - Added syntax highlighting.
-"       - Enter and double-click in buffer opens diff.
-"       - Removed dependency on "sort"
-"       - Removed usage of registry and marker
-"       - Code cleanup and some bug fixes
-"       - On Windows the diff command will use the -i flag instead
-"       - Changed mappings for diff next (\dj) and diff previous (\dk)
-"       - Added mappings for vim diff mode (\dg, \dp)
-"
-"  0.7  Initial Release
-"
-" }}}
-
-" Public Interface:
-command! -nargs=* -complete=dir DirDiff call <SID>DirDiff (<f-args>)
-command! -nargs=0 DirDiffOpen call <SID>DirDiffOpen ()
-command! -nargs=0 DirDiffNext call <SID>DirDiffNext ()
-command! -nargs=0 DirDiffPrev call <SID>DirDiffPrev ()
-command! -nargs=0 DirDiffUpdate call <SID>DirDiffUpdate ()
-command! -nargs=0 DirDiffQuit call <SID>DirDiffQuit ()
-
-if !hasmapto('<Plug>DirDiffGet')
-  map <unique> <Leader>dg <Plug>DirDiffGet
-endif
-if !hasmapto('<Plug>DirDiffPut')
-  map <unique> <Leader>dp <Plug>DirDiffPut
-endif
-if !hasmapto('<Plug>DirDiffNext')
-  map <unique> <Leader>dj <Plug>DirDiffNext
-endif
-if !hasmapto('<Plug>DirDiffPrev')
-  map <unique> <Leader>dk <Plug>DirDiffPrev
-endif
-
-" Global Maps:
-map <unique> <script> <Plug>DirDiffGet    :diffget<CR>
-map <unique> <script> <Plug>DirDiffPut    :diffput<CR>
-map <unique> <script> <Plug>DirDiffNext    :call <SID>DirDiffNext()<CR>
-map <unique> <script> <Plug>DirDiffPrev    :call <SID>DirDiffPrev()<CR>
-map <unique> <script> <Plug>DirDiffQuit    :call <SID>DirDiffQuit()<CR>
-
-" Default Variables.  You can override these in your global variables
-" settings.
-"
-" For DirDiffExcludes and DirDiffIgnore, separate different patterns with a
-" ',' (comma and no space!).
-"
-" eg. in your .vimrc file: let g:DirDiffExcludes = "CVS,*.class,*.o"
-"                          let g:DirDiffIgnore = "Id:"
-"                          " ignore white space in diff
-"                          let g:DirDiffAddArgs = "-w" 
-"
-" You can set the pattern that diff excludes.  Defaults to the CVS directory
-if !exists("g:DirDiffExcludes")
-    let g:DirDiffExcludes = ""
-endif
-" This is the -I argument of the diff, ignore the lines of differences that
-" matches the pattern
-if !exists("g:DirDiffIgnore")
-    let g:DirDiffIgnore = ""
-endif
-if !exists("g:DirDiffSort")
-    let g:DirDiffSort = 1
-endif
-if !exists("g:DirDiffWindowSize")
-    let g:DirDiffWindowSize = 14
-endif
-if !exists("g:DirDiffInteractive")
-    let g:DirDiffInteractive = 0
-endif
-if !exists("g:DirDiffIgnoreCase")
-    let g:DirDiffIgnoreCase = 0
-endif
-" Additional arguments
-if !exists("g:DirDiffAddArgs")
-    let g:DirDiffAddArgs = ""
-endif
-" Support for i18n (dynamically figure out the diff text)
-" Defaults to off
-if !exists("g:DirDiffDynamicDiffText")
-    let g:DirDiffDynamicDiffText = 0
-endif
-
-" String used for the English equivalent "Files "
-if !exists("g:DirDiffTextFiles")
-    let g:DirDiffTextFiles = "Files "
-endif
-
-" String used for the English equivalent " and "
-if !exists("g:DirDiffTextAnd")
-    let g:DirDiffTextAnd = " and "
-endif
-
-" String used for the English equivalent " differ")
-if !exists("g:DirDiffTextDiffer")
-    let g:DirDiffTextDiffer = " differ"
-endif
-
-" String used for the English equivalent "Only in ")
-if !exists("g:DirDiffTextOnlyIn")
-    let g:DirDiffTextOnlyIn = "Only in "
-endif
-
-" Set some script specific variables:
-"
-let s:DirDiffFirstDiffLine = 6
-let s:DirDiffALine = 1
-let s:DirDiffBLine = 2
-
-" -- Variables used in various utilities
-if has("unix")
-    let s:DirDiffCopyCmd = "cp"
-    let s:DirDiffCopyFlags = ""
-    let s:DirDiffCopyDirCmd = "cp"
-    let s:DirDiffCopyDirFlags = "-rf"
-    let s:DirDiffCopyInteractiveFlag = "-i"
-
-    let s:DirDiffDeleteCmd = "rm"
-    let s:DirDiffDeleteFlags = ""
-    let s:DirDiffDeleteInteractiveFlag = "-i"
-
-    let s:DirDiffDeleteDirCmd = "rm"
-    let s:DirDiffDeleteDirFlags = "-rf"
-
-    let s:sep = "/"
-
-    let s:DirDiffMakeDirCmd  = "!mkdir "
-
-elseif has("win32")
-    let s:DirDiffCopyCmd = "copy"
-    let s:DirDiffCopyFlags = ""
-    let s:DirDiffCopyDirCmd = "xcopy"
-    let s:DirDiffCopyDirFlags = "/e /i /q"
-    let s:DirDiffCopyInteractiveFlag = "/-y"
-
-    let s:DirDiffDeleteCmd = "del"
-    let s:DirDiffDeleteFlags = "/s /q"
-    let s:DirDiffDeleteInteractiveFlag = "/p"
-    " Windows is somewhat stupid since "del" can only remove the files, not
-    " the directory.  The command "rd" would remove files recursively, but it
-    " doesn't really work on a file (!).  where is the deltree command???
-     
-    let s:DirDiffDeleteDirCmd = "rd"
-    " rd is by default prompting, we need to handle this in a different way
-    let s:DirDiffDeleteDirFlags = "/s"
-    let s:DirDiffDeleteDirQuietFlag = "/q"
-
-    let s:sep = "\\"
-
-    let s:DirDiffMakeDirCmd  = "!mkdir "
-else
-    " Platforms not supported
-    let s:DirDiffCopyCmd = ""
-    let s:DirDiffCopyFlags = ""
-    let s:DirDiffDeleteCmd = ""
-    let s:DirDiffDeleteFlags = ""
-    let s:sep = ""
-endif
-
-
-function! <SID>DirDiff(srcA, srcB)
-    " Setup
-    let DirDiffAbsSrcA = fnamemodify(expand(a:srcA, ":p"), ":p")
-    let DirDiffAbsSrcB = fnamemodify(expand(a:srcB, ":p"), ":p")
-
-    " Check for an internationalized version of diff ?
-    call <SID>GetDiffStrings()
-
-    " Remove the trailing \ or /
-    let DirDiffAbsSrcA = substitute(DirDiffAbsSrcA, '\\$\|/$', '', '')
-    let DirDiffAbsSrcB = substitute(DirDiffAbsSrcB, '\\$\|/$', '', '')
-
-    let DiffBuffer = tempname()
-    " We first write to that file
-    " Constructs the command line
-    let cmd = "!diff"
-    let cmdarg = " -r --brief"
-
-    " If variable is set, we ignore the case
-    if (g:DirDiffIgnoreCase)
-        let cmdarg = cmdarg." -i"
-    endif
-    if (g:DirDiffAddArgs != "")
-        let cmdarg = cmdarg." ".g:DirDiffAddArgs." "
-    endif
-    if (g:DirDiffExcludes != "")
-        let cmdarg = cmdarg.' -x"'.substitute(g:DirDiffExcludes, ',', '" -x"', 'g').'"'
-    endif
-    if (g:DirDiffIgnore != "")
-        let cmdarg = cmdarg.' -I"'.substitute(g:DirDiffIgnore, ',', '" -I"', 'g').'"'
-    endif
-    " Prompt the user for additional arguments
-"    let addarg = input("Additional diff args (current =". cmdarg. "): ")
-    let addarg = ""
-    let cmd = cmd.cmdarg." ".addarg." \"".DirDiffAbsSrcA."\" \"".DirDiffAbsSrcB."\""
-    let cmd = cmd." > \"".DiffBuffer."\""
-
-    echo "Diffing directories, it may take a while..."
-    let error = <SID>DirDiffExec(cmd, 0)
-    if (error == 0)
-        echo "There is no diff here."
-        return
-    endif
-    silent exe "edit ".DiffBuffer
-    echo "Defining [A] and [B] ... "
-    " We then do a substitution on the directory path
-    " We need to do substitution of the the LONGER string first, otherwise
-    " it'll mix up the A and B directory
-    if (strlen(DirDiffAbsSrcA) > strlen(DirDiffAbsSrcB))
-	    silent! exe "%s/".<SID>EscapeDirForRegex(DirDiffAbsSrcA)."/[A]/"
-	    silent! exe "%s/".<SID>EscapeDirForRegex(DirDiffAbsSrcB)."/[B]/"
-    else
-	    silent! exe "%s/".<SID>EscapeDirForRegex(DirDiffAbsSrcB)."/[B]/"
-	    silent! exe "%s/".<SID>EscapeDirForRegex(DirDiffAbsSrcA)."/[A]/"
-    endif
-    " In windows, diff behaves somewhat weirdly, for the appened path it'll
-    " use "/" instead of "\".  Convert this to \
-    if (has("win32"))
-        silent! %s/\//\\/g
-    endif
-
-    echo "Sorting entries ..."
-    " We then sort the lines if the option is set
-    if (g:DirDiffSort == 1)
-        1,$call <SID>Sort("s:Strcmp")
-    endif
-
-    " Put in spacer in front of each line
-    silent! %s/^/    /
-
-    " We then put the file [A] and [B] on top of the diff lines
-    call append(0, "[A]=". DirDiffAbsSrcA)
-    call append(1, "[B]=". DirDiffAbsSrcB)
-    call append(2, "Usage:   <Enter>/'o'=open,'s'=sync,'\\dj'=next,'\\dk'=prev, 'q'=quit")
-    call append(3, "Options: 'u'=update,'x'=set excludes,'i'=set ignore,'a'=set args" )
-    call append(4, "Diff Args:" . cmdarg)
-    call append(5, "")
-    " go to the beginning of the file
-    0
-    setlocal nomodified
-    setlocal nomodifiable
-    setlocal buftype=nowrite
-    setlocal bufhidden=delete
-    setlocal nowrap
-
-    " Set up local key bindings
-    " 'n' actually messes with the search next pattern, I think using \dj and
-    " \dk is enough.  Otherwise, use j,k, and enter.
-"    nnoremap <buffer> n :call <SID>DirDiffNext()<CR>
-"    nnoremap <buffer> p :call <SID>DirDiffPrev()<CR>
-    nnoremap <buffer> s :. call <SID>DirDiffSync()<CR>
-    vnoremap <buffer> s :call <SID>DirDiffSync()<CR>
-    nnoremap <buffer> u :call <SID>DirDiffUpdate()<CR>
-    nnoremap <buffer> x :call <SID>ChangeExcludes()<CR>
-    nnoremap <buffer> a :call <SID>ChangeArguments()<CR>
-    nnoremap <buffer> i :call <SID>ChangeIgnore()<CR>
-    nnoremap <buffer> q :call <SID>DirDiffQuit()<CR>
-
-    nnoremap <buffer> o    :call <SID>DirDiffOpen()<CR>
-    nnoremap <buffer> <CR>  :call <SID>DirDiffOpen()<CR>  
-    nnoremap <buffer> <2-Leftmouse> :call <SID>DirDiffOpen()<CR>
-    call <SID>SetupSyntax()
-
-    " Open the first diff
-    call <SID>DirDiffNext()
-endfunction
-
-" Set up syntax highlighing for the diff window
-function! <SID>SetupSyntax()
-  if has("syntax") && exists("g:syntax_on") 
-      "&& !has("syntax_items")
-    syn match DirDiffSrcA               "\[A\]"
-    syn match DirDiffSrcB               "\[B\]"
-    syn match DirDiffUsage              "^Usage.*"
-    syn match DirDiffOptions            "^Options.*"
-    exec 'syn match DirDiffFiles              "' . s:DirDiffDifferLine .'"'
-    exec 'syn match DirDiffOnly               "' . s:DirDiffDiffOnlyLine . '"'
-    syn match DirDiffSelected           "^==>.*" contains=DirDiffSrcA,DirDiffSrcB
-
-    hi def link DirDiffSrcA               Directory
-    hi def link DirDiffSrcB               Type
-    hi def link DirDiffUsage              Special
-    hi def link DirDiffOptions            Special
-    hi def link DirDiffFiles              String
-    hi def link DirDiffOnly               PreProc
-    hi def link DirDiffSelected           DiffChange
-  endif
-endfunction
-
-" You should call this within the diff window
-function! <SID>DirDiffUpdate()
-    let dirA = <SID>GetBaseDir("A")
-    let dirB = <SID>GetBaseDir("B")
-    call <SID>DirDiff(dirA, dirB)
-endfun
-
-" Quit the DirDiff mode
-function! <SID>DirDiffQuit()
-    let in = confirm ("Are you sure you want to quit DirDiff?", "&Yes\n&No", 2)
-    if (in == 1)
-        call <SID>CloseDiffWindows()
-        bd!
-    endif
-endfun
-
-" Returns an escaped version of the path for regex uses
-function! <SID>EscapeDirForRegex(path)
-    " This list is probably not complete, modify later
-    return escape(a:path, "/\\[]$^~")
-endfunction
-
-" Close the opened diff comparison windows if they exist
-function! <SID>CloseDiffWindows()
-    if (<SID>AreDiffWinsOpened())
-        wincmd k
-        " Ask the user to save if buffer is modified
-        call <SID>AskIfModified()
-        bd!
-        " User may just have one window opened, we may not need to close
-        " the second diff window
-        if (&diff)
-            call <SID>AskIfModified()
-            bd!
-        endif
-    endif
-endfunction
-
-
-function! <SID>DirDiffOpen()
-    " First dehighlight the last marked
-    call <SID>DeHighlightLine()
-
-    " Mark the current location of the line
-    "mark n
-    let b:currentDiff = line(".")
-
-    " We first parse back the [A] and [B] directories from the top of the line
-    let dirA = <SID>GetBaseDir("A")
-    let dirB = <SID>GetBaseDir("B")
-
-    call <SID>CloseDiffWindows()
-
-    let line = getline(".")
-    " Parse the line and see whether it's a "Only in" or "Files Differ"
-    call <SID>HighlightLine()
-    let fileA = <SID>GetFileNameFromLine("A", line)
-    let fileB = <SID>GetFileNameFromLine("B", line)
-    if <SID>IsOnly(line)
-        " We open the file
-        let fileSrc = <SID>ParseOnlySrc(line)
-        if (fileSrc == "A")
-            let fileToOpen = fileA
-        elseif (fileSrc == "B")
-            let fileToOpen = fileB
-        endif
-        split
-        wincmd k
-        silent exec "edit ".fnameescape(fileToOpen)
-        " Fool the window saying that this is diff
-        diffthis
-        wincmd j
-        " Resize the window
-        exe("resize " . g:DirDiffWindowSize)
-        exe (b:currentDiff)
-    elseif <SID>IsDiffer(line)
-        "Open the diff windows
-        split
-        wincmd k
-        silent exec "edit ".fnameescape(fileB)
-        silent exec "vert diffsplit ".fnameescape(fileA)
-        " Go back to the diff window
-        wincmd j
-        " Resize the window
-        exe("resize " . g:DirDiffWindowSize)
-        exe (b:currentDiff)
-        " Center the line
-        exe ("normal z.")
-    else
-        echo "There is no diff at the current line!"
-    endif
-endfunction
-
-" Ask the user to save if the buffer is modified
-"
-function! <SID>AskIfModified()
-    if (&modified)
-        let input = confirm("File " . expand("%:p") . " has been modified.", "&Save\nCa&ncel", 1)
-        if (input == 1)
-            w!
-        endif
-    endif
-endfunction
-
-function! <SID>HighlightLine()
-    let savedLine = line(".")
-    exe (b:currentDiff)
-    setlocal modifiable
-    let line = getline(".")
-    if (match(line, "^    ") == 0)
-        s/^    /==> /
-    endif
-    setlocal nomodifiable
-    setlocal nomodified
-    exe (savedLine)
-    redraw
-endfunction
-
-function! <SID>DeHighlightLine()
-    let savedLine = line(".")
-    exe (b:currentDiff)
-    let line = getline(".")
-    setlocal modifiable
-    if (match(line, "^==> ") == 0)
-        s/^==> /    /
-    endif
-    setlocal nomodifiable
-    setlocal nomodified
-    exe (savedLine)
-    redraw
-endfunction
-
-" Returns the directory for buffer "A" or "B".  You need to be in the diff
-" buffer though.
-function! <SID>GetBaseDir(diffName)
-    let currLine = line(".")
-    if (a:diffName == "A")
-        let baseLine = s:DirDiffALine
-    else
-        let baseLine = s:DirDiffBLine
-    endif
-    let regex = '\['.a:diffName.'\]=\(.*\)'
-    let line = getline(baseLine)
-    let rtn = substitute(line, regex , '\1', '')
-    return rtn
-endfunction
-
-function! <SID>DirDiffNext()
-    " If the current window is a diff, go down one
-    if (&diff == 1)
-        wincmd j
-    endif
-    " if the current line is <= 6, (within the header range), we go to the
-    " first diff line open it
-    if (line(".") < s:DirDiffFirstDiffLine)
-        exe (s:DirDiffFirstDiffLine)
-        let b:currentDiff = line(".")
-    endif
-    silent! exe (b:currentDiff + 1)
-    call <SID>DirDiffOpen()
-endfunction
-
-function! <SID>DirDiffPrev()
-    " If the current window is a diff, go down one
-    if (&diff == 1)
-        wincmd j
-    endif
-    silent! exe (b:currentDiff - 1)
-    call <SID>DirDiffOpen()
-endfunction
-
-" For each line, we can perform a recursive copy or delete to sync up the
-" difference. Returns non-zero if the operation is NOT successful, returns 0
-" if everything is fine.
-"
-function! <SID>DirDiffSyncHelper(AB, line)
-    let fileA = <SID>GetFileNameFromLine("A", a:line)
-    let fileB = <SID>GetFileNameFromLine("B", a:line)
-"    echo "Helper line is ". a:line. " fileA " . fileA . " fileB " . fileB
-    if <SID>IsOnly(a:line)
-        " If a:AB is "A" and the ParseOnlySrc returns "A", that means we need to
-        " copy
-        let fileSrc = <SID>ParseOnlySrc(a:line)
-        let operation = ""
-        if (a:AB == "A" && fileSrc == "A")
-            let operation = "Copy"
-            " Use A, and A has source, thus copy the file from A to B
-            let fileFrom = fileA
-            let fileTo = fileB
-        elseif (a:AB == "A" && fileSrc == "B")
-            let operation = "Delete"
-            " Use A, but B has source, thus delete the file from B
-            let fileFrom = fileB
-            let fileTo = fileA
-        elseif (a:AB == "B" && fileSrc == "A")
-            let operation = "Delete"
-            " Use B, but the source file is A, thus removing A
-            let fileFrom = fileA
-            let fileTo = fileB
-        elseif (a:AB == "B" && fileSrc == "B")
-            " Use B, and B has the source file, thus copy B to A
-            let operation = "Copy"
-            let fileFrom = fileB
-            let fileTo = fileA
-        endif
-    elseif <SID>IsDiffer(a:line)
-        " Copy no matter what
-        let operation = "Copy"
-        if (a:AB == "A")
-            let fileFrom = fileA
-            let fileTo = fileB
-        elseif (a:AB == "B")
-            let fileFrom = fileB
-            let fileTo = fileA
-        endif
-    else 
-        echo "There is no diff here!"
-        " Error
-        return 1
-    endif
-    if (operation == "Copy")
-        let rtnCode = <SID>Copy(fileFrom, fileTo)
-    elseif (operation == "Delete")
-        let rtnCode = <SID>Delete(fileFrom)
-    endif
-    return rtnCode
-endfunction
-
-" Synchronize the range
-function! <SID>DirDiffSync() range
-    let answer = 1
-    let silence = 0
-    let syncMaster = "A"
-    let currLine = a:firstline
-    let lastLine = a:lastline
-    let syncCount = 0
-
-    while ((currLine <= lastLine))
-        " Update the highlight
-        call <SID>DeHighlightLine()
-        let b:currentDiff = currLine
-        call <SID>HighlightLine()
-        let line = getline(currLine)
-        if (!silence)
-            let answer = confirm(substitute(line, "^....", '', ''). "\nSynchronization option:" , "&A -> B\n&B -> A\nA&lways A\nAl&ways B\n&Skip\nCa&ncel", 6)
-            if (answer == 1 || answer == 3)
-                let syncMaster = "A"
-            endif
-            if (answer == 2 || answer == 4)
-                let syncMaster = "B"
-            endif
-            if (answer == 3 || answer == 4)
-                let silence = 1
-            endif
-            if (answer == 5)
-                let currLine = currLine + 1
-                continue
-            endif
-            if (answer == 6)
-                break
-            endif
-        endif
-
-"        call <SID>DeHighlightLine()
-        let rtnCode = <SID>DirDiffSyncHelper(syncMaster, line)
-        if (rtnCode == 0)
-            " Successful
-            let syncCount = syncCount + 1
-            " Assume that the line is synchronized, we delete the entry
-            setlocal modifiable
-            exe (currLine.",".currLine." delete")
-            setlocal nomodifiable
-            setlocal nomodified
-            let lastLine = lastLine - 1
-        else
-            " Failed!
-            let currLine = currLine + 1
-        endif
-    endwhile
-    echo syncCount . " diff item(s) synchronized."
-endfunction
-
-" Return file "A" or "B" depending on the line given.  If it's a Only line,
-" either A or B does not exist, but the according value would be returned.
-function! <SID>GetFileNameFromLine(AB, line)
-    " Determine where the source of the copy is.
-    let dirA = <SID>GetBaseDir("A")
-    let dirB = <SID>GetBaseDir("B")
-
-    let fileToProcess = ""
-
-    if <SID>IsOnly(a:line)
-        let fileToProcess = <SID>ParseOnlyFile(a:line)
-    elseif <SID>IsDiffer(a:line)
-        let regex = '^.*' . s:DirDiffDifferLine . '\[A\]\(.*\)' . s:DirDiffDifferAndLine . '\[B\]\(.*\)' . s:DirDiffDifferEndLine . '.*$'
-        let fileToProcess = substitute(a:line, regex, '\1', '')
-    else
-    endif
-
-    "echo "line : " . a:line. "AB = " . a:AB . " File to Process " . fileToProcess
-    if (a:AB == "A")
-        return dirA . fileToProcess
-    elseif (a:AB == "B")
-        return dirB . fileToProcess
-    else
-        return ""
-    endif
-endfunction
-
-"Returns the source (A or B) of the "Only" line
-function! <SID>ParseOnlySrc(line)
-    return substitute(a:line, '^.*' . s:DirDiffDiffOnlyLine . '\[\(.\)\].*:.*', '\1', '')
-endfunction
-
-function! <SID>ParseOnlyFile(line)
-    let regex = '^.*' . s:DirDiffDiffOnlyLine . '\[.\]\(.*\): \(.*\)'
-    let root = substitute(a:line, regex , '\1', '')
-    let file = root . s:sep . substitute(a:line, regex , '\2', '')
-    return file
-endfunction
-
-function! <SID>Copy(fileFromOrig, fileToOrig)
-    let fileFrom = substitute(a:fileFromOrig, '/', s:sep, 'g')
-    let fileTo = substitute(a:fileToOrig, '/', s:sep, 'g')
-    echo "Copy from " . fileFrom . " to " . fileTo
-    if (s:DirDiffCopyCmd == "")
-        echo "Copy not supported on this platform"
-        return 1
-    endif
-
-    " Constructs the copy command
-    let copycmd = "!".s:DirDiffCopyCmd." ".s:DirDiffCopyFlags
-    " Append the interactive flag
-    if (g:DirDiffInteractive)
-        let copycmd = copycmd . " " . s:DirDiffCopyInteractiveFlag
-    endif
-    let copycmd = copycmd . " \"".fileFrom."\" \"".fileTo."\""
-
-    " Constructs the copy directory command
-    let copydircmd = "!".s:DirDiffCopyDirCmd." ".s:DirDiffCopyDirFlags
-    " Append the interactive flag
-    if (g:DirDiffInteractive)
-        let copydircmd = copydircmd . " " . s:DirDiffCopyInteractiveFlag
-    endif
-    let copydircmd = copydircmd . " \"".fileFrom."\" \"".fileTo."\""
-
-    let error = 0
-    if (isdirectory(fileFrom))
-        let error = <SID>DirDiffExec(copydircmd, g:DirDiffInteractive)
-    else
-        let error = <SID>DirDiffExec(copycmd, g:DirDiffInteractive)
-    endif
-    if (error != 0)
-        echo "Can't copy from " . fileFrom . " to " . fileTo
-        return 1
-    endif
-    return 0
-endfunction
-
-" Would execute the command, either silent or not silent, by the
-" interactive flag ([0|1]).  Returns the v:shell_error after
-" executing the command.
-function! <SID>DirDiffExec(cmd, interactive)
-    let error = 0
-    if (a:interactive)
-        exe (a:cmd)
-        let error = v:shell_error
-    else
-        silent exe (a:cmd)
-        let error = v:shell_error
-    endif
-"    let d = input("DirDiffExec: " . a:cmd . " " . a:interactive . " returns " . v:shell_error)
-    return error
-endfunction
-
-" Delete the file or directory.  Returns 0 if nothing goes wrong, error code
-" otherwise.
-function! <SID>Delete(fileFromOrig)
-    let fileFrom = substitute(a:fileFromOrig, '/', s:sep, 'g')
-    echo "Deleting from " . fileFrom
-    if (s:DirDiffDeleteCmd == "")
-        echo "Delete not supported on this platform"
-        return 1
-    endif
-
-    let delcmd = ""
-
-    if (isdirectory(fileFrom))
-        let delcmd = "!".s:DirDiffDeleteDirCmd." ".s:DirDiffDeleteDirFlags
-        if (g:DirDiffInteractive)
-            " If running on Unix, and we're running in interactive mode, we
-            " append the -i tag
-            if (has("unix"))
-                let delcmd = delcmd . " " . s:DirDiffDeleteInteractiveFlag
-            endif
-        else
-            " If running on windows, and we're not running in interactive
-            " mode, we append the quite flag to the "rd" command
-            if (has("win32"))
-                let delcmd = delcmd . " " . s:DirDiffDeleteDirQuietFlag
-            endif
-        endif
-    else
-        let delcmd = "!".s:DirDiffDeleteCmd." ".s:DirDiffDeleteFlags
-        if (g:DirDiffInteractive)
-            let delcmd = delcmd . " " . s:DirDiffDeleteInteractiveFlag
-        endif
-    endif
-
-    let delcmd = delcmd ." \"".fileFrom."\""
-    let error = <SID>DirDiffExec(delcmd, g:DirDiffInteractive)
-    if (error != 0)
-        echo "Can't delete " . fileFrom
-    endif
-    return error
-endfunction
-
-function! <SID>AreDiffWinsOpened()
-    let currBuff = expand("%:p")
-    let currLine = line(".")
-    wincmd k
-    let abovedBuff = expand("%:p")
-    if (&diff)
-        let abovedIsDiff = 1
-    else
-        let abovedIsDiff = 0
-    endif
-    " Go Back if the aboved buffer is not the same
-    if (currBuff != abovedBuff)
-        wincmd j
-        " Go back to the same line
-        exe (currLine)
-        if (abovedIsDiff == 1)
-            return 1
-        else
-            " Aboved is just a bogus buffer, not a diff buffer
-            return 0
-        endif
-    else
-        exe (currLine)
-        return 0
-    endif
-endfunction
-
-" The given line begins with the "Only in"
-function! <SID>IsOnly(line)	
-    return (match(a:line, "^ *" . s:DirDiffDiffOnlyLine . "\\|^==> " . s:DirDiffDiffOnlyLine ) == 0)
-endfunction
-
-" The given line begins with the "Files"
-function! <SID>IsDiffer(line)
-    return (match(a:line, "^ *" . s:DirDiffDifferLine . "\\|^==> " . s:DirDiffDifferLine  ) == 0)
-endfunction
-
-" Let you modify the Exclude patthern
-function! <SID>ChangeExcludes()
-    let g:DirDiffExcludes = input ("Exclude pattern (separate multiple patterns with ','): ", g:DirDiffExcludes)
-    echo "\nPress update ('u') to refresh the diff."
-endfunction
-
-" Let you modify additional arguments for diff
-function! <SID>ChangeArguments()
-    let g:DirDiffAddArgs = input ("Additional diff args: ", g:DirDiffAddArgs)
-    echo "\nPress update ('u') to refresh the diff."
-endfunction
-
-" Let you modify the Ignore patthern
-function! <SID>ChangeIgnore()
-    let g:DirDiffIgnore = input ("Ignore pattern (separate multiple patterns with ','): ", g:DirDiffIgnore)
-    echo "\nPress update ('u') to refresh the diff."
-endfunction
-
-" Sorting functions from the Vim docs.  Use this instead of the sort binary.
-"
-" Function for use with Sort(), to compare two strings.
-func! <SID>Strcmp(str1, str2)
-  if (a:str1 < a:str2)
-	return -1
-  elseif (a:str1 > a:str2)
-	return 1
-  else
-	return 0
-  endif
-endfunction
-
-" Sort lines.  SortR() is called recursively.
-func! <SID>SortR(start, end, cmp)
-  if (a:start >= a:end)
-	return
-  endif
-  let partition = a:start - 1
-  let middle = partition
-  let partStr = getline((a:start + a:end) / 2)
-  let i = a:start
-  while (i <= a:end)
-	let str = getline(i)
-	exec "let result = " . a:cmp . "(str, partStr)"
-	if (result <= 0)
-	    " Need to put it before the partition.  Swap lines i and partition.
-	    let partition = partition + 1
-	    if (result == 0)
-		let middle = partition
-	    endif
-	    if (i != partition)
-		let str2 = getline(partition)
-		call setline(i, str2)
-		call setline(partition, str)
-	    endif
-	endif
-	let i = i + 1
-  endwhile
-
-  " Now we have a pointer to the "middle" element, as far as partitioning
-  " goes, which could be anywhere before the partition.  Make sure it is at
-  " the end of the partition.
-  if (middle != partition)
-	let str = getline(middle)
-	let str2 = getline(partition)
-	call setline(middle, str2)
-	call setline(partition, str)
-  endif
-  call <SID>SortR(a:start, partition - 1, a:cmp)
-  call <SID>SortR(partition + 1, a:end, a:cmp)
-endfunc
-
-" To Sort a range of lines, pass the range to Sort() along with the name of a
-" function that will compare two lines.
-func! <SID>Sort(cmp) range
-  call <SID>SortR(a:firstline, a:lastline, a:cmp)
-endfunc
-
-" Added to deal with internationalized version of diff, which returns a
-" different string than "Files ... differ" or "Only in ... "
-
-function! <SID>GetDiffStrings()
-    " Check if we have the dynamic text string turned on.  If not, just return
-    " what's set in the global variables
-
-    if (g:DirDiffDynamicDiffText == 0)
-        let s:DirDiffDiffOnlyLine = g:DirDiffTextOnlyIn
-        let s:DirDiffDifferLine = g:DirDiffTextFiles
-        let s:DirDiffDifferAndLine = g:DirDiffTextAnd
-        let s:DirDiffDifferEndLine = g:DirDiffTextDiffer
-        return
-    endif
-
-	let tmp1 = tempname()
-	let tmp2 = tempname()
-	let tmpdiff = tempname()
-
-    " We need to pad the backslashes in order to make it match
-    let tmp1rx = <SID>EscapeDirForRegex(tmp1)
-    let tmp2rx = <SID>EscapeDirForRegex(tmp2)
-    let tmpdiffrx = <SID>EscapeDirForRegex(tmpdiff)
-
-	silent exe s:DirDiffMakeDirCmd . "\"" . tmp1 . "\""
-	silent exe s:DirDiffMakeDirCmd . "\"" . tmp2 . "\""
-	silent exe "!echo test > \"" . tmp1 . s:sep . "test" . "\""
-	silent exe "!diff -r --brief \"" . tmp1 . "\" \"" . tmp2 . "\" > \"" . tmpdiff . "\""
-
-	" Now get the result of that diff cmd
-	silent exe "split ". tmpdiff
-    "echo "First line: " . getline(1)
-    "echo "tmp1: " . tmp1
-    "echo "tmp1rx: " . tmp1rx
-	let s:DirDiffDiffOnlyLine = substitute( getline(1), tmp1rx . ".*$", "", '') 
-    "echo "DirDiff Only: " . s:DirDiffDiffOnlyLine
-	
-	q
-
-	" Now let's get the Differ string
-    "echo "Getting the diff in GetDiffStrings"
-	
-	silent exe "!echo testdifferent > \"" . tmp2 . s:sep . "test" . "\""
-	silent exe "!diff -r --brief \"" . tmp1 . "\" \"" . tmp2 . "\" > \"" . tmpdiff . "\""
-	
-	silent exe "split ". tmpdiff
-	let s:DirDiffDifferLine = substitute( getline(1), tmp1rx . ".*$", "", '') 
-    " Note that the diff on cygwin may output '/' instead of '\' for the
-    " separator, so we need to accomodate for both cases
-    let andrx = "^.*" . tmp1rx . "[\\\/]test\\(.*\\)" . tmp2rx . "[\\\/]test.*$"
-    let endrx = "^.*" . tmp1rx . "[\\\/]test.*" . tmp2rx . "[\\\/]test\\(.*$\\)"
-    "echo "andrx : " . andrx
-    "echo "endrx : " . endrx
-	let s:DirDiffDifferAndLine = substitute( getline(1), andrx , "\\1", '') 
-    let s:DirDiffDifferEndLine = substitute( getline(1), endrx, "\\1", '') 
-
-	"echo "s:DirDiffDifferLine = " . s:DirDiffDifferLine
-	"echo "s:DirDiffDifferAndLine = " . s:DirDiffDifferAndLine
-	"echo "s:DirDiffDifferEndLine = " . s:DirDiffDifferEndLine
-
-	q
-
-	" Delete tmp files
-    "echo "Deleting tmp files."
-
-	call <SID>Delete(tmp1)
-	call <SID>Delete(tmp2)
-	call <SID>Delete(tmpdiff)
-
-endfunction

File plugin/fuzzyfinder.vim

-"=============================================================================
-" fuzzyfinder.vim : Fuzzy/Partial pattern explorer for
-"                   buffer/file/MRU/command/favorite/tag/etc.
-"=============================================================================
-"
-" Author:  Takeshi NISHIDA <ns9tks@DELETE-ME.gmail.com>
-" Version: 2.13, for Vim 7.1
-" Licence: MIT Licence
-" URL:     http://www.vim.org/scripts/script.php?script_id=1984
-"
-" GetLatestVimScripts: 1984 1 :AutoInstall: fuzzyfinder.vim
-"
-"=============================================================================
-" DOCUMENT: {{{1
-"   Japanese: http://vim.g.hatena.ne.jp/keyword/fuzzyfinder.vim
-"
-"-----------------------------------------------------------------------------
-" Description:
-"   Fuzzyfinder provides convenient ways to quickly reach the buffer/file you
-"   want. Fuzzyfinder finds matching files/buffers with a fuzzy/partial
-"   pattern to which it converted the entered pattern.
-"
-"   E.g.: entered pattern -> fuzzy pattern / partial pattern
-"         abc             -> *a*b*c*       / *abc*
-"         a?c             -> *a?c*         / *a?c*
-"         dir/file        -> dir/*f*i*l*e* / dir/*file*
-"         d*r/file        -> d*r/*f*i*l*e* / d*r/*file*
-"         ../**/s         -> ../**/*s*     / ../**/*s*
-"
-"     (** allows searching a directory tree.)
-"
-"   You will be happy when:
-"     "./OhLongLongLongLongLongFile.txt"
-"     "./AhLongLongLongLongLongName.txt"
-"     "./AhLongLongLongLongLongFile.txt" <- you want :O
-"     Type "AF" and "AhLongLongLongLongLongFile.txt" will be select. :D
-"
-"   Fuzzyfinder has some modes:
-"     - Buffer mode
-"     - File mode
-"     - Directory mode (yet another :cd command)
-"     - MRU-file mode (most recently used files)
-"     - MRU-command mode (most recently used command-lines)
-"     - Favorite-file mode
-"     - Tag mode (yet another :tag command)
-"     - Tagged-file mode (files which are included in current tags)
-"
-"   Fuzzyfinder supports the multibyte.
-"
-"-----------------------------------------------------------------------------
-" Installation:
-"   Drop this file in your plugin directory.
-"
-"-----------------------------------------------------------------------------
-" Usage:
-"   Starting Fuzzyfinder:
-"     You can start Fuzzyfinder by the following commands:
-"
-"       :FuzzyFinderBuffer      - launchs buffer-mode Fuzzyfinder.
-"       :FuzzyFinderFile        - launchs file-mode Fuzzyfinder.
-"       :FuzzyFinderDir         - launchs directory-mode Fuzzyfinder.
-"       :FuzzyFinderMruFile     - launchs MRU-file-mode Fuzzyfinder.
-"       :FuzzyFinderMruCmd      - launchs MRU-command-mode Fuzzyfinder.
-"       :FuzzyFinderFavFile     - launchs favorite-file-mode Fuzzyfinder.
-"       :FuzzyFinderTag         - launchs tag-mode Fuzzyfinder.
-"       :FuzzyFinderTaggedFile  - launchs tagged-file-mode Fuzzyfinder.
-"
-"     It is recommended to map these commands. These commands can take initial
-"     text as a command argument. The text will be entered after Fuzzyfinder
-"     launched. If a command was executed with a ! modifier (e.g.
-"     :FuzzyFinderTag!), it enables the partial matching instead of the fuzzy
-"     matching.
-"
-"
-"   In Fuzzyfinder:
-"     The entered pattern is converted to the fuzzy pattern and buffers/files
-"     which match the pattern is shown in a completion menu.
-"
-"     A completion menu is shown when you type at the end of the line and the
-"     length of entered pattern is more than setting value. By default, it is
-"     shown at the beginning.
-"
-"     If too many items (200, by default) were matched, the completion is
-"     aborted to reduce nonresponse.
-"
-"     If an item were matched with entered pattern exactly, it is shown first.
-"     The item whose file name has longer prefix matching is placed upper.
-"     Also, an item which matched more sequentially is placed upper. The item
-"     whose index were matched with a number suffixed with entered pattern is
-"     placed lower. the first item in the completion menu will be selected
-"     automatically.
-"
-"     You can open a selected item in various ways:
-"       <CR>  - opens in a previous window.
-"       <C-j> - opens in a split window.
-"       <C-k> - opens in a vertical-split window.
-"       <C-]> - opens in a new tab page.
-"     In MRU-command mode, <CR> executes a selected command and others just
-"     put it into a command-line. These key mappings are customizable.
-"
-"     To cancel and return to previous window, leave Insert mode.
-"
-"     To Switch the mode without leaving Insert mode, use <C-l> or <C-o>.
-"     This key mapping is customizable.
-"
-"     If you want to temporarily change whether or not to ignore case, use
-"     <C-t>. This key mapping is customizable.
-"
-"   To Hide The Completion Temporarily Menu In Fuzzyfinder:
-"     You can close it by <C-e> and reopen it by <C-x><C-u>.
-"
-"   About Highlighting:
-"     Fuzzyfinder highlights the buffer with "Error" group when the completion
-"     item was not found or the completion process was aborted.
-"
-"   About Alternative Approach For Tag Jump:
-"     Following mappings are replacements for :tag and <C-]>:
-"
-"       nnoremap <silent> <C-f><C-t> :FuzzyFinderTag!<CR>
-"       nnoremap <silent> <C-]>      :FuzzyFinderTag! <C-r>=expand('<cword>')<CR><CR>
-"
-"     In the tag mode, it is recommended to use partial matching instead of
-"     fuzzy matching.
-"
-"   About Tagged File Mode:
-"     The files which are included in the current tags are the ones which are
-"     related to the current working environment. So this mode is a pseudo
-"     project mode.
-"
-"   About Usage Of Command Argument:
-"     As an example, if you want to launch file-mode Fuzzyfinder with the full
-"     path of current directory, map like below:
-"
-"       nnoremap <C-p> :FuzzyFinderFile <C-r>=fnamemodify(getcwd(), ':p')<CR><CR>
-"
-"     Instead, if you want the directory of current buffer and not current
-"     directory:
-"
-"       nnoremap <C-p> :FuzzyFinderFile <C-r>=expand('%:~:.')[:-1-len(expand('%:~:.:t'))]<CR><CR>
-"
-"   About Abbreviations And Multiple Search:
-"     You can use abbreviations and multiple search in each mode. For example,
-"     set as below:
-"
-"       let g:FuzzyFinderOptions.Base.abbrev_map  = {
-"             \   "^WORK" : [
-"             \     "~/project/**/src/",
-"             \     ".vim/plugin/",
-"             \   ],
-"             \ }
-"
-"     And type "WORKtxt" in file-mode Fuzzyfinder, then it searches by
-"     following patterns:
-"
-"       "~/project/**/src/*t*x*t*"
-"       ".vim/plugin/*t*x*t*"
-"
-"   Adding Favorite Files:
-"     You can add a favorite file by the following commands:
-"
-"       :FuzzyFinderAddFavFile {filename}
-"
-"     If you do not specify the filename, current file name is used.
-"
-"   About Information File:
-"     Fuzzyfinder writes information of the MRU, favorite, etc to the file by
-"     default (~/.vimfuzzyfinder).
-
-"     :FuzzyFinderEditInfo command is helpful in editing your information
-"     file. This command reads the information file in new unnamed buffer.
-"     Write the buffer and the information file will be updated.
-"
-"   About Cache:
-"     Once a cache was created, It is not updated automatically to improve
-"     response by default. To update it, use :FuzzyFinderRemoveCache command.
-"
-"   About Migemo:
-"     Migemo is a search method for Japanese language.
-"
-"-----------------------------------------------------------------------------
-" Options:
-"   You can set options via g:FuzzyFinderOptions which is a dictionary. See
-"   the folded section named "GLOBAL OPTIONS:" for details. To easily set
-"   options for customization, put necessary entries from GLOBAL OPTIONS into
-"   your vimrc file and edit those values.
-"
-"-----------------------------------------------------------------------------
-" Setting Example:
-"   let g:FuzzyFinderOptions = { 'Base':{}, 'Buffer':{}, 'File':{}, 'Dir':{}, 'MruFile':{}, 'MruCmd':{}, 'FavFile':{}, 'Tag':{}, 'TaggedFile':{}}
-"   let g:FuzzyFinderOptions.Base.ignore_case = 1
-"   let g:FuzzyFinderOptions.Base.abbrev_map  = {
-"         \   '\C^VR' : [
-"         \     '$VIMRUNTIME/**',
-"         \     '~/.vim/**',
-"         \     '$VIM/.vim/**',
-"         \     '$VIM/vimfiles/**',
-"         \   ],
-"         \ }
-"   let g:FuzzyFinderOptions.MruFile.max_item = 200
-"   let g:FuzzyFinderOptions.MruCmd.max_item = 200
-"   nnoremap <silent> <C-n>      :FuzzyFinderBuffer<CR>
-"   nnoremap <silent> <C-m>      :FuzzyFinderFile <C-r>=expand('%:~:.')[:-1-len(expand('%:~:.:t'))]<CR><CR>
-"   nnoremap <silent> <C-j>      :FuzzyFinderMruFile<CR>
-"   nnoremap <silent> <C-k>      :FuzzyFinderMruCmd<CR>
-"   nnoremap <silent> <C-p>      :FuzzyFinderDir <C-r>=expand('%:p:~')[:-1-len(expand('%:p:~:t'))]<CR><CR>
-"   nnoremap <silent> <C-f><C-d> :FuzzyFinderDir<CR>
-"   nnoremap <silent> <C-f><C-f> :FuzzyFinderFavFile<CR>
-"   nnoremap <silent> <C-f><C-t> :FuzzyFinderTag!<CR>
-"   nnoremap <silent> <C-f><C-g> :FuzzyFinderTaggedFile<CR>
-"   noremap  <silent> g]         :FuzzyFinderTag! <C-r>=expand('<cword>')<CR><CR>
-"   nnoremap <silent> <C-f>F     :FuzzyFinderAddFavFile<CR>
-"   nnoremap <silent> <C-f><C-e> :FuzzyFinderEditInfo<CR>
-"
-"-----------------------------------------------------------------------------
-" Special Thanks:
-"   Vincent Wang
-"   Ingo Karkat
-"   Nikolay Golubev
-"   Brian Doyle
-"   id:secondlife
-"   Matt Tolton
-"
-"-----------------------------------------------------------------------------
-" ChangeLog:
-"   2.13:
-"     - Fixed a bug that a directory disappeared when a file in that directroy
-"       was being opened in File/Mru-File mode.
-"
-"   2.12:
-"     - Changed to be able to show completion items in the order of recently
-"       used in Buffer mode.
-"     - Added g:FuzzyFinderOptions.Buffer.mru_order option.
-"
-"   2.11:
-"     - Changed that a dot sequence of entered pattern is expanded to parent
-"       directroies in File/Dir mode.
-"       E.g.: "foo/...bar" -> "foo/../../bar"
-"     - Fixed a bug that a prompt string was excessively inserted.
-"
-"   2.10:
-"     - Changed not to show a current buffer in a completion menu.
-"     - Fixed a bug that a filename to open was not been escaped.
-"     - Added 'prompt' option.
-"     - Added 'prompt_highlight' option.
-"     - Removed g:FuzzyFinderOptions.MruFile.no_special_buffer option.
-"
-"   2.9:
-"     - Enhanced <BS> behavior in Fuzzyfinder and added 'smart_bs' option.
-"     - Fixed a bug that entered pattern was not been escaped.
-"     - Fixed not to insert "zv" with "c/pattern<CR>" command in Normal mode.
-"     - Avoid the slow down problem caused by filereadable() check for the MRU
-"       information in BufEnter/BufWritePost.
-"
-"   2.8.1:
-"     - Fixed a bug caused by the non-escaped buffer name "[Fuzzyfinder]".
-"     - Fixed a command to open in a new tab page in Buffer mode.
-"   2.8:
-"     - Added 'trim_length' option.
-"     - Added 'switch_order' option.
-"     - Fixed a bug that entered command did not become the newest in the
-"       history.
-"     - Fixed a bug that folds could not open with <CR> in a command-line when
-"       searching.
-"     - Removed 'excluded_indicator' option. Now a completion list in Buffer
-"       mode is the same as a result of :buffers.
-"
-"   2.7:
-"     - Changed to find an item whose index is matched with the number
-"       suffixed with entered pattern.
-"     - Fixed the cache bug after changing current directroy in File mode.
-"
-"   2.6.2:
-"     - Fixed not to miss changes in options when updates the MRU information.
-"
-"   2.6.1:
-"     - Fixed a bug related to floating-point support.
-"     - Added support for GetLatestVimScripts.
-"
-"   2.6:
-"     - Revived MRU-command mode. The problem with a command-line abbreviation
-"       was solved.
-"     - Changed the specification of the information file.
-"     - Added :FuzzyFinderEditInfo command.
-
-"   2.5.1:
-"     - Fixed to be able to match "foo/./bar" by "foo/**/bar" in File mode.
-"     - Fixed to be able to open a space-containing file in File mode.
-"     - Fixed to honor the current working directory properly in File mode.
-"
-"   2.5:
-"     - Fixed the bug that a wrong initial text is entered after switching to a
-"       next mode.
-"     - Fixed the bug that it does not return to previous window after leaving
-"       Fuzzyfinder one.
-"
-"   2.4:
-"     - Fixed the bug that Fuzzyfinder fails to open a file caused by auto-cd
-"       plugin/script.
-"
-"   2.3:
-"     - Added a key mapping to open items in a new tab page and
-"       g:FuzzyFinderOptions.Base.key_open_tab opton.
-"     - Changed to show Fuzzyfinder window above last window even if
-"       'splitbelow' was set.
-"     - Changed to set nocursorline and nocursorcolumn in Fuzzyfinder.
-"     - Fixed not to push up a buffer number unlimitedly.
-"
-"   2.2:
-"     - Added new feature, which is the partial matching.
-"     - Fixed the bug that an error occurs when "'" was entered.
-"
-"   2.1:
-"     - Restructured the option system AGAIN. Sorry :p
-"     - Changed to inherit a typed text when switching a mode without leaving
-"       Insert mode.
-"     - Changed commands which launch explorers to be able to take a argument
-"       for initial text.
-"     - Changed to complete file names by relative path and not full path in
-"       the buffer/mru-file/tagged-file mode.
-"     - Changed to highlight a typed text when the completion item was not
-"       found or the completion process was aborted.
-"     - Changed to create caches for each tag file and not working directory
-"       in the tag/tagged-file mode.
-"     - Fixed the bug that the buffer mode couldn't open a unnamed buffer.
-"     - Added 'matching_limit' option.
-"     - Removed 'max_match' option. Use 'matching_limit' option instead.
-"     - Removed 'initial_text' option. Use command argument instead.
-"     - Removed the MRU-command mode.
-"
-"   2.0:
-"     - Added the tag mode.
-"     - Added the tagged-file mode.
-"     - Added :FuzzyFinderRemoveCache command.
-"     - Restructured the option system. many options are changed names or
-"       default values of some options.
-"     - Changed to hold and reuse caches of completion lists by default.
-"     - Changed to set filetype 'fuzzyfinder'.
-"     - Disabled the MRU-command mode by default because there are problems.
-"     - Removed FuzzyFinderAddMode command.
-"
-"   1.5:
-"     - Added the directory mode.
-"     - Fixed the bug that it caused an error when switch a mode in Insert
-"       mode.
-"     - Changed g:FuzzyFinder_KeySwitchMode type to a list.
-"
-"   1.4:
-"     - Changed the specification of the information file.
-"     - Added the MRU-commands mode.
-"     - Renamed :FuzzyFinderAddFavorite command to :FuzzyFinderAddFavFile.
-"     - Renamed g:FuzzyFinder_MruModeVars option to
-"       g:FuzzyFinder_MruFileModeVars.
-"     - Renamed g:FuzzyFinder_FavoriteModeVars option to
-"       g:FuzzyFinder_FavFileModeVars.
-"     - Changed to show registered time of each item in MRU/favorite mode.
-"     - Added 'timeFormat' option for MRU/favorite modes.
-"
-"   1.3:
-"     - Fixed a handling of multi-byte characters.
-"
-"   1.2:
-"     - Added support for Migemo. (Migemo is Japanese search method.)
-"
-"   1.1:
-"     - Added the favorite mode.
-"     - Added new features, which are abbreviations and multiple search.
-"     - Added 'abbrevMap' option for each mode.
-"     - Added g:FuzzyFinder_MruModeVars['ignoreSpecialBuffers'] option.
-"     - Fixed the bug that it did not work correctly when a user have mapped
-"       <C-p> or <Down>.
-"
-"   1.0:
-"     - Added the MRU mode.
-"     - Added commands to add and use original mode.
-"     - Improved the sorting algorithm for completion items.
-"     - Added 'initialInput' option to automatically insert a text at the
-"       beginning of a mode.
-"     - Changed that 'excludedPath' option works for the entire path.
-"     - Renamed some options. 
-"     - Changed default values of some options. 
-"     - Packed the mode-specific options to dictionaries.
-"     - Removed some options.
-"
-"   0.6:
-"     - Fixed some bugs.
-
-"   0.5:
-"     - Improved response by aborting processing too many items.
-"     - Changed to be able to open a buffer/file not only in previous window
-"       but also in new window.
-"     - Fixed a bug that recursive searching with '**' does not work.
-"     - Added g:FuzzyFinder_CompletionItemLimit option.
-"     - Added g:FuzzyFinder_KeyOpen option.
-"
-"   0.4:
-"     - Improved response of the input.
-"     - Improved the sorting algorithm for completion items. It is based on
-"       the matching level. 1st is perfect matching, 2nd is prefix matching,
-"       and 3rd is fuzzy matching.
-"     - Added g:FuzzyFinder_ExcludePattern option.
-"     - Removed g:FuzzyFinder_WildIgnore option.
-"     - Removed g:FuzzyFinder_EchoPattern option.
-"     - Removed g:FuzzyFinder_PathSeparator option.
-"     - Changed the default value of g:FuzzyFinder_MinLengthFile from 1 to 0.
-"
-"   0.3:
-"     - Added g:FuzzyFinder_IgnoreCase option.
-"     - Added g:FuzzyFinder_KeyToggleIgnoreCase option.
-"     - Added g:FuzzyFinder_EchoPattern option.
-"     - Changed the open command in a buffer mode from ":edit" to ":buffer" to
-"       avoid being reset cursor position.
-"     - Changed the default value of g:FuzzyFinder_KeyToggleMode from
-"       <C-Space> to <F12> because <C-Space> does not work on some CUI
-"       environments.
-"     - Changed to avoid being loaded by Vim before 7.0.
-"     - Fixed a bug with making a fuzzy pattern which has '\'.
-"
-"   0.2:
-"     - A bug it does not work on Linux is fixed.
-"
-"   0.1:
-"     - First release.
-"
-" }}}1
-"=============================================================================
-" INCLUDE GUARD: {{{1
-if exists('loaded_fuzzyfinder') || v:version < 701
-  finish
-endif
-let loaded_fuzzyfinder = 1
-
-" }}}1
-"=============================================================================
-" FUNCTION: {{{1
-"-----------------------------------------------------------------------------
-" LIST FUNCTIONS:
-
-function! s:Unique(in)
-  let sorted = sort(a:in)
-  if len(sorted) < 2
-    return sorted
-  endif
-  let last = remove(sorted, 0)
-  let result = [last]
-  for item in sorted
-    if item != last
-      call add(result, item)
-      let last = item
-    endif
-  endfor
-  return result
-endfunction
-
-" [ [0], [1,2], [3] ] -> [ 0, 1, 2, 3 ]
-function! s:Concat(in)
-  let result = []
-  for l in a:in
-    let result += l
-  endfor
-  return result
-endfunction
-
-" [ [ 0, 1 ], [ 2, 3, 4 ], ] -> [ [0,2], [0,3], [0,4], [1,2], [1,3], [1,4] ]
-function! s:CartesianProduct(lists)
-  if empty(a:lists)
-    return []
-  endif
-  "let result = map((a:lists[0]), '[v:val]')
-  let result = [ [] ]
-  for l in a:lists
-    let temp = []
-    for r in result
-      let temp += map(copy(l), 'add(copy(r), v:val)')
-    endfor
-    let result = temp
-  endfor
-  return result
-endfunction
-
-" copy + filter + limit
-function! s:FilterEx(in, expr, limit)
-  if a:limit <= 0
-    return filter(copy(a:in), a:expr)
-  endif
-  let result = []
-  let stride = a:limit * 3 / 2 " x1.5
-  for i in range(0, len(a:in) - 1, stride)
-    let result += filter(a:in[i : i + stride - 1], a:expr)
-    if len(result) >= a:limit
-      return remove(result, 0, a:limit - 1)
-    endif
-  endfor
-  return result
-endfunction
-
-" 
-function! s:FilterMatching(entries, key, pattern, index, limit)
-  return s:FilterEx(a:entries, 'v:val[''' . a:key . '''] =~ ' . string(a:pattern) . ' || v:val.index == ' . a:index, a:limit)
-endfunction
-
-function! s:ExtendIndexToEach(in, offset)
-  for i in range(len(a:in))
-    let a:in[i].index = i + a:offset
-  endfor
-  return a:in
-endfunction
-
-function! s:UpdateMruList(mrulist, new_item, key, max_item, excluded)
-  let result = copy(a:mrulist)
-  let result = filter(result,'v:val[a:key] != a:new_item[a:key]')
-  let result = insert(result, a:new_item)
-  let result = filter(result, 'v:val[a:key] !~ a:excluded')
-  return result[0 : a:max_item - 1]
-endfunction
-
-"-----------------------------------------------------------------------------
-" STRING FUNCTIONS:
-
-" trims a:str and add a:mark if a length of a:str is more than a:len
-function! s:TrimLast(str, len)
-  if a:len <= 0 || len(a:str) <= a:len
-    return a:str
-  endif
-  return a:str[:(a:len - len(s:ABBR_TRIM_MARK) - 1)] . s:ABBR_TRIM_MARK
-endfunction
-
-" takes suffix numer. if no digits, returns -1
-function! s:SuffixNumber(str)
-  let s = matchstr(a:str, '\d\+$')
-  return (len(s) ? str2nr(s) : -1)
-endfunction
-
-function! s:ConvertWildcardToRegexp(expr)
-  let re = escape(a:expr, '\')
-  for [pat, sub] in [ [ '*', '\\.\\*' ], [ '?', '\\.' ], [ '[', '\\[' ], ]
-    let re = substitute(re, pat, sub, 'g')
-  endfor
-  return '\V' . re
-endfunction
-
-" "foo/bar/hoge" -> { head: "foo/bar/", tail: "hoge" }
-function! s:SplitPath(path)
-  let dir = matchstr(a:path, '^.*[/\\]')
-  return  {
-        \   'head' : dir,
-        \   'tail' : a:path[strlen(dir):]
-        \ }
-endfunction
-
-function! s:EscapeFilename(fn)
-  return escape(a:fn, " \t\n*?[{`$%#'\"|!<")
-endfunction
-
-" "foo/.../bar/...hoge" -> "foo/.../bar/../../hoge"
-function! s:ExpandTailDotSequenceToParentDir(base)
-  return substitute(a:base, '^\(.*[/\\]\)\?\zs\.\(\.\+\)\ze[^/\\]*$',
-        \           '\=repeat(".." . s:PATH_SEPARATOR, len(submatch(2)))', '')
-endfunction
-
-"-----------------------------------------------------------------------------
-" FUNCTIONS FOR COMPLETION ITEM:
-
-function! s:FormatCompletionItem(expr, number, abbr, trim_len, time, base_pattern, evals_path_tail)
-  if a:evals_path_tail
-    let rate = s:EvaluateMatchingRate(s:SplitPath(matchstr(a:expr, '^.*[^/\\]')).tail,
-          \                           s:SplitPath(a:base_pattern).tail)
-  else
-    let rate = s:EvaluateMatchingRate(a:expr, a:base_pattern)
-  endif
-  return  {
-        \   'word'  : a:expr,
-        \   'abbr'  : s:TrimLast((a:number >= 0 ? printf('%2d: ', a:number) : '') . a:abbr, a:trim_len),
-        \   'menu'  : printf('%s[%s]', (len(a:time) ? a:time . ' ' : ''), s:MakeRateStar(rate, 5)),
-        \   'ranks' : [-rate, (a:number >= 0 ? a:number : a:expr)]
-        \ }
-endfunction
-
-function! s:EvaluateMatchingRate(expr, pattern)
-  if a:expr == a:pattern
-    return s:MATCHING_RATE_BASE
-  endif
-  let rate = 0
-  let rate_increment = (s:MATCHING_RATE_BASE * 9) / (len(a:pattern) * 10) " zero divide ok
-  let matched = 1
-  let i_pattern = 0
-  for i_expr in range(len(a:expr))
-    if a:expr[i_expr] == a:pattern[i_pattern]
-      let rate += rate_increment
-      let matched = 1
-      let i_pattern += 1
-      if i_pattern >= len(a:pattern)
-        break
-      endif
-    elseif matched
-      let rate_increment = rate_increment / 2
-      let matched = 0
-    endif
-  endfor
-  return rate
-endfunction
-
-function! s:MakeRateStar(rate, base)
-  let len = (a:base * a:rate) / s:MATCHING_RATE_BASE
-  return repeat('*', len) . repeat('.', a:base - len)
-endfunction
-
-"-----------------------------------------------------------------------------
-" MISC FUNCTIONS:
-
-function! s:IsAvailableMode(mode)
-  return exists('a:mode.mode_available') && a:mode.mode_available
-endfunction
-
-function! s:GetAvailableModes()
-  return filter(values(g:FuzzyFinderMode), 's:IsAvailableMode(v:val)')
-endfunction
-
-function! s:GetSortedAvailableModes()
-  let modes = filter(items(g:FuzzyFinderMode), 's:IsAvailableMode(v:val[1])')
-  let modes = map(modes, 'extend(v:val[1], { "ranks" : [v:val[1].switch_order, v:val[0]] })')
-  return sort(modes, 's:CompareRanks')
-endfunction
-
-function! s:GetSidPrefix()
-  return matchstr(expand('<sfile>'), '<SNR>\d\+_')
-endfunction
-
-function! s:OnCmdCR()
-  for m in s:GetAvailableModes()
-    call m.extend_options()
-    call m.on_command_pre(getcmdtype() . getcmdline())
-  endfor
-  " lets last entry become the newest in the history
-  if getcmdtype() =~ '[:/=@]'
-    call histadd(getcmdtype(), getcmdline())
-  endif
-
-  " this is not mapped again (:help recursive_mapping)
-  return "\<CR>"
-endfunction
-
-function! s:ExpandAbbrevMap(base, abbrev_map)
-  let result = [a:base]
-
-  " expand
-  for [pattern, sub_list] in items(a:abbrev_map)
-    let exprs = result
-    let result = []
-    for expr in exprs
-      let result += map(copy(sub_list), 'substitute(expr, pattern, v:val, "g")')
-    endfor
-  endfor
-
-  return s:Unique(result)
-endfunction
-
-" "**" is expanded to ["**", "."]. E.g.: "foo/**/bar" -> [ "foo/./bar", "foo/**/bar" ]
-function! s:ExpandEx(dir)
-  if a:dir !~ '\S'
-    return ['']
-  endif
-
-  " [ ["foo/"], ["**/", "./" ], ["bar/"] ]
-  let lists = []
-  for i in split(a:dir, '[/\\]\zs')
-    let m = matchlist(i, '^\*\{2,}\([/\\]*\)$')
-    call add(lists, (empty(m) ? [i] : [i, '.' . m[1]]))
-  endfor
-
-  " expand wlidcards
-  return split(join(map(s:CartesianProduct(lists), 'expand(join(v:val, ""))'), "\n"), "\n")
-endfunction
-
-function! s:EnumExpandedDirsEntries(dir, excluded)
-  let dirs = s:ExpandEx(a:dir)
-  let entries = s:Concat(map(copy(dirs), 'split(glob(v:val . ".*"), "\n") + ' .
-        \                                'split(glob(v:val . "*" ), "\n")'))
-  if len(dirs) <= 1
-    call map(entries, 'extend(s:SplitPath(v:val), { "suffix" : (isdirectory(v:val) ? s:PATH_SEPARATOR : ""), "head" : a:dir })')
-  else
-    call map(entries, 'extend(s:SplitPath(v:val), { "suffix" : (isdirectory(v:val) ? s:PATH_SEPARATOR : "") })')
-  endif
-  if len(a:excluded)
-    call filter(entries, '(v:val.head . v:val.tail . v:val.suffix) !~ a:excluded')
-  endif
-  return entries
-endfunction
-
-function! s:GetTagList(tagfile)
-  return map(readfile(a:tagfile), 'matchstr(v:val, ''^[^!\t][^\t]*'')')
-endfunction
-
-function! s:GetTaggedFileList(tagfile)
-  execute 'cd ' . fnamemodify(a:tagfile, ':h')
-  let result = map(readfile(a:tagfile), 'fnamemodify(matchstr(v:val, ''^[^!\t][^\t]*\t\zs[^\t]\+''), '':p:~'')')
-  cd -
-  return result
-endfunction
-
-function! s:HighlightPrompt(prompt, highlight)
-  syntax clear
-  execute printf('syntax match %s /^\V%s/', a:highlight, escape(a:prompt, '\'))
-endfunction
-
-function! s:HighlightError()
-  syntax clear
-  syntax match Error  /^.*$/
-endfunction
-
-function! s:CompareTimeDescending(i1, i2)
-      return a:i1.time == a:i2.time ? 0 : a:i1.time > a:i2.time ? -1 : +1
-endfunction
-
-function! s:CompareRanks(i1, i2)
-  if exists('a:i1.ranks') && exists('a:i2.ranks')
-    for i in range(min([len(a:i1.ranks), len(a:i2.ranks)]))
-      if     a:i1.ranks[i] > a:i2.ranks[i]
-        return +1
-      elseif a:i1.ranks[i] < a:i2.ranks[i]
-        return -1
-      endif
-    endfor
-  endif
-  return 0
-endfunction
-
-function! s:GetCurrentTagFiles()
-  return sort(filter(map(tagfiles(), 'fnamemodify(v:val, '':p'')'), 'filereadable(v:val)'))
-endfunction
-
-" }}}1
-"=============================================================================
-" OBJECT: {{{1
-"-----------------------------------------------------------------------------
-let g:FuzzyFinderMode = { 'Base' : {} }
-
-function! g:FuzzyFinderMode.Base.launch(initial_text, partial_matching, prev_bufnr, tag_files)
-  " initializes this object
-  call self.extend_options()
-  let self.partial_matching = a:partial_matching
-  let self.prev_bufnr = a:prev_bufnr
-  let self.tag_files = a:tag_files " to get local value of current buffer
-  let self.last_col = -1
-  call s:InfoFileManager.load()
-  if !s:IsAvailableMode(self)
-    echo 'This mode is not available: ' . self.to_str()
-    return
-  endif
-
-  call s:WindowManager.activate(self.make_complete_func('CompleteFunc'))
-  call s:OptionManager.set('completeopt', 'menuone')
-  call s:OptionManager.set('ignorecase', self.ignore_case)
-
-  " local autocommands
-  augroup FuzzyfinderLocal
-    autocmd!
-    execute 'autocmd CursorMovedI <buffer>        call ' . self.to_str('on_cursor_moved_i()')
-    execute 'autocmd InsertLeave  <buffer> nested call ' . self.to_str('on_insert_leave()'  )
-  augroup END
-
-  " local mapping
-  for [lhs, rhs] in [
-        \   [ self.key_open       , self.to_str('on_cr(0, 0)'            ) ],
-        \   [ self.key_open_split , self.to_str('on_cr(1, 0)'            ) ],
-        \   [ self.key_open_vsplit, self.to_str('on_cr(2, 0)'            ) ],
-        \   [ self.key_open_tab   , self.to_str('on_cr(3, 0)'            ) ],
-        \   [ '<BS>'              , self.to_str('on_bs()'                ) ],
-        \   [ '<C-h>'             , self.to_str('on_bs()'                ) ],
-        \   [ self.key_next_mode  , self.to_str('on_switch_mode(+1)'     ) ],
-        \   [ self.key_prev_mode  , self.to_str('on_switch_mode(-1)'     ) ],
-        \   [ self.key_ignore_case, self.to_str('on_switch_ignore_case()') ],
-        \ ]
-    " hacks to be able to use feedkeys().
-    execute printf('inoremap <buffer> <silent> %s <C-r>=%s ? "" : ""<CR>', lhs, rhs)
-  endfor
-
-  call self.on_mode_enter()
-
-  " Starts Insert mode and makes CursorMovedI event now. Command prompt is
-  " needed to forces a completion menu to update every typing.
-  call setline(1, self.prompt . a:initial_text)
-  call feedkeys("A", 'n') " startinsert! does not work in InsertLeave handler
-endfunction
-
-function! g:FuzzyFinderMode.Base.on_cursor_moved_i()
-  let ln = getline('.')
-  let cl = col('.')
-  if !self.exists_prompt(ln)
-    " if command prompt is removed
-    "call setline('.', self.prompt . ln)
-    call setline('.', self.restore_prompt(ln))
-    call feedkeys(repeat("\<Right>", len(getline('.')) - len(ln)), 'n')
-  elseif cl <= len(self.prompt)
-    " if the cursor is moved before command prompt
-    call feedkeys(repeat("\<Right>", len(self.prompt) - cl + 1), 'n')
-  elseif cl > strlen(ln) && cl != self.last_col
-    " if the cursor is placed on the end of the line and has been actually moved.
-    let self.last_col = cl
-    call feedkeys("\<C-x>\<C-u>", 'n')
-  endif
-endfunction
-
-function! g:FuzzyFinderMode.Base.on_insert_leave()
-  let text = getline('.')
-  call self.on_mode_leave()
-  call self.empty_cache_if_existed(0)
-  call s:OptionManager.restore_all()
-  call s:WindowManager.deactivate()
-
-  " switchs to next mode, or finishes fuzzyfinder.
-  if exists('s:reserved_switch_mode')
-    let m = self.next_mode(s:reserved_switch_mode < 0)
-    call m.launch(self.remove_prompt(text), self.partial_matching, self.prev_bufnr, self.tag_files)
-    unlet s:reserved_switch_mode
-  else
-    if exists('s:reserved_command')
-      call feedkeys(self.on_open(s:reserved_command[0], s:reserved_command[1]), 'n')
-      unlet s:reserved_command
-    endif
-  endif
-endfunction
-
-function! g:FuzzyFinderMode.Base.on_buf_enter()
-endfunction
-
-function! g:FuzzyFinderMode.Base.on_buf_write_post()
-endfunction
-
-function! g:FuzzyFinderMode.Base.on_command_pre(cmd)
-endfunction
-
-function! g:FuzzyFinderMode.Base.on_cr(index, check_dir)
-  if pumvisible()
-    call feedkeys(printf("\<C-y>\<C-r>=%s(%d, 1) ? '' : ''\<CR>", self.to_str('on_cr'), a:index), 'n')
-  elseif !a:check_dir || getline('.') !~ '[/\\]$'
-    let s:reserved_command = [self.remove_prompt(getline('.')), a:index]
-    call feedkeys("\<Esc>", 'n')
-  endif
-endfunction
-
-function! g:FuzzyFinderMode.Base.on_bs()
-  let bs_count = 1
-  if self.smart_bs && col('.') > 2 && getline('.')[col('.') - 2] =~ '[/\\]'
-    let bs_count = len(matchstr(getline('.')[:col('.') - 3], '[^/\\]*$')) + 1
-  endif
-  call feedkeys((pumvisible() ? "\<C-e>" : "") . repeat("\<BS>", bs_count), 'n')
-endfunction
-
-function! g:FuzzyFinderMode.Base.on_mode_enter()
-endfunction
-
-function! g:FuzzyFinderMode.Base.on_mode_leave()
-endfunction
-
-function! g:FuzzyFinderMode.Base.on_open(expr, mode)
-  return [
-        \   ':edit ',
-        \   ':split ',
-        \   ':vsplit ',
-        \   ':tabedit ',
-        \ ][a:mode] . s:EscapeFilename(a:expr) . "\<CR>"
-endfunction
-
-function! g:FuzzyFinderMode.Base.on_switch_mode(next_prev)
-  let s:reserved_switch_mode = a:next_prev
-  call feedkeys("\<Esc>", 'n')
-endfunction
-
-function! g:FuzzyFinderMode.Base.on_switch_ignore_case()
-  let &ignorecase = !&ignorecase
-  echo "ignorecase = " . &ignorecase
-  let self.last_col = -1
-  call self.on_cursor_moved_i()
-endfunction
-
-" export string list
-function! g:FuzzyFinderMode.Base.serialize_info()
-  let header = self.to_key() . "\t"
-  return map(copy(self.info), 'header . string(v:val)')
-endfunction
-
-" import related items from string list
-function! g:FuzzyFinderMode.Base.deserialize_info(lines)
-  let header = self.to_key() . "\t"
-  let self.info = map(filter(copy(a:lines), 'v:val[: len(header) - 1] ==# header'),
-        \             'eval(v:val[len(header) :])')
-endfunction
-
-function! g:FuzzyFinderMode.Base.complete(findstart, base)
-  if a:findstart
-    return 0
-  elseif  !self.exists_prompt(a:base) || len(self.remove_prompt(a:base)) < self.min_length
-    return []
-  endif
-  call s:HighlightPrompt(self.prompt, self.prompt_highlight)
-  " FIXME: ExpandAbbrevMap duplicates index
-  let result = []
-  for expanded_base in s:ExpandAbbrevMap(self.remove_prompt(a:base), self.abbrev_map)
-    let result += self.on_complete(expanded_base)
-  endfor
-  call sort(result, 's:CompareRanks')
-  if empty(result)
-    call s:HighlightError()
-  else
-    call feedkeys("\<C-p>\<Down>", 'n')
-  endif
-  return result
-endfunction
-
-" This function is set to 'completefunc' which doesn't accept dictionary-functions.
-function! g:FuzzyFinderMode.Base.make_complete_func(name)
-  execute printf("function! s:%s(findstart, base)\n" .
-        \        "  return %s.complete(a:findstart, a:base)\n" .
-        \        "endfunction", a:name, self.to_str())
-  return s:GetSidPrefix() . a:name
-endfunction
-
-" fuzzy  : 'str' -> {'base':'str', 'wi':'*s*t*r*', 're':'\V\.\*s\.\*t\.\*r\.\*'}
-" partial: 'str' -> {'base':'str', 'wi':'*str*', 're':'\V\.\*str\.\*'}
-function! g:FuzzyFinderMode.Base.make_pattern(base)
-  if self.partial_matching
-    let wi = (a:base !~ '^[*?]'  ? '*' : '') . a:base .
-          \  (a:base =~ '[^*?]$' ? '*' : '')
-    let re = s:ConvertWildcardToRegexp(wi)
-    return { 'base': a:base, 'wi':wi, 're': re }
-  else
-    let wi = ''
-    for char in split(a:base, '\zs')
-      if wi !~ '[*?]$' && char !~ '[*?]'
-        let wi .= '*'. char
-      else
-        let wi .= char
-      endif
-    endfor
-
-    if wi !~ '[*?]$'
-      let wi .= '*'
-    endif
-
-    let re = s:ConvertWildcardToRegexp(wi)
-
-    if self.migemo_support && a:base !~ '[^\x01-\x7e]'
-      let re .= '\|\m.*' . substitute(migemo(a:base), '\\_s\*', '.*', 'g') . '.*'
-    endif
-
-    return { 'base': a:base, 'wi':wi, 're': re }
-  endif
-endfunction
-
-" glob with caching-feature, etc.
-function! g:FuzzyFinderMode.Base.glob_ex(dir, file, excluded, index, matching_limit)
-  let key = fnamemodify(a:dir, ':p')
-  call extend(self, { 'cache' : {} }, 'keep')
-  if !exists('self.cache[key]')
-    echo 'Caching file list...'
-    let self.cache[key] = s:EnumExpandedDirsEntries(key, a:excluded)
-    call s:ExtendIndexToEach(self.cache[key], 1)
-  endif
-  echo 'Filtering file list...'
-  "return map(s:FilterEx(self.cache[key], 'v:val.tail =~ ' . string(a:file), a:matching_limit),
-  return map(s:FilterMatching(self.cache[key], 'tail', a:file, a:index, a:matching_limit),
-        \ '{ "index" : v:val.index, "path" : (v:val.head == key ? a:dir : v:val.head) . v:val.tail . v:val.suffix }')
-endfunction
-
-function! g:FuzzyFinderMode.Base.glob_dir_ex(dir, file, excluded, index, matching_limit)
-  let key = fnamemodify(a:dir, ':p')
-  call extend(self, { 'cache' : {} }, 'keep')
-  if !exists('self.cache[key]')
-    echo 'Caching file list...'
-    let self.cache[key] = filter(s:EnumExpandedDirsEntries(key, a:excluded), 'len(v:val.suffix)')
-    call insert(self.cache[key], { 'head' : key, 'tail' : '..', 'suffix' : s:PATH_SEPARATOR })
-    call insert(self.cache[key], { 'head' : key, 'tail' : '.' , 'suffix' : '' })
-    call s:ExtendIndexToEach(self.cache[key], 1)
-  endif
-  echo 'Filtering file list...'
-  "return map(s:FilterEx(self.cache[key], 'v:val.tail =~ ' . string(a:file), a:matching_limit),
-  return map(s:FilterMatching(self.cache[key], 'tail', a:file, a:index, a:matching_limit),
-        \ '{ "index" : v:val.index, "path" : (v:val.head == key ? a:dir : v:val.head) . v:val.tail . v:val.suffix }')
-endfunction
-
-function! g:FuzzyFinderMode.Base.empty_cache_if_existed(force)
-  if exists('self.cache') && (a:force || !exists('self.lasting_cache') || !self.lasting_cache)
-    unlet self.cache
-    "let self.cache = (type(self.cache) == type({}) ? {} :
-    "      \           type(self.cache) == type([]) ? [] :
-    "      \           type(self.cache) == type('') ? '' : 0)