From bd11b02be50e5785e996b8a9dc61ec980dca2950 Mon Sep 17 00:00:00 2001 From: gryf Date: Tue, 14 Feb 2012 20:03:34 +0100 Subject: [PATCH] Removed bundle_consider, and plugins: buffergator and fuzzyfinder (+l9). Give a try to ctrlp plugin. --- .vimrc | 21 +- bundle/buffergator/doc/buffergator.txt | 268 --- bundle/buffergator/plugin/buffergator.vim | 1640 -------------- bundle/fuzzyfinder/autoload/fuf.vim | 1046 --------- .../fuzzyfinder/autoload/fuf/bookmarkdir.vim | 163 -- .../fuzzyfinder/autoload/fuf/bookmarkfile.vim | 199 -- bundle/fuzzyfinder/autoload/fuf/buffer.vim | 189 -- bundle/fuzzyfinder/autoload/fuf/buffertag.vim | 300 --- .../fuzzyfinder/autoload/fuf/callbackfile.vim | 137 -- .../fuzzyfinder/autoload/fuf/callbackitem.vim | 139 -- .../fuzzyfinder/autoload/fuf/changelist.vim | 172 -- .../fuzzyfinder/autoload/fuf/coveragefile.vim | 199 -- bundle/fuzzyfinder/autoload/fuf/dir.vim | 132 -- bundle/fuzzyfinder/autoload/fuf/file.vim | 139 -- bundle/fuzzyfinder/autoload/fuf/givencmd.vim | 123 -- bundle/fuzzyfinder/autoload/fuf/givendir.vim | 123 -- bundle/fuzzyfinder/autoload/fuf/givenfile.vim | 121 -- bundle/fuzzyfinder/autoload/fuf/help.vim | 198 -- bundle/fuzzyfinder/autoload/fuf/jumplist.vim | 182 -- bundle/fuzzyfinder/autoload/fuf/line.vim | 135 -- bundle/fuzzyfinder/autoload/fuf/mrucmd.vim | 134 -- bundle/fuzzyfinder/autoload/fuf/mrufile.vim | 234 -- bundle/fuzzyfinder/autoload/fuf/quickfix.vim | 154 -- bundle/fuzzyfinder/autoload/fuf/tag.vim | 178 -- .../fuzzyfinder/autoload/fuf/taggedfile.vim | 159 -- bundle/fuzzyfinder/doc/fuf.txt | 1883 ----------------- bundle/fuzzyfinder/plugin/fuf.vim | 158 -- bundle/git_ctrlp/.gitignore | 8 + .../git_ctrlp}/autoload/ctrlp.vim | 360 ++-- .../git_ctrlp}/autoload/ctrlp/buffertag.vim | 9 +- .../git_ctrlp}/autoload/ctrlp/dir.vim | 6 +- .../git_ctrlp}/autoload/ctrlp/line.vim | 6 +- .../git_ctrlp}/autoload/ctrlp/mrufiles.vim | 36 +- .../git_ctrlp}/autoload/ctrlp/quickfix.vim | 14 +- .../git_ctrlp}/autoload/ctrlp/rtscript.vim | 25 +- .../git_ctrlp}/autoload/ctrlp/tag.vim | 24 +- .../git_ctrlp}/autoload/ctrlp/undo.vim | 8 +- .../git_ctrlp}/autoload/ctrlp/utils.vim | 10 +- .../ctrlp => bundle/git_ctrlp}/doc/ctrlp.txt | 138 +- .../git_ctrlp}/plugin/ctrlp.vim | 0 bundle/git_ctrlp/readme.md | 79 + bundle/indent_python/indent/python.vim | 4 +- bundle/l9/autoload/l9.vim | 570 ----- bundle/l9/autoload/l9/async.py | 92 - bundle/l9/autoload/l9/async.vim | 67 - bundle/l9/autoload/l9/quickfix.vim | 107 - bundle/l9/autoload/l9/tempbuffer.vim | 112 - bundle/l9/autoload/l9/tempvariables.vim | 60 - bundle/l9/doc/l9.txt | 73 - bundle/l9/plugin/l9.vim | 108 - bundle_consider/ctrlp/readme.md | 8 - bundle_consider/fontzoom/doc/fontzoom.txt | 105 - bundle_consider/fontzoom/plugin/fontzoom.vim | 69 - 53 files changed, 433 insertions(+), 10191 deletions(-) delete mode 100644 bundle/buffergator/doc/buffergator.txt delete mode 100644 bundle/buffergator/plugin/buffergator.vim delete mode 100644 bundle/fuzzyfinder/autoload/fuf.vim delete mode 100644 bundle/fuzzyfinder/autoload/fuf/bookmarkdir.vim delete mode 100644 bundle/fuzzyfinder/autoload/fuf/bookmarkfile.vim delete mode 100644 bundle/fuzzyfinder/autoload/fuf/buffer.vim delete mode 100644 bundle/fuzzyfinder/autoload/fuf/buffertag.vim delete mode 100644 bundle/fuzzyfinder/autoload/fuf/callbackfile.vim delete mode 100644 bundle/fuzzyfinder/autoload/fuf/callbackitem.vim delete mode 100644 bundle/fuzzyfinder/autoload/fuf/changelist.vim delete mode 100644 bundle/fuzzyfinder/autoload/fuf/coveragefile.vim delete mode 100644 bundle/fuzzyfinder/autoload/fuf/dir.vim delete mode 100644 bundle/fuzzyfinder/autoload/fuf/file.vim delete mode 100644 bundle/fuzzyfinder/autoload/fuf/givencmd.vim delete mode 100644 bundle/fuzzyfinder/autoload/fuf/givendir.vim delete mode 100644 bundle/fuzzyfinder/autoload/fuf/givenfile.vim delete mode 100644 bundle/fuzzyfinder/autoload/fuf/help.vim delete mode 100644 bundle/fuzzyfinder/autoload/fuf/jumplist.vim delete mode 100644 bundle/fuzzyfinder/autoload/fuf/line.vim delete mode 100644 bundle/fuzzyfinder/autoload/fuf/mrucmd.vim delete mode 100644 bundle/fuzzyfinder/autoload/fuf/mrufile.vim delete mode 100644 bundle/fuzzyfinder/autoload/fuf/quickfix.vim delete mode 100644 bundle/fuzzyfinder/autoload/fuf/tag.vim delete mode 100644 bundle/fuzzyfinder/autoload/fuf/taggedfile.vim delete mode 100644 bundle/fuzzyfinder/doc/fuf.txt delete mode 100644 bundle/fuzzyfinder/plugin/fuf.vim create mode 100644 bundle/git_ctrlp/.gitignore rename {bundle_consider/ctrlp => bundle/git_ctrlp}/autoload/ctrlp.vim (84%) rename {bundle_consider/ctrlp => bundle/git_ctrlp}/autoload/ctrlp/buffertag.vim (97%) rename {bundle_consider/ctrlp => bundle/git_ctrlp}/autoload/ctrlp/dir.vim (96%) rename {bundle_consider/ctrlp => bundle/git_ctrlp}/autoload/ctrlp/line.vim (92%) rename {bundle_consider/ctrlp => bundle/git_ctrlp}/autoload/ctrlp/mrufiles.vim (74%) rename {bundle_consider/ctrlp => bundle/git_ctrlp}/autoload/ctrlp/quickfix.vim (88%) rename {bundle_consider/ctrlp => bundle/git_ctrlp}/autoload/ctrlp/rtscript.vim (61%) rename {bundle_consider/ctrlp => bundle/git_ctrlp}/autoload/ctrlp/tag.vim (91%) rename {bundle_consider/ctrlp => bundle/git_ctrlp}/autoload/ctrlp/undo.vim (94%) rename {bundle_consider/ctrlp => bundle/git_ctrlp}/autoload/ctrlp/utils.vim (86%) rename {bundle_consider/ctrlp => bundle/git_ctrlp}/doc/ctrlp.txt (89%) rename {bundle_consider/ctrlp => bundle/git_ctrlp}/plugin/ctrlp.vim (100%) create mode 100644 bundle/git_ctrlp/readme.md delete mode 100644 bundle/l9/autoload/l9.vim delete mode 100644 bundle/l9/autoload/l9/async.py delete mode 100644 bundle/l9/autoload/l9/async.vim delete mode 100644 bundle/l9/autoload/l9/quickfix.vim delete mode 100644 bundle/l9/autoload/l9/tempbuffer.vim delete mode 100644 bundle/l9/autoload/l9/tempvariables.vim delete mode 100644 bundle/l9/doc/l9.txt delete mode 100644 bundle/l9/plugin/l9.vim delete mode 100644 bundle_consider/ctrlp/readme.md delete mode 100644 bundle_consider/fontzoom/doc/fontzoom.txt delete mode 100644 bundle_consider/fontzoom/plugin/fontzoom.vim diff --git a/.vimrc b/.vimrc index 4fa1ead..d3b3565 100644 --- a/.vimrc +++ b/.vimrc @@ -126,8 +126,8 @@ map wn VimwikiNextWord map wp VimwikiPrevWord " }}} "FuzzyFinder {{{2 -let g:fuf_file_exclude = '\v\~$|\.(o|bak|swp|pyc|pyo|pyd)$|(^|[/\\])\.(hg|git|bzr|cvs)($|[/\\])' -map :FufFile **/ +"let g:fuf_file_exclude = '\v\~$|\.(o|bak|swp|pyc|pyo|pyd)$|(^|[/\\])\.(hg|git|bzr|cvs)($|[/\\])' +"map :FufFile **/ "}}} "ShowMarks {{{2 let g:showmarks_ignore_type = "hqprm" @@ -179,16 +179,21 @@ nmap \dk nmap \dj " }}} " Buffergator {{{2 -let g:buffergator_split_size=10 -let g:buffergator_viewport_split_policy='B' -let g:buffergator_suppress_keymaps=1 -let g:buffergator_sort_regime="filepath" -let g:buffergator_display_regime="filepath" -map b :BuffergatorToggle +"let g:buffergator_split_size=10 +"let g:buffergator_viewport_split_policy='B' +"let g:buffergator_suppress_keymaps=1 +"let g:buffergator_sort_regime="filepath" +"let g:buffergator_display_regime="filepath" +"map b :BuffergatorToggle " }}} "Gundo {{{2 map u :GundoToggle "}}} +"CtrlP {{{2 +let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$||\.pyo||\.pyc||\.pyd||CVS$' +let g:ctrlp_map = '' +map b :CtrlPBuffer +"}}} "}}} "KEYS: User defined keyboard shortcuts {{{ diff --git a/bundle/buffergator/doc/buffergator.txt b/bundle/buffergator/doc/buffergator.txt deleted file mode 100644 index e09e6bd..0000000 --- a/bundle/buffergator/doc/buffergator.txt +++ /dev/null @@ -1,268 +0,0 @@ -*buffergator.txt* Buffer indexing and navigation plugin. - -=============================================================================== - *buffergator* *buffergator-contents* -CONTENTS~ - - 1. Introduction ........................... |buffergator-introduction| - 2. Commands ............................... |buffergator-commands| - 3. Key Mappings (Global) .................. |buffergator-global-keys| - 4. Key Mappings (Buffer Catalog) .......... |buffergator-buffer-keys| - 5. Key Mappings (Tab Page Catalog) ........ |buffergator-tabpage-keys| - 5. Options and Settings ................... |buffergator-options| - -=============================================================================== - *buffergator-introduction* -INTRODUCTION~ - -Buffergator is a plugin for listing, navigating between, and selecting buffers -to edit. Upon invocation (using the command, ":BuffergatorOpen" or -"BuffergatorToggle", or the provided key mapping, "b"), a "catalog" of -listed buffers are displayed in a separate new window split (vertical or -horizontal, based on user options; default = vertical). From this "buffer -catalog", a buffer can be selected and opened in an existing window, a new -window split (vertical or horizontal), or a new tab page. - -Selected buffers can be "previewed", i.e. opened in a window or tab page, but -with focus remaining in the buffer catalog. Even better, you can "walk" up and -down the list of buffers shown in the catalog by using (or ) / - (or ). These keys select the next/previous buffer in succession, -respectively, opening it for preview without leaving the buffer catalog -viewer. - -Buffergator also provides a way to list tab pages and buffers associated with -windows in tab pages (the "tab page catalog", which can be invoked using the -command ":BuffergatorTabsOpen" or the provided key mapping, "t"). - -By default, Buffergator provides global key maps that invoke its main -commands: "b" to open and "B" to close the buffer catalog, and -"t" to open and "T" to close the tab page catalog. If you -prefer to map other keys, or do not want any keys mapped at all, set -"g:buffergator_suppress_keymaps" to 1 in your $VIMRUNTIME. - -=============================================================================== - *buffergator-commands* -COMMANDS~ - -These following commands are provided globally by Buffergator: - -:BuffergatorOpen - Open the buffer catalog, or go to it if it is already open. - -:BuffergatorClose - Close the buffer catalog if it is already open. - -:BuffergatorToggle - Open the buffer catalog if it is closed, or close it if - it is already open. - -:BuffergatorTabsOpen - Open the tab page catalog, or go to it if it is already open. - -:BuffergatorTabsClose - Close the tab page catalog if it is already open. - -:BuffergatorTabsToggle - Open the tab page catalog if it is closed, or close it if - it is already open. - -=============================================================================== - *buffergator-global-keys* -KEY MAPPINGS (GLOBAL)~ - -Unless "g:buffergator_suppress_keymaps" is set to 1, then the following -key mappings are defined: - -b Invokes ":BuffergatorOpen": open the buffer catalog, or go - to it if it is already open. - -B Invokes ":BuffergatorClose": close the buffer catalog. - -t Invokes ":BuffergatorTabsOpen": open the tab page catalog, - or go to it if it is already open. - -T Invokes ":BuffergatorTabsClose": close the tab page - catalog. - -=============================================================================== - *buffergator-buffer-keys* -KEY MAPPINGS (BUFFER CATALOG)~ - -Invoking Buffergator results in the listed buffers being displayed in a -special Buffergator window, which is referred to as a "buffer catalog viewer". -The following key mappings are available when in the viewer. - -------------------------------------------------------------------------------- -Catalog Management~ - -cs Cycle through sort regimes. -cd Cycle through display regimes. -r Update (rebuild/refresh) index. -d Delete the selected buffer. -D Unconditionally delete the selected buffer. -x Wipe the selected buffer. -X Unconditionally wipe the selected buffer. -q Quit the index/catalog window. - -------------------------------------------------------------------------------- -Open Selected Buffer~ - -The following keys all open the currently-selected buffer and switch focus to -it. If the key presses are preceded by a number, then the buffer with that -number will be selected and opened instead of the current buffer. The catalog -buffer will be closed if 'g:buffergator_autodismiss_on_select' evaluates to -true; otherwise it will be kept open. - -, o Open the currently-selected buffer (or, if [count] is - given, buffer with number [count]), in previous window. -s Open the currently-selected buffer (or, if [count] is - given, buffer with number [count]), in a new vertical - split. -i Open the currently-selected buffer (or, if [count] is - given, buffer with number [count]), in a new split. -t Open the currently-selected buffer (or, if [count] is - given, buffer with number [count]), in a new tab page. - -------------------------------------------------------------------------------- -Preview Selected Buffer~ - -The following keys all open the currently-selected buffer, but retain focus on -the catalog viewer. If the key presses are preceded by a number, than the -buffer with that number will be opened. - -O, go Preview the currently-selected buffer (or, if [count] is - given, buffer with number [count]), in the previous - window. -S, gs Preview the currently-selected buffer (or, if [count] is - given, buffer with number [count]), is a new vertical - split. -I, gi Preview the currently-selected buffer (or, if [count] is - given, buffer with number [count]), in a new split -T Preview the currently-selected buffer (or, if [count] is - given, buffer with number [count]), in a new tab - page. -, Go to the next buffer entry (or, if [count] is - given, buffer with number [count]), and preview it in the - previous window. -, Go to the previous buffer entry (or, if [count] is - given, buffer with number [count]), and preview it in the - previous window. - -------------------------------------------------------------------------------- -Go to Existing Viewport Showing Buffer~ - -The following keys will try to find the selected buffer in an existing -viewport (whether on the current tab page or another). If the key presses are -preceded by a number, then the buffer with that number will be the target -buffer. - -eo If currently-selected buffer (or, if [count] is - given, buffer with number [count]), is showing in an existing - viewport on this or any other tab page, go it it; - otherwise show it in the previous window. -es If currently-selected buffer (or, if [count] is - given, buffer with number [count]), is showing in an existing - viewport on this or any other tab page, go it it; - otherwise show it in a new vertical split. -ei If currently-selected buffer (or, if [count] is - given, buffer with number [count]), is showing in an existing - viewport on this or any other tab page, go it it; - otherwise show it in a new horizontal split. -et If currently-selected buffer (or, if [count] is - given, buffer with number [count]), is showing in an existing - viewport on this or any other tab page, go it it; - otherwise show it in a new tab page. -E If currently-selected buffer (or, if [count] is - given, buffer with number [count]), is showing in an existing - viewport on this or any other tab page, go it it; - otherwise do nothing. - -------------------------------------------------------------------------------- -Window Control~ - -A Zoom/unzoom window, expanding to full height (if - horizontally split) or full width (if vertically split) - -=============================================================================== - *buffergator-tabpage-keys* -KEY MAPPINGS (TAB PAGE CATALOG)~ - -------------------------------------------------------------------------------- -Catalog Management~ - -cd Cycle through display regimes. -r Update (rebuild/refresh) index. -q Quit the index/catalog window. - -------------------------------------------------------------------------------- -Open Selected Tab Page or Tab Page Window~ - -The following keys all open the currently-selected tab page or window. - -, o Open the currently-selected tab page or window. - Select the next tab page entry. - Select the previous tab page entry. - Select the next tab page window entry. - Select the previous tab page window entry. - -------------------------------------------------------------------------------- -Window Control~ - -A Zoom/unzoom window, expanding to full height (if - horizontally split) or full width (if vertically split) - - -=============================================================================== - *buffergator-options* -OPTIONS AND SETTINGS~ - -The following options can be used to customize the behavior of this plugin: - -g:buffergator_viewport_split_policy~ - Default: "L" - Determines how a new Buffergator window will be opened. Can be one of the - following values: - "L" : vertical left (full screen height) - "R" : vertical right (full screen height) - "T" : horizontal top (full screen width) - "B" : horizontal bottom (full screen width) - -g:buffergator_autodismiss_on_select~ - Default: 1 - If true, then selection an entry with will close the catalog. Otherwise, - catalog stays open. Default is 1. - -g:buffergator_autoexpand_on_split~ - Default: 1 - If true and running in GUI mode, then the application screen will be expanded - to accommodate the Buffergator window. - -g:buffergator_split_size~ - Default: 40 - If greater than 0, this will be the width of the Buffergator window in any - vertical splitting mode, or its height in any horizontal splitting mode. - -g:buffergator_sort_regime~ - Default: "bufnum" - Sets the default sort regime for buffer listing: - "bufnum" : sort by buffer number [default] - "basename": sort by buffer file basename (followed by directory) - "filepath": sort by full buffer filepath - "extension": sort by buffer filename extension (followed by full - filepath) - "mru": sort by most recently used - -g:buffergator_display_regime~ - Default: "basename" - Sets the default sort regime for buffer listing: - "basename": display buffer basename first, - followed by directory [default] - "filepath": display full buffer filepath - "bufname": display buffer name - -g:buffergator_suppress_keymaps~ - Default: 0 - If true, then Buffergator will not automatically map "b" to - open the Buffergator catalog and "B" to close it. - - vim:tw=78:ts=8:ft=help:norl: diff --git a/bundle/buffergator/plugin/buffergator.vim b/bundle/buffergator/plugin/buffergator.vim deleted file mode 100644 index a40193e..0000000 --- a/bundle/buffergator/plugin/buffergator.vim +++ /dev/null @@ -1,1640 +0,0 @@ -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -"" Buffergator -"" -"" Vim document buffer navigation utility -"" -"" Copyright 2011 Jeet Sukumaran. -"" -"" This program is free software; you can redistribute it and/or modify -"" it under the terms of the GNU General Public License as published by -"" the Free Software Foundation; either version 3 of the License, or -"" (at your option) any later version. -"" -"" This program is distributed in the hope that it will be useful, -"" but WITHOUT ANY WARRANTY; without even the implied warranty of -"" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -"" GNU General Public License -"" for more details. -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - -" Reload and Compatibility Guard {{{1 -" ============================================================================ -" Reload protection. -if (exists('g:did_buffergator') && g:did_buffergator) || &cp || version < 700 - finish -endif -let g:did_buffergator = 1 - -" avoid line continuation issues (see ':help user_41.txt') -let s:save_cpo = &cpo -set cpo&vim -" 1}}} - -" Global Plugin Options {{{1 -" ============================================================================= -if !exists("g:buffergator_viewport_split_policy") - let g:buffergator_viewport_split_policy = "L" -endif -if !exists("g:buffergator_move_wrap") - let g:buffergator_move_wrap = 1 -endif -if !exists("g:buffergator_autodismiss_on_select") - let g:buffergator_autodismiss_on_select = 1 -endif -if !exists("g:buffergator_autoexpand_on_split") - let g:buffergator_autoexpand_on_split = 1 -endif -if !exists("g:buffergator_split_size") - let g:buffergator_split_size = 40 -endif -if !exists("g:buffergator_sort_regime") - let g:buffergator_sort_regime = "bufnum" -endif -if !exists("g:buffergator_display_regime") - let g:buffergator_display_regime = "basename" -endif -" 1}}} - -" Script Data and Variables {{{1 -" ============================================================================= - -" Split Modes {{{2 -" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -" Split modes are indicated by a single letter. Upper-case letters indicate -" that the SCREEN (i.e., the entire application "window" from the operating -" system's perspective) should be split, while lower-case letters indicate -" that the VIEWPORT (i.e., the "window" in Vim's terminology, referring to the -" various subpanels or splits within Vim) should be split. -" Split policy indicators and their corresponding modes are: -" ``/`d`/`D' : use default splitting mode -" `n`/`N` : NO split, use existing window. -" `L` : split SCREEN vertically, with new split on the left -" `l` : split VIEWPORT vertically, with new split on the left -" `R` : split SCREEN vertically, with new split on the right -" `r` : split VIEWPORT vertically, with new split on the right -" `T` : split SCREEN horizontally, with new split on the top -" `t` : split VIEWPORT horizontally, with new split on the top -" `B` : split SCREEN horizontally, with new split on the bottom -" `b` : split VIEWPORT horizontally, with new split on the bottom -let s:buffergator_viewport_split_modes = { - \ "d" : "sp", - \ "D" : "sp", - \ "N" : "buffer", - \ "n" : "buffer", - \ "L" : "topleft vert sbuffer", - \ "l" : "leftabove vert sbuffer", - \ "R" : "botright vert sbuffer", - \ "r" : "rightbelow vert sbuffer", - \ "T" : "topleft sbuffer", - \ "t" : "leftabove sbuffer", - \ "B" : "botright sbuffer", - \ "b" : "rightbelow sbuffer", - \ } -" 2}}} - -" Catalog Sort Regimes {{{2 -" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -let s:buffergator_catalog_sort_regimes = ['basename', 'filepath', 'extension', 'bufnum', 'mru'] -let s:buffergator_catalog_sort_regime_desc = { - \ 'basename' : ["basename", "by basename (followed by directory)"], - \ 'filepath' : ["filepath", "by (full) filepath"], - \ 'extension' : ["ext", "by extension (followed by full filepath)"], - \ 'bufnum' : ["bufnum", "by buffer number"], - \ 'mru' : ["mru", "by most recently used"], - \ } -let s:buffergator_default_catalog_sort_regime = "bufnum" -" 2}}} - -" Catalog Display Regimes {{{2 -" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -let s:buffergator_catalog_display_regimes = ['basename', 'filepath', 'bufname'] -let s:buffergator_catalog_display_regime_desc = { - \ 'basename' : ["basename", "basename (followed by directory)"], - \ 'filepath' : ["filepath", "full filepath"], - \ 'bufname' : ["bufname", "buffer name"], - \ } -let s:buffergator_default_display_regime = "basename" -" 2}}} - -" MRU {{{2 -" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -let s:buffergator_mru = [] -" 2}}} -" 1}}} - -" Utilities {{{1 -" ============================================================================== - -" Text Formatting {{{2 -" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -function! s:_format_align_left(text, width, fill_char) - let l:fill = repeat(a:fill_char, a:width-len(a:text)) - return a:text . l:fill -endfunction - -function! s:_format_align_right(text, width, fill_char) - let l:fill = repeat(a:fill_char, a:width-len(a:text)) - return l:fill . a:text -endfunction - -function! s:_format_time(secs) - if exists("*strftime") - return strftime("%Y-%m-%d %H:%M:%S", a:secs) - else - return (localtime() - a:secs) . " secs ago" - endif -endfunction - -function! s:_format_escaped_filename(file) - if exists('*fnameescape') - return fnameescape(a:file) - else - return escape(a:file," \t\n*?[{`$\\%#'\"|!<") - endif -endfunction - -" trunc: -1 = truncate left, 0 = no truncate, +1 = truncate right -function! s:_format_truncated(str, max_len, trunc) - if len(a:str) > a:max_len - if a:trunc > 0 - return strpart(a:str, a:max_len - 4) . " ..." - elseif a:trunc < 0 - return '... ' . strpart(a:str, len(a:str) - a:max_len + 4) - endif - else - return a:str - endif -endfunction - -" Pads/truncates text to fit a given width. -" align: -1/0 = align left, 0 = no align, 1 = align right -" trunc: -1 = truncate left, 0 = no truncate, +1 = truncate right -function! s:_format_filled(str, width, align, trunc) - let l:prepped = a:str - if a:trunc != 0 - let l:prepped = s:Format_Truncate(a:str, a:width, a:trunc) - endif - if len(l:prepped) < a:width - if a:align > 0 - let l:prepped = s:_format_align_right(l:prepped, a:width, " ") - elseif a:align < 0 - let l:prepped = s:_format_align_left(l:prepped, a:width, " ") - endif - endif - return l:prepped -endfunction - -" 2}}} - -" Messaging {{{2 -" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -function! s:NewMessenger(name) - - " allocate a new pseudo-object - let l:messenger = {} - let l:messenger["name"] = a:name - if empty(a:name) - let l:messenger["title"] = "buffergator" - else - let l:messenger["title"] = "buffergator (" . l:messenger["name"] . ")" - endif - - function! l:messenger.format_message(leader, msg) dict - return self.title . ": " . a:leader.a:msg - endfunction - - function! l:messenger.format_exception( msg) dict - return a:msg - endfunction - - function! l:messenger.send_error(msg) dict - redraw - echohl ErrorMsg - echomsg self.format_message("[ERROR] ", a:msg) - echohl None - endfunction - - function! l:messenger.send_warning(msg) dict - redraw - echohl WarningMsg - echomsg self.format_message("[WARNING] ", a:msg) - echohl None - endfunction - - function! l:messenger.send_status(msg) dict - redraw - echohl None - echomsg self.format_message("", a:msg) - endfunction - - function! l:messenger.send_info(msg) dict - redraw - echohl None - echo self.format_message("", a:msg) - endfunction - - return l:messenger - -endfunction -" 2}}} - -" Catalog, Buffer, Windows, Files, etc. Management {{{2 -" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -" Searches for all buffers that have a buffer-scoped variable `varname` -" with value that matches the expression `expr`. Returns list of buffer -" numbers that meet the criterion. -function! s:_find_buffers_with_var(varname, expr) - let l:results = [] - for l:bni in range(1, bufnr("$")) - if !bufexists(l:bni) - continue - endif - let l:bvar = getbufvar(l:bni, "") - if empty(a:varname) - call add(l:results, l:bni) - elseif has_key(l:bvar, a:varname) && l:bvar[a:varname] =~ a:expr - call add(l:results, l:bni) - endif - endfor - return l:results -endfunction - -" Returns split mode to use for a new Buffergator viewport. -function! s:_get_split_mode() - if has_key(s:buffergator_viewport_split_modes, g:buffergator_viewport_split_policy) - return s:buffergator_viewport_split_modes[g:buffergator_viewport_split_policy] - else - call s:_buffergator_messenger.send_error("Unrecognized split mode specified by 'g:buffergator_viewport_split_policy': " . g:buffergator_viewport_split_policy) - endif -endfunction - -" Detect filetype. From the 'taglist' plugin. -" Copyright (C) 2002-2007 Yegappan Lakshmanan -function! s:_detect_filetype(fname) - " Ignore the filetype autocommands - let old_eventignore = &eventignore - set eventignore=FileType - " Save the 'filetype', as this will be changed temporarily - let old_filetype = &filetype - " Run the filetypedetect group of autocommands to determine - " the filetype - exe 'doautocmd filetypedetect BufRead ' . a:fname - " Save the detected filetype - let ftype = &filetype - " Restore the previous state - let &filetype = old_filetype - let &eventignore = old_eventignore - return ftype -endfunction - -function! s:_is_full_width_window(win_num) - if winwidth(a:win_num) == &columns - return 1 - else - return 0 - endif -endfunction! - -function! s:_is_full_height_window(win_num) - if winheight(a:win_num) + &cmdheight + 1 == &lines - return 1 - else - return 0 - endif -endfunction! - -" Moves (or adds) the given buffer number to the top of the list -function! s:_update_mru(acmd_bufnr) - let bnum = a:acmd_bufnr + 0 - if bnum == 0 - return - endif - call filter(s:buffergator_mru, 'v:val !=# bnum') - call insert(s:buffergator_mru, bnum, 0) -endfunction - -" 2}}} - -" Sorting {{{2 -" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -" comparison function used for sorting dictionaries by value -function! s:_compare_dicts_by_value(m1, m2, key) - if a:m1[a:key] < a:m2[a:key] - return -1 - elseif a:m1[a:key] > a:m2[a:key] - return 1 - else - return 0 - endif -endfunction - -" comparison function used for sorting buffers catalog by buffer number -function! s:_compare_dicts_by_bufnum(m1, m2) - return s:_compare_dicts_by_value(a:m1, a:m2, "bufnum") -endfunction - -" comparison function used for sorting buffers catalog by buffer name -function! s:_compare_dicts_by_bufname(m1, m2) - return s:_compare_dicts_by_value(a:m1, a:m2, "bufname") -endfunction - -" comparison function used for sorting buffers catalog by (full) filepath -function! s:_compare_dicts_by_filepath(m1, m2) - if a:m1["parentdir"] < a:m2["parentdir"] - return -1 - elseif a:m1["parentdir"] > a:m2["parentdir"] - return 1 - else - if a:m1["basename"] < a:m2["basename"] - return -1 - elseif a:m1["basename"] > a:m2["basename"] - return 1 - else - return 0 - endif - endif -endfunction - -" comparison function used for sorting buffers catalog by extension -function! s:_compare_dicts_by_extension(m1, m2) - if a:m1["extension"] < a:m2["extension"] - return -1 - elseif a:m1["extension"] > a:m2["extension"] - return 1 - else - return s:_compare_dicts_by_filepath(a:m1, a:m2) - endif -endfunction - -" comparison function used for sorting buffers catalog by basename -function! s:_compare_dicts_by_basename(m1, m2) - return s:_compare_dicts_by_value(a:m1, a:m2, "basename") -endfunction - -" comparison function used for sorting buffers catalog by mru -function! s:_compare_dicts_by_mru(m1, m2) - let l:i1 = index(s:buffergator_mru, a:m1['bufnum']) - let l:i2 = index(s:buffergator_mru, a:m2['bufnum']) - if l:i1 < l:i2 - return -1 - elseif l:i1 > l:i2 - return 1 - else - return 0 - endif -endfunction - -" 2}}} - -" 1}}} - -" CatalogViewer {{{1 -" ============================================================================ - -function! s:NewCatalogViewer(name, title) - - " initialize - let l:catalog_viewer = {} - let l:catalog_viewer["bufname"] = a:name - let l:catalog_viewer["title"] = a:title - let l:buffergator_bufs = s:_find_buffers_with_var("is_buffergator_buffer", 1) - if len(l:buffergator_bufs) > 0 - let l:catalog_viewer["bufnum"] = l:buffergator_bufs[0] - endif - let l:catalog_viewer["jump_map"] = {} - let l:catalog_viewer["split_mode"] = s:_get_split_mode() - let l:catalog_viewer["sort_regime"] = g:buffergator_sort_regime - let l:catalog_viewer["display_regime"] = g:buffergator_display_regime - let l:catalog_viewer["is_zoomed"] = 0 - let l:catalog_viewer["columns_expanded"] = 0 - let l:catalog_viewer["lines_expanded"] = 0 - - " Initialize object state. - let l:catalog_viewer["bufnum"] = -1 - - function! l:catalog_viewer.list_buffers() dict - let bcat = [] - redir => buffers_output - execute('silent ls') - redir END - let l:buffers_output_rows = split(l:buffers_output, "\n") - for l:buffers_output_row in l:buffers_output_rows - let l:parts = matchlist(l:buffers_output_row, '^\s*\(\d\+\)\(.....\) "\(.*\)"') - let l:info = {} - let l:info["bufnum"] = l:parts[1] + 0 - if l:parts[2][0] == "u" - let l:info["is_unlisted"] = 1 - let l:info["is_listed"] = 0 - else - let l:info["is_unlisted"] = 0 - let l:info["is_listed"] = 1 - endif - if l:parts[2][1] == "%" - let l:info["is_current"] = 1 - let l:info["is_alternate"] = 0 - elseif l:parts[2][1] == "#" - let l:info["is_current"] = 0 - let l:info["is_alternate"] = 1 - else - let l:info["is_current"] = 0 - let l:info["is_alternate"] = 0 - endif - if l:parts[2][2] == "a" - let l:info["is_active"] = 1 - let l:info["is_loaded"] = 1 - let l:info["is_visible"] = 1 - elseif l:parts[2][2] == "h" - let l:info["is_active"] = 0 - let l:info["is_loaded"] = 1 - let l:info["is_visible"] = 0 - else - let l:info["is_active"] = 0 - let l:info["is_loaded"] = 0 - let l:info["is_visible"] = 0 - endif - if l:parts[2][3] == "-" - let l:info["is_modifiable"] = 0 - let l:info["is_readonly"] = 0 - elseif l:parts[2][3] == "=" - let l:info["is_modifiable"] = 1 - let l:info["is_readonly"] = 1 - else - let l:info["is_modifiable"] = 1 - let l:info["is_readonly"] = 0 - endif - if l:parts[2][4] == "+" - let l:info["is_modified"] = 1 - let l:info["is_readerror"] = 0 - elseif l:parts[2][4] == "x" - let l:info["is_modified"] = 0 - let l:info["is_readerror"] = 0 - else - let l:info["is_modified"] = 0 - let l:info["is_readerror"] = 0 - endif - let l:info["bufname"] = parts[3] - let l:info["filepath"] = fnamemodify(l:info["bufname"], ":p") - let l:info["basename"] = fnamemodify(l:info["bufname"], ":t") - let l:info["parentdir"] = fnamemodify(l:info["bufname"], ":p:h") - let l:info["extension"] = fnamemodify(l:info["bufname"], ":e") - call add(bcat, l:info) - " let l:buffers_info[l:info[l:key]] = l:info - endfor - let l:sort_func = "s:_compare_dicts_by_" . self.sort_regime - return sort(bcat, l:sort_func) - endfunction - - " Opens viewer if closed, closes viewer if open. - function! l:catalog_viewer.toggle() dict - " get buffer number of the catalog view buffer, creating it if neccessary - if self.bufnum < 0 || !bufexists(self.bufnum) - call self.open() - else - let l:bfwn = bufwinnr(self.bufnum) - if l:bfwn >= 0 - call self.close(1) - else - call self.open() - endif - endif - endfunction - - " Creates a new buffer, renders and opens it. - function! l:catalog_viewer.create_buffer() dict - " get a new buf reference - let self.bufnum = bufnr(self.bufname, 1) - " get a viewport onto it - call self.activate_viewport() - " initialize it (includes "claiming" it) - call self.initialize_buffer() - " render it - call self.render_buffer() - endfunction - - " Opens a viewport on the buffer according, creating it if neccessary - " according to the spawn mode. Valid buffer number must already have been - " obtained before this is called. - function! l:catalog_viewer.activate_viewport() dict - let l:bfwn = bufwinnr(self.bufnum) - if l:bfwn == winnr() - " viewport wth buffer already active and current - return - elseif l:bfwn >= 0 - " viewport with buffer exists, but not current - execute(l:bfwn . " wincmd w") - else - " create viewport - let self.split_mode = s:_get_split_mode() - " gryf: PLEASE! Stop this annoying resizing. - "call self.expand_screen() - execute("silent keepalt keepjumps " . self.split_mode . " " . self.bufnum) - if g:buffergator_viewport_split_policy =~ '[RrLl]' && g:buffergator_split_size - execute("vertical resize " . g:buffergator_split_size) - setlocal winfixwidth - elseif g:buffergator_viewport_split_policy =~ '[TtBb]' && g:buffergator_split_size - execute("resize " . g:buffergator_split_size) - setlocal winfixheight - endif - endif - endfunction - - " Sets up buffer environment. - function! l:catalog_viewer.initialize_buffer() dict - call self.claim_buffer() - call self.setup_buffer_opts() - call self.setup_buffer_syntax() - call self.setup_buffer_commands() - call self.setup_buffer_keymaps() - call self.setup_buffer_folding() - call self.setup_buffer_statusline() - endfunction - - " 'Claims' a buffer by setting it to point at self. - function! l:catalog_viewer.claim_buffer() dict - call setbufvar("%", "is_buffergator_buffer", 1) - call setbufvar("%", "buffergator_catalog_viewer", self) - call setbufvar("%", "buffergator_last_render_time", 0) - call setbufvar("%", "buffergator_cur_line", 0) - endfunction - - " 'Unclaims' a buffer by stripping all buffergator vars - function! l:catalog_viewer.unclaim_buffer() dict - for l:var in ["is_buffergator_buffer", - \ "buffergator_catalog_viewer", - \ "buffergator_last_render_time", - \ "buffergator_cur_line" - \ ] - if exists("b:" . l:var) - unlet b:{l:var} - endif - endfor - endfunction - - " Sets buffer options. - function! l:catalog_viewer.setup_buffer_opts() dict - setlocal buftype=nofile - setlocal noswapfile - setlocal nowrap - set bufhidden=hide - setlocal nobuflisted - setlocal nolist - setlocal noinsertmode - setlocal nonumber - setlocal cursorline - setlocal nospell - endfunction - - " Sets buffer commands. - function! l:catalog_viewer.setup_buffer_commands() dict - " command! -bang -nargs=* Bdfilter :call b:buffergator_catalog_viewer.set_filter('', ) - augroup BuffergatorCatalogViewer - au! - autocmd CursorHold,CursorHoldI,CursorMoved,CursorMovedI,BufEnter,BufLeave call b:buffergator_catalog_viewer.highlight_current_line() - autocmd BufLeave let s:_buffergator_last_catalog_viewed = b:buffergator_catalog_viewer - augroup END - endfunction - - function! l:catalog_viewer.disable_editing_keymaps() dict - """" Disabling of unused modification keys - for key in [".", "p", "P", "C", "x", "X", "r", "R", "i", "I", "a", "A", "D", "S", "U"] - try - execute "nnoremap " . key . " " - catch // - endtry - endfor - endfunction - - " Sets buffer folding. - function! l:catalog_viewer.setup_buffer_folding() dict - " if has("folding") - " "setlocal foldcolumn=3 - " setlocal foldmethod=syntax - " setlocal foldlevel=4 - " setlocal foldenable - " setlocal foldtext=BuffergatorFoldText() - " " setlocal fillchars=fold:\ " - " setlocal fillchars=fold:. - " endif - endfunction - - " Close and quit the viewer. - function! l:catalog_viewer.close(restore_prev_window) dict - if self.bufnum < 0 || !bufexists(self.bufnum) - return - endif - call self.contract_screen() - if a:restore_prev_window - if !self.is_usable_viewport(winnr("#")) && self.first_usable_viewport() ==# -1 - else - try - if !self.is_usable_viewport(winnr("#")) - execute(self.first_usable_viewport() . "wincmd w") - else - execute('wincmd p') - endif - catch // - endtry - endif - endif - execute("bwipe " . self.bufnum) - endfunction - - function! l:catalog_viewer.expand_screen() dict - if has("gui_running") && g:buffergator_autoexpand_on_split && g:buffergator_split_size - if g:buffergator_viewport_split_policy =~ '[RL]' - let self.pre_expand_columns = &columns - let &columns += g:buffergator_split_size - let self.columns_expanded = &columns - self.pre_expand_columns - else - let self.columns_expanded = 0 - endif - if g:buffergator_viewport_split_policy =~ '[TB]' - let self.pre_expand_lines = &lines - let &lines += g:buffergator_split_size - let self.lines_expanded = &lines - self.pre_expand_lines - else - let self.lines_expanded = 0 - endif - endif - endfunction - - function! l:catalog_viewer.contract_screen() dict - if self.columns_expanded - \ && &columns - self.columns_expanded > 20 - let new_size = &columns - self.columns_expanded - if new_size < self.pre_expand_columns - let new_size = self.pre_expand_columns - endif - let &columns = new_size - endif - if self.lines_expanded - \ && &lines - self.lines_expanded > 20 - let new_size = &lines - self.lines_expanded - if new_size < self.pre_expand_lines - let new_size = self.pre_expand_lines - endif - let &lines = new_size - endif - endfunction - - function! l:catalog_viewer.highlight_current_line() - " if line(".") != b:buffergator_cur_line - let l:prev_line = b:buffergator_cur_line - let b:buffergator_cur_line = line(".") - 3match none - exec '3match BuffergatorCurrentEntry /^\%'. b:buffergator_cur_line .'l.*/' - " endif - endfunction - - " Clears the buffer contents. - function! l:catalog_viewer.clear_buffer() dict - call cursor(1, 1) - exec 'silent! normal! "_dG' - endfunction - - " from NERD_Tree, via VTreeExplorer: determine the number of windows open - " to this buffer number. - function! l:catalog_viewer.num_viewports_on_buffer(bnum) dict - let cnt = 0 - let winnum = 1 - while 1 - let bufnum = winbufnr(winnum) - if bufnum < 0 - break - endif - if bufnum ==# a:bnum - let cnt = cnt + 1 - endif - let winnum = winnum + 1 - endwhile - return cnt - endfunction - - " from NERD_Tree: find the window number of the first normal window - function! l:catalog_viewer.first_usable_viewport() dict - let i = 1 - while i <= winnr("$") - let bnum = winbufnr(i) - if bnum != -1 && getbufvar(bnum, '&buftype') ==# '' - \ && !getwinvar(i, '&previewwindow') - \ && (!getbufvar(bnum, '&modified') || &hidden) - return i - endif - - let i += 1 - endwhile - return -1 - endfunction - - " from NERD_Tree: returns 0 if opening a file from the tree in the given - " window requires it to be split, 1 otherwise - function! l:catalog_viewer.is_usable_viewport(winnumber) dict - "gotta split if theres only one window (i.e. the NERD tree) - if winnr("$") ==# 1 - return 0 - endif - let oldwinnr = winnr() - execute(a:winnumber . "wincmd p") - let specialWindow = getbufvar("%", '&buftype') != '' || getwinvar('%', '&previewwindow') - let modified = &modified - execute(oldwinnr . "wincmd p") - "if its a special window e.g. quickfix or another explorer plugin then we - "have to split - if specialWindow - return 0 - endif - if &hidden - return 1 - endif - return !modified || self.num_viewports_on_buffer(winbufnr(a:winnumber)) >= 2 - endfunction - - " Acquires a viewport to show the source buffer. Returns the split command - " to use when switching to the buffer. - function! l:catalog_viewer.acquire_viewport(split_cmd) - if self.split_mode == "buffer" && empty(a:split_cmd) - " buffergator used original buffer's viewport, - " so the the buffergator viewport is the viewport to use - return "" - endif - if !self.is_usable_viewport(winnr("#")) && self.first_usable_viewport() ==# -1 - " no appropriate viewport is available: create new using default - " split mode - " TODO: maybe use g:buffergator_viewport_split_policy? - if empty(a:split_cmd) - return "sb" - else - return a:split_cmd - endif - else - try - if !self.is_usable_viewport(winnr("#")) - execute(self.first_usable_viewport() . "wincmd w") - else - execute('wincmd p') - endif - catch /^Vim\%((\a\+)\)\=:E37/ - echo v:exception - catch /^Vim\%((\a\+)\)\=:/ - echo v:exception - endtry - return a:split_cmd - endif - endfunction - - " Finds next occurrence of specified pattern. - function! l:catalog_viewer.goto_pattern(pattern, direction) dict range - if a:direction == "b" || a:direction == "p" - let l:flags = "b" - " call cursor(line(".")-1, 0) - else - let l:flags = "" - " call cursor(line(".")+1, 0) - endif - if g:buffergator_move_wrap - let l:flags .= "w" - else - let l:flags .= "W" - endif - let l:flags .= "e" - let l:lnum = -1 - for i in range(v:count1) - if search(a:pattern, l:flags) < 0 - break - else - let l:lnum = 1 - endif - endfor - if l:lnum < 0 - if l:flags[0] == "b" - call s:_buffergator_messenger.send_info("No previous results") - else - call s:_buffergator_messenger.send_info("No more results") - endif - return 0 - else - return 1 - endif - endfunction - - " Cycles sort regime. - function! l:catalog_viewer.cycle_sort_regime() dict - let l:cur_regime = index(s:buffergator_catalog_sort_regimes, self.sort_regime) - let l:cur_regime += 1 - if l:cur_regime < 0 || l:cur_regime >= len(s:buffergator_catalog_sort_regimes) - let self.sort_regime = s:buffergator_catalog_sort_regimes[0] - else - let self.sort_regime = s:buffergator_catalog_sort_regimes[l:cur_regime] - endif - call self.open(1) - let l:sort_desc = get(s:buffergator_catalog_sort_regime_desc, self.sort_regime, ["??", "in unspecified order"])[1] - call s:_buffergator_messenger.send_info("sorted " . l:sort_desc) - endfunction - - " Cycles display regime. - function! l:catalog_viewer.cycle_display_regime() dict - let l:cur_regime = index(s:buffergator_catalog_display_regimes, self.display_regime) - let l:cur_regime += 1 - if l:cur_regime < 0 || l:cur_regime >= len(s:buffergator_catalog_display_regimes) - let self.display_regime = s:buffergator_catalog_display_regimes[0] - else - let self.display_regime = s:buffergator_catalog_display_regimes[l:cur_regime] - endif - call self.open(1) - let l:display_desc = get(s:buffergator_catalog_display_regime_desc, self.display_regime, ["??", "in unspecified order"])[1] - call s:_buffergator_messenger.send_info("displaying " . l:display_desc) - endfunction - - " Rebuilds catalog. - function! l:catalog_viewer.rebuild_catalog() dict - call self.open(1) - endfunction - - " Zooms/unzooms window. - function! l:catalog_viewer.toggle_zoom() dict - let l:bfwn = bufwinnr(self.bufnum) - if l:bfwn < 0 - return - endif - if self.is_zoomed - " if s:_is_full_height_window(l:bfwn) && !s:_is_full_width_window(l:bfwn) - if g:buffergator_viewport_split_policy =~ '[RrLl]' - if !g:buffergator_split_size - let l:new_size = &columns / 3 - else - let l:new_size = g:buffergator_split_size - endif - if l:new_size > 0 - execute("vertical resize " . string(l:new_size)) - endif - let self.is_zoomed = 0 - " elseif s:_is_full_width_window(l:bfwn) && !s:_is_full_height_window(l:bfwn) - elseif g:buffergator_viewport_split_policy =~ '[TtBb]' - if !g:buffergator_split_size - let l:new_size = &lines / 3 - else - let l:new_size = g:buffergator_split_size - endif - if l:new_size > 0 - execute("resize " . string(l:new_size)) - endif - let self.is_zoomed = 0 - endif - else - " if s:_is_full_height_window(l:bfwn) && !s:_is_full_width_window(l:bfwn) - if g:buffergator_viewport_split_policy =~ '[RrLl]' - if &columns > 20 - execute("vertical resize " . string(&columns-10)) - let self.is_zoomed = 1 - endif - " elseif s:_is_full_width_window(l:bfwn) && !s:_is_full_height_window(l:bfwn) - elseif g:buffergator_viewport_split_policy =~ '[TtBb]' - if &lines > 20 - execute("resize " . string(&lines-10)) - let self.is_zoomed = 1 - endif - endif - endif - endfunction - - " functions to be implemented by derived classes - function! l:catalog_viewer.update_buffers_info() dict - endfunction - - function! l:catalog_viewer.open(...) dict - endfunction - - function! l:catalog_viewer.setup_buffer_syntax() dict - endfunction - - function! l:catalog_viewer.setup_buffer_keymaps() dict - endfunction - - function! l:catalog_viewer.render_buffer() dict - endfunction - - function! l:catalog_viewer.setup_buffer_statusline() dict - endfunction - - function! l:catalog_viewer.append_line(text, jump_to_bufnum) dict - endfunction - - return l:catalog_viewer - -endfunction - -" 1}}} - -" BufferCatalogViewer {{{1 -" ============================================================================ -function! s:NewBufferCatalogViewer() - - " initialize - let l:catalog_viewer = s:NewCatalogViewer("[[buffergator: buffers]]", "buffergator") - let l:catalog_viewer["calling_bufnum"] = -1 - let l:catalog_viewer["buffers_catalog"] = {} - - " Populates the buffer list - function! l:catalog_viewer.update_buffers_info() dict - let self.buffers_catalog = self.list_buffers() - return self.buffers_catalog - endfunction - - " Opens the buffer for viewing, creating it if needed. - " First argument, if given, should be false if the buffers info is *not* - " to be repopulated; defaults to 1 - " Second argument, if given, should be number of calling window. - function! l:catalog_viewer.open(...) dict - " populate data - if (a:0 == 0 || a:1 > 0) - call self.update_buffers_info() - endif - " store calling buffer - if (a:0 >= 2 && a:2) - let self.calling_bufnum = a:2 - else - let self.calling_bufnum = bufnr("%") - endif - " get buffer number of the catalog view buffer, creating it if neccessary - if self.bufnum < 0 || !bufexists(self.bufnum) - " create and render a new buffer - call self.create_buffer() - else - " buffer exists: activate a viewport on it according to the - " spawning mode, re-rendering the buffer with the catalog if needed - call self.activate_viewport() - call self.render_buffer() - " if (a:0 > 0 && a:1) || b:buffergator_catalog_viewer != self - " call self.render_buffer() - " else - " " search for calling buffer number in jump map, - " " when found, go to that line - " endif - endif - endfunction - - - " Sets buffer syntax. - function! l:catalog_viewer.setup_buffer_syntax() dict - if has("syntax") - syn region BuffergatorModifiedFileLine start='^\[\s\{-}.\{-1,}\s\{-}\] + ' keepend oneline end='$' - syn region BuffergatorUnmodifiedFileLine start='^\[\s\{-}.\{-1,}\s\{-}\] ' keepend oneline end='$' - syn match BuffergatorModifiedFileSyntaxKey '^\zs\[\s\{-}.\{-1,}\s\{-}\]\ze' containedin=BuffergatorModifiedFileLine nextgroup=BuffergatorModifiedFilename - syn match BuffergatorUnmodifiedFileSyntaxKey '^\zs\[\s\{-}.\{-1,}\s\{-}\]\ze' containedin=BuffergatorUnmodifiedFileLine nextgroup=BuffergatorUnmodifiedFilename - syn match BuffergatorModifiedFilename ' + .\+$' containedin=BuffergatorModifiedFilenameEntry - syn match BuffergatorUnmodifiedFilename ' .\+$' containedin=BuffergatorUnmodifiedFileLine - highlight! link BuffergatorModifiedFileSyntaxKey LineNr - highlight! link BuffergatorUnmodifiedFileSyntaxKey LineNr - highlight! link BuffergatorModifiedFileFlag WarningMsg - highlight! link BuffergatorModifiedFilename WarningMsg - highlight! def BuffergatorCurrentEntry gui=reverse cterm=reverse term=reverse - endif - endfunction - - " Sets buffer key maps. - function! l:catalog_viewer.setup_buffer_keymaps() dict - - call self.disable_editing_keymaps() - - if !exists("g:buffergator_use_new_keymap") || !g:buffergator_use_new_keymap - - """" Catalog management - noremap cs :call b:buffergator_catalog_viewer.cycle_sort_regime() - noremap cd :call b:buffergator_catalog_viewer.cycle_display_regime() - noremap r :call b:buffergator_catalog_viewer.rebuild_catalog() - noremap q :call b:buffergator_catalog_viewer.close(1) - noremap d :call b:buffergator_catalog_viewer.delete_target(0, 0) - noremap D :call b:buffergator_catalog_viewer.delete_target(0, 1) - noremap x :call b:buffergator_catalog_viewer.delete_target(1, 0) - noremap X :call b:buffergator_catalog_viewer.delete_target(1, 1) - - """"" Selection: show target and switch focus - noremap :call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "") - noremap o :call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "") - " gryf: let's keep it stright: s should split, v should vsplit - noremap s :call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "sb") - noremap v :call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "vert sb") - noremap t :call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "tab sb") - - """"" Preview: show target , keeping focus on catalog - " gryf: also here, I want to have consistent shortcuts - noremap O :call b:buffergator_catalog_viewer.visit_target(1, 1, "") - noremap go :call b:buffergator_catalog_viewer.visit_target(1, 1, "") - noremap S :call b:buffergator_catalog_viewer.visit_target(1, 1, "sb") - noremap gs :call b:buffergator_catalog_viewer.visit_target(1, 1, "sb") - noremap V :call b:buffergator_catalog_viewer.visit_target(1, 1, "vert sb") - noremap gv :call b:buffergator_catalog_viewer.visit_target(1, 1, "vert sb") - noremap T :call b:buffergator_catalog_viewer.visit_target(1, 1, "tab sb") - noremap :call b:buffergator_catalog_viewer.goto_index_entry("n", 1, 1) - noremap :call b:buffergator_catalog_viewer.goto_index_entry("p", 1, 1) - noremap :call b:buffergator_catalog_viewer.goto_index_entry("p", 1, 1) - noremap :call b:buffergator_catalog_viewer.goto_index_entry("n", 1, 1) - noremap :call b:buffergator_catalog_viewer.goto_index_entry("p", 1, 1) - - """"" Preview: go to existing window showing target - noremap E :call b:buffergator_catalog_viewer.visit_open_target(1, !g:buffergator_autodismiss_on_select, "") - noremap eo :call b:buffergator_catalog_viewer.visit_open_target(0, !g:buffergator_autodismiss_on_select, "") - noremap es :call b:buffergator_catalog_viewer.visit_open_target(0, !g:buffergator_autodismiss_on_select, "vert sb") - noremap ei :call b:buffergator_catalog_viewer.visit_open_target(0, !g:buffergator_autodismiss_on_select, "sb") - noremap et :call b:buffergator_catalog_viewer.visit_open_target(0, !g:buffergator_autodismiss_on_select, "tab sb") - - else - - """" Catalog management - noremap s :call b:buffergator_catalog_viewer.cycle_sort_regime() - noremap i :call b:buffergator_catalog_viewer.cycle_display_regime() - noremap u :call b:buffergator_catalog_viewer.rebuild_catalog() - noremap q :call b:buffergator_catalog_viewer.close(1) - noremap d :call b:buffergator_catalog_viewer.delete_target(0, 0) - noremap D :call b:buffergator_catalog_viewer.delete_target(0, 1) - noremap x :call b:buffergator_catalog_viewer.delete_target(1, 0) - noremap X :call b:buffergator_catalog_viewer.delete_target(1, 1) - - " open target - noremap :call b:buffergator_catalog_viewer.visit_target(!g:buffergator_autodismiss_on_select, 0, "") - - " show target line in other window, keeping catalog open and in focus - noremap . :call b:buffergator_catalog_viewer.visit_target(1, 1, "") - noremap po :call b:buffergator_catalog_viewer.visit_target(1, 1, "") - noremap ps :call b:buffergator_catalog_viewer.visit_target(1, 1, "sb") - noremap pv :call b:buffergator_catalog_viewer.visit_target(1, 1, "vert sb") - noremap pt :call b:buffergator_catalog_viewer.visit_target(1, 1, "tab sb") - noremap :call b:buffergator_catalog_viewer.goto_index_entry("n", 1, 1) - noremap :call b:buffergator_catalog_viewer.goto_index_entry("p", 1, 1) - noremap :call b:buffergator_catalog_viewer.goto_index_entry("p", 1, 1) - noremap :call b:buffergator_catalog_viewer.goto_index_entry("n", 1, 1) - noremap :call b:buffergator_catalog_viewer.goto_index_entry("p", 1, 1) - - " go to target line in other window, keeping catalog open - noremap o :call b:buffergator_catalog_viewer.visit_target(1, 0, "") - noremap ws :call b:buffergator_catalog_viewer.visit_target(1, 0, "sb") - noremap wv :call b:buffergator_catalog_viewer.visit_target(1, 0, "vert sb") - noremap t :call b:buffergator_catalog_viewer.visit_target(1, 0, "tab sb") - - " open target line in other window, closing catalog - noremap O :call b:buffergator_catalog_viewer.visit_target(0, 0, "") - noremap wS :call b:buffergator_catalog_viewer.visit_target(0, 0, "sb") - noremap wV :call b:buffergator_catalog_viewer.visit_target(0, 0, "vert sb") - noremap T :call b:buffergator_catalog_viewer.visit_target(0, 0, "tab sb") - - endif - - " other - noremap A :call b:buffergator_catalog_viewer.toggle_zoom() - - endfunction - - " Populates the buffer with the catalog index. - function! l:catalog_viewer.render_buffer() dict - setlocal modifiable - call self.claim_buffer() - call self.clear_buffer() - call self.setup_buffer_syntax() - let self.jump_map = {} - let l:initial_line = 1 - for l:bufinfo in self.buffers_catalog - if self.calling_bufnum == l:bufinfo.bufnum - let l:initial_line = line("$") - endif - let l:bufnum_str = s:_format_filled(l:bufinfo.bufnum, 3, 1, 0) - let l:line = "[" . l:bufnum_str . "] " - if l:bufinfo.is_modified - let l:line .= "+ " - else - let l:line .= " " - endif - if self.display_regime == "basename" - let l:line .= s:_format_align_left(l:bufinfo.basename, 30, " ") - let l:line .= l:bufinfo.parentdir - elseif self.display_regime == "filepath" - let l:line .= l:bufinfo.filepath - elseif self.display_regime == "bufname" - let l:line .= l:bufinfo.bufname - else - throw s:_buffergator_messenger.format_exception("Invalid display regime: '" . self.display_regime . "'") - endif - call self.append_line(l:line, l:bufinfo.bufnum) - endfor - let b:buffergator_last_render_time = localtime() - try - " remove extra last line - execute('normal! GV"_X') - catch // - endtry - setlocal nomodifiable - call cursor(l:initial_line, 1) - " call self.goto_index_entry("n", 0, 1) - endfunction - - " Visits the specified buffer in the previous window, if it is already - " visible there. If not, then it looks for the first window with the - " buffer showing and visits it there. If no windows are showing the - " buffer, ... ? - function! l:catalog_viewer.visit_buffer(bufnum, split_cmd) dict - " acquire window - let l:split_cmd = self.acquire_viewport(a:split_cmd) - " switch to buffer in acquired window - let l:old_switch_buf = &switchbuf - if empty(l:split_cmd) - " explicit split command not given: switch to buffer in current - " window - let &switchbuf="useopen" - execute("silent buffer " . a:bufnum) - else - " explcit split command given: split current window - let &switchbuf="split" - execute("silent keepalt keepjumps " . l:split_cmd . " " . a:bufnum) - endif - let &switchbuf=l:old_switch_buf - endfunction - - function! l:catalog_viewer.get_target_bufnum(cmd_count) dict - if a:cmd_count == 0 - let l:cur_line = line(".") - if !has_key(l:self.jump_map, l:cur_line) - call s:_buffergator_messenger.send_info("Not a valid navigation line") - return -1 - endif - let [l:jump_to_bufnum] = self.jump_map[l:cur_line].target - return l:jump_to_bufnum - else - let l:jump_to_bufnum = a:cmd_count - if bufnr(l:jump_to_bufnum) == -1 - call s:_buffergator_messenger.send_info("Not a valid buffer number: " . string(l:jump_to_bufnum) ) - return -1 - endif - for lnum in range(1, line("$")) - if self.jump_map[lnum].target[0] == l:jump_to_bufnum - call cursor(lnum, 1) - return l:jump_to_bufnum - endif - endfor - call s:_buffergator_messenger.send_info("Not a listed buffer number: " . string(l:jump_to_bufnum) ) - return -1 - endif - endfunction - - " Go to the selected buffer. - function! l:catalog_viewer.visit_target(keep_catalog, refocus_catalog, split_cmd) dict range - let l:jump_to_bufnum = self.get_target_bufnum(v:count) - if l:jump_to_bufnum == -1 - return 0 - endif - let l:cur_tab_num = tabpagenr() - if !a:keep_catalog - call self.close(0) - endif - call self.visit_buffer(l:jump_to_bufnum, a:split_cmd) - if a:keep_catalog && a:refocus_catalog - execute("tabnext " . l:cur_tab_num) - execute(bufwinnr(self.bufnum) . "wincmd w") - endif - call s:_buffergator_messenger.send_info(expand(bufname(l:jump_to_bufnum))) - endfunction - - " Go to the selected buffer, preferentially using a window that already is - " showing it; if not, create a window using split_cmd - function! l:catalog_viewer.visit_open_target(unconditional, keep_catalog, split_cmd) dict range - let l:jump_to_bufnum = self.get_target_bufnum(v:count) - if l:jump_to_bufnum == -1 - return 0 - endif - let wnr = bufwinnr(l:jump_to_bufnum) - if wnr != -1 - execute(wnr . "wincmd w") - if !a:keep_catalog - call self.close(0) - endif - return - endif - let l:cur_tab_num = tabpagenr() - for tabnum in range(1, tabpagenr('$')) - execute("tabnext " . tabnum) - let wnr = bufwinnr(l:jump_to_bufnum) - if wnr != -1 - execute(wnr . "wincmd w") - if !a:keep_catalog - call self.close(0) - endif - return - endif - endfor - execute("tabnext " . l:cur_tab_num) - if !a:unconditional - call self.visit_target(a:keep_catalog, 0, a:split_cmd) - endif - endfunction - - function! l:catalog_viewer.delete_target(wipe, force) dict range - let l:bufnum_to_delete = self.get_target_bufnum(v:count) - if l:bufnum_to_delete == -1 - return 0 - endif - if !bufexists(l:bufnum_to_delete) - call s:_buffergator_messenger.send_info("Not a valid or existing buffer") - return 0 - endif - if a:wipe && a:force - let l:operation_desc = "unconditionally wipe" - let l:cmd = "bw!" - elseif a:wipe && !a:force - let l:operation_desc = "wipe" - let l:cmd = "bw" - elseif !a:wipe && a:force - let l:operation_desc = "unconditionally delete" - let l:cmd = "bd!" - elseif !a:wipe && !a:force - let l:operation_desc = "delete" - let l:cmd = "bd" - endif - - " store current window number - let l:cur_win_num = winnr() - - " find alternate buffer to switch to - let l:alternate_buffer = -1 - for abufnum in range(l:bufnum_to_delete, 1, -1) - if bufexists(abufnum) && buflisted(abufnum) && abufnum != l:bufnum_to_delete - let l:alternate_buffer = abufnum - break - endif - endfor - if l:alternate_buffer == -1 && bufnr("$") > l:bufnum_to_delete - for abufnum in range(l:bufnum_to_delete+1, bufnr("$")) - if bufexists(abufnum) && buflisted(abufnum) && abufnum != l:bufnum_to_delete - let l:alternate_buffer = abufnum - break - endif - endfor - endif - if l:alternate_buffer == -1 - call s:_buffergator_messenger.send_warning("Cowardly refusing to delete last listed buffer") - return 0 - endif - - let l:changed_win_bufs = [] - for winnum in range(1, winnr('$')) - let wbufnum = winbufnr(winnum) - if wbufnum == l:bufnum_to_delete - call add(l:changed_win_bufs, winnum) - execute(winnum . "wincmd w") - execute("silent keepalt keepjumps buffer " . l:alternate_buffer) - endif - endfor - - let l:bufname = expand(bufname(l:bufnum_to_delete)) - try - execute(l:cmd . string(l:bufnum_to_delete)) - call self.open(1, l:alternate_buffer) - let l:message = l:bufname . " " . l:operation_desc . "d" - call s:_buffergator_messenger.send_info(l:message) - catch /E89/ - for winnum in l:changed_win_bufs - execute(winnum . "wincmd w") - execute("silent keepalt keepjumps buffer " . l:bufnum_to_delete) - endfor - execute(l:cur_win_num . "wincmd w") - let l:message = 'Failed to ' . l:operation_desc . ' "' . l:bufname . '" because it is modified; use unconditional version of this command to force operation' - call s:_buffergator_messenger.send_error(l:message) - catch // - for winnum in l:changed_win_bufs - execute(winnum . "wincmd w") - execute("silent keepalt keepjumps buffer " . l:bufnum_to_delete) - endfor - execute(l:cur_win_num . "wincmd w") - let l:message = 'Failed to ' . l:operation_desc . ' "' . l:bufname . '"' - call s:_buffergator_messenger.send_error(l:message) - endtry - - endfunction - - " Finds next line with occurrence of a rendered index - function! l:catalog_viewer.goto_index_entry(direction, visit_target, refocus_catalog) dict range - if v:count > 0 - let l:target_bufnum = v:count - if bufnr(l:target_bufnum) == -1 - call s:_buffergator_messenger.send_info("Not a valid buffer number: " . string(l:target_bufnum) ) - return -1 - endif - let l:ok = 0 - for lnum in range(1, line("$")) - if self.jump_map[lnum].target[0] == l:target_bufnum - call cursor(lnum, 1) - let l:ok = 1 - break - endif - endfor - if !l:ok - call s:_buffergator_messenger.send_info("Not a listed buffer number: " . string(l:target_bufnum) ) - return -1 - endif - else - let l:ok = self.goto_pattern("^\[", a:direction) - execute("normal! zz") - endif - if l:ok && a:visit_target - call self.visit_target(1, a:refocus_catalog, "") - endif - endfunction - - " Sets buffer status line. - function! l:catalog_viewer.setup_buffer_statusline() dict - setlocal statusline=%{BuffergatorBuffersStatusLine()} - endfunction - - " Appends a line to the buffer and registers it in the line log. - function! l:catalog_viewer.append_line(text, jump_to_bufnum) dict - let l:line_map = { - \ "target" : [a:jump_to_bufnum], - \ } - if a:0 > 0 - call extend(l:line_map, a:1) - endif - let self.jump_map[line("$")] = l:line_map - call append(line("$")-1, a:text) - endfunction - - " return object - return l:catalog_viewer - - -endfunction -" 1}}} - -" TabCatalogViewer {{{1 -" ============================================================================ -function! s:NewTabCatalogViewer() - - " initialize - let l:catalog_viewer = s:NewCatalogViewer("[[buffergator: tabs]]", "buffergator") - let l:catalog_viewer["tab_catalog"] = [] - - " Opens the buffer for viewing, creating it if needed. - " First argument, if given, should be false if the buffers info is *not* - " to be repopulated; defaults to 1 - function! l:catalog_viewer.open(...) dict - " populate data - if (a:0 == 0 || a:1 > 0) - call self.update_buffers_info() - endif - " get buffer number of the catalog view buffer, creating it if neccessary - if self.bufnum < 0 || !bufexists(self.bufnum) - " create and render a new buffer - call self.create_buffer() - else - " buffer exists: activate a viewport on it according to the - " spawning mode, re-rendering the buffer with the catalog if needed - call self.activate_viewport() - call self.render_buffer() - endif - endfunction - - " Populates the buffer list - function! l:catalog_viewer.update_buffers_info() dict - let self.tab_catalog = [] - for tabnum in range(1, tabpagenr('$')) - call add(self.tab_catalog, tabpagebuflist(tabnum)) - endfor - return self.tab_catalog - endfunction - - " Populates the buffer with the catalog index. - function! l:catalog_viewer.render_buffer() dict - setlocal modifiable - let l:cur_tab_num = tabpagenr() - call self.claim_buffer() - call self.clear_buffer() - call self.setup_buffer_syntax() - let self.jump_map = {} - let l:initial_line = 1 - for l:tidx in range(len(self.tab_catalog)) - let l:tabinfo = self.tab_catalog[tidx] - if l:cur_tab_num - 1 == l:tidx - let l:initial_line = line("$") - endif - " let l:tabfield = "==== Tab Page [" . string(l:tidx+1) . "] ====" - let l:tabfield = "TAB PAGE " . string(l:tidx+1) . ":" - call self.append_line(l:tabfield, l:tidx+1, 1) - for widx in range(len(l:tabinfo)) - let l:tabbufnum = l:tabinfo[widx] - let l:tabbufname = bufname(l:tabbufnum) - let subline = "[" . s:_format_filled(l:tabbufnum, 3, 1, 0) . "] " - if getbufvar(l:tabbufnum, "&mod") == 1 - let subline .= "+ " - else - let subline .= " " - endif - if self.display_regime == "basename" - let l:subline .= s:_format_align_left(fnamemodify(l:tabbufname, ":t"), 30, " ") - let l:subline .= fnamemodify(l:tabbufname, ":p:h") - elseif self.display_regime == "filepath" - let l:subline .= fnamemodify(l:tabbufname, ":p") - elseif self.display_regime == "bufname" - let l:subline .= l:tabbufname - else - throw s:_buffergator_messenger.format_exception("Invalid display regime: '" . self.display_regime . "'") - endif - call self.append_line(l:subline, l:tidx+1, l:widx+1) - endfor - endfor - let b:buffergator_last_render_time = localtime() - try - " remove extra last line - execute('normal! GV"_X') - catch // - endtry - setlocal nomodifiable - call cursor(l:initial_line, 1) - " call self.goto_index_entry("n", 0, 1) - endfunction - - function! l:catalog_viewer.setup_buffer_syntax() dict - if has("syntax") - syn match BuffergatorTabPageLine '^TAB PAGE \d\+\:$' - " syn match BuffergatorTabPageLineStart '^==== Tab Page \[' nextgroup=BuffergatorTabPageNumber - " syn match BuffergatorTabPageNumber '\d\+' nextgroup=BuffergatorTabPageLineEnd - " syn match BuffergatorTabPageLineEnd '\] ====$' - syn region BuffergatorModifiedFileLine start='^\[\s\{-}.\{-1,}\s\{-}\] + ' keepend oneline end='$' - syn region BuffergatorUnmodifiedFileLine start='^\[\s\{-}.\{-1,}\s\{-}\] ' keepend oneline end='$' - syn match BuffergatorModifiedFileSyntaxKey '^\zs\[\s\{-}.\{-1,}\s\{-}\]\ze' containedin=BuffergatorModifiedFileLine nextgroup=BuffergatorModifiedFilename - syn match BuffergatorUnmodifiedFileSyntaxKey '^\zs\[\s\{-}.\{-1,}\s\{-}\]\ze' containedin=BuffergatorUnmodifiedFileLine nextgroup=BuffergatorUnmodifiedFilename - syn match BuffergatorModifiedFilename ' + .\+$' containedin=BuffergatorModifiedFilenameEntry - syn match BuffergatorUnmodifiedFilename ' .\+$' containedin=BuffergatorUnmodifiedFileLine - highlight! link BuffergatorModifiedFileSyntaxKey LineNr - highlight! link BuffergatorUnmodifiedFileSyntaxKey LineNr - highlight! link BuffergatorModifiedFileFlag WarningMsg - highlight! link BuffergatorModifiedFilename WarningMsg - highlight! link BuffergatorTabPageLine Title - " highlight! link BufergatorModifiedFilename NonText - " highlight! link BufergatorUnmodifiedFilename NonText - " highlight! link BuffergatorTabPageLineStart Title - " highlight! link BuffergatorTabPageNumber Special - " highlight! link BuffergatorTabPageLineEnd Title - highlight! def BuffergatorCurrentEntry gui=reverse cterm=reverse term=reverse - endif - endfunction - - function! l:catalog_viewer.setup_buffer_keymaps() dict - - call self.disable_editing_keymaps() - - noremap cd :call b:buffergator_catalog_viewer.cycle_display_regime() - noremap r :call b:buffergator_catalog_viewer.rebuild_catalog() - noremap q :call b:buffergator_catalog_viewer.close(1) - - noremap :call b:buffergator_catalog_viewer.visit_target() - noremap o :call b:buffergator_catalog_viewer.visit_target() - - noremap :call b:buffergator_catalog_viewer.goto_index_entry("n") - noremap :call b:buffergator_catalog_viewer.goto_index_entry("p") - noremap :call b:buffergator_catalog_viewer.goto_index_entry("p") - noremap :call b:buffergator_catalog_viewer.goto_win_entry("n") - noremap :call b:buffergator_catalog_viewer.goto_win_entry("p") - noremap A :call b:buffergator_catalog_viewer.toggle_zoom() - - endfunction - - " Appends a line to the buffer and registers it in the line log. - function! l:catalog_viewer.append_line(text, jump_to_tabnum, jump_to_winnum) dict - let l:line_map = { - \ "target" : [a:jump_to_tabnum, a:jump_to_winnum], - \ } - if a:0 > 0 - call extend(l:line_map, a:1) - endif - let self.jump_map[line("$")] = l:line_map - call append(line("$")-1, a:text) - endfunction - - function! l:catalog_viewer.goto_index_entry(direction) dict - let l:ok = self.goto_pattern("^T", a:direction) - execute("normal! zz") - " if l:ok && a:visit_target - " call self.visit_target(1, a:refocus_catalog, "") - " endif - endfunction - - function! l:catalog_viewer.goto_win_entry(direction) dict - let l:ok = self.goto_pattern('^\[', a:direction) - execute("normal! zz") - endfunction - - " Go to the selected buffer. - function! l:catalog_viewer.visit_target() dict - let l:cur_line = line(".") - if !has_key(l:self.jump_map, l:cur_line) - call s:_buffergator_messenger.send_info("Not a valid navigation line") - return 0 - endif - let [l:jump_to_tabnum, l:jump_to_winnum] = self.jump_map[l:cur_line].target - call self.close(0) - execute("tabnext " . l:jump_to_tabnum) - execute(l:jump_to_winnum . "wincmd w") - " call s:_buffergator_messenger.send_info(expand(bufname(l:jump_to_bufnum))) - endfunction - - function! l:catalog_viewer.setup_buffer_statusline() dict - setlocal statusline=%{BuffergatorTabsStatusLine()} - endfunction - - " return object - return l:catalog_viewer - -endfunction -" 1}}} - -" Global Functions {{{1 -" ============================================================================== -function! BuffergatorBuffersStatusLine() - let l:line = line(".") - let l:status_line = "[[buffergator]]" - if has_key(b:buffergator_catalog_viewer.jump_map, l:line) - let l:status_line .= " Buffer " . string(l:line) . " of " . string(len(b:buffergator_catalog_viewer.buffers_catalog)) - endif - return l:status_line -endfunction -function! BuffergatorTabsStatusLine() - let l:status_line = "[[buffergator]]" - let l:line = line(".") - if has_key(b:buffergator_catalog_viewer.jump_map, l:line) - let l:status_line .= " Tab Page: " . b:buffergator_catalog_viewer.jump_map[l:line].target[0] - let l:status_line .= ", Window: " . b:buffergator_catalog_viewer.jump_map[l:line].target[1] - endif - return l:status_line -endfunction -" 1}}} - -" Global Initialization {{{1 -" ============================================================================== -if exists("s:_buffergator_messenger") - unlet s:_buffergator_messenger -endif -let s:_buffergator_messenger = s:NewMessenger("") -let s:_catalog_viewer = s:NewBufferCatalogViewer() -let s:_tab_catalog_viewer = s:NewTabCatalogViewer() - -" Autocommands that update the most recenly used buffers -autocmd BufRead * call s:_update_mru(expand('')) -autocmd BufNewFile * call s:_update_mru(expand('')) -autocmd BufWritePost * call s:_update_mru(expand('')) -" 1}}} - -" Functions Supporting User Commands {{{1 -" ============================================================================== - -function! s:OpenBuffergator() - call s:_tab_catalog_viewer.close(1) - call s:_catalog_viewer.open() -endfunction - -function! s:OpenBuffergatorTabs() - call s:_catalog_viewer.close(1) - call s:_tab_catalog_viewer.open(1) -endfunction - -function! s:CloseBuffergator() - call s:_catalog_viewer.close(1) - call s:_tab_catalog_viewer.close(1) -endfunction - -function! s:ToggleBuffergator() - call s:_tab_catalog_viewer.close(1) - call s:_catalog_viewer.toggle() -endfunction - -function! s:ToggleBuffergatorTabs() - call s:_catalog_viewer.close(1) - call s:_tab_catalog_viewer.toggle() -endfunction - -" 1}}} - -" Public Command and Key Maps {{{1 -" ============================================================================== -command! BuffergatorToggle :call ToggleBuffergator() -command! BuffergatorClose :call CloseBuffergator() -command! BuffergatorOpen :call OpenBuffergator() -command! BuffergatorTabsToggle :call ToggleBuffergatorTabs() -command! BuffergatorTabsOpen :call OpenBuffergatorTabs() -command! BuffergatorTabsClose :call CloseBuffergatorTabs() - -if !exists('g:buffergator_suppress_keymaps') || !g:buffergator_suppress_keymaps - " nnoremap :BuffergatorToggle - nnoremap b :BuffergatorOpen - nnoremap B :BuffergatorClose - nnoremap t :BuffergatorTabsOpen - nnoremap T :BuffergatorTabsClose -endif - -" 1}}} - -" Restore State {{{1 -" ============================================================================ -" restore options -let &cpo = s:save_cpo -" 1}}} - -" vim:foldlevel=4: diff --git a/bundle/fuzzyfinder/autoload/fuf.vim b/bundle/fuzzyfinder/autoload/fuf.vim deleted file mode 100644 index fe9e6eb..0000000 --- a/bundle/fuzzyfinder/autoload/fuf.vim +++ /dev/null @@ -1,1046 +0,0 @@ -"============================================================================= -" Copyright (c) 2007-2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" GLOBAL FUNCTIONS {{{1 - - -" returns list of paths. -" An argument for glob() is normalized in order to avoid a bug on Windows. -function fuf#glob(expr) - " Substitutes "\", because on Windows, "**\" doesn't include ".\", - " but "**/" include "./". I don't know why. - return split(glob(substitute(a:expr, '\', '/', 'g')), "\n") -endfunction - -" -function fuf#countModifiedFiles(files, time) - return len(filter(copy(a:files), 'getftime(expand(v:val)) > a:time')) -endfunction - -" -function fuf#getCurrentTagFiles() - return sort(filter(map(tagfiles(), 'fnamemodify(v:val, '':p'')'), 'filereadable(v:val)')) -endfunction - -" -function fuf#mapToSetSerialIndex(in, offset) - for i in range(len(a:in)) - let a:in[i].index = i + a:offset - endfor - return a:in -endfunction - -" -function fuf#updateMruList(mrulist, newItem, maxItem, exclude) - let result = copy(a:mrulist) - let result = filter(result,'v:val.word !=# a:newItem.word') - let result = insert(result, a:newItem) - if len(a:exclude) - let result = filter(result, 'v:val.word !~ a:exclude') - endif - return result[0 : a:maxItem - 1] -endfunction - -" takes suffix number. if no digits, returns -1 -function fuf#suffixNumber(str) - let s = matchstr(a:str, '\d\+$') - return (len(s) ? str2nr(s) : -1) -endfunction - -" "foo/bar/buz/hoge" -> { head: "foo/bar/buz/", tail: "hoge" } -function fuf#splitPath(path) - let head = matchstr(a:path, '^.*[/\\]') - return { - \ 'head' : head, - \ 'tail' : a:path[strlen(head):] - \ } -endfunction - -" "foo/.../bar/...hoge" -> "foo/.../bar/../../hoge" -function fuf#expandTailDotSequenceToParentDir(pattern) - return substitute(a:pattern, '^\(.*[/\\]\)\?\zs\.\(\.\+\)\ze[^/\\]*$', - \ '\=repeat(".." . l9#getPathSeparator(), len(submatch(2)))', '') -endfunction - -" -function fuf#formatPrompt(prompt, partialMatching, otherString) - let indicator = escape((a:partialMatching ? '!' : '') . a:otherString, '\') - return substitute(a:prompt, '[]', indicator, 'g') -endfunction - -" -function fuf#getFileLines(file) - let bufnr = (type(a:file) ==# type(0) ? a:file : bufnr('^' . a:file . '$')) - let lines = getbufline(bufnr, 1, '$') - if !empty(lines) - return lines - endif - return l9#readFile(a:file) -endfunction - -" -function fuf#makePreviewLinesAround(lines, indices, page, maxHeight) - let index = ((empty(a:indices) ? 0 : a:indices[0]) - \ + a:page * a:maxHeight) % len(a:lines) - if empty(a:lines) || a:maxHeight <= 0 - return [] - endif - let beg = max([0, index - a:maxHeight / 2]) - let end = min([beg + a:maxHeight, len(a:lines)]) - let beg = max([0, end - a:maxHeight]) - let lines = [] - for i in range(beg, end - 1) - let mark = (count(a:indices, i) ? '>' : ' ') - call add(lines, printf('%s%4d ', mark, i + 1) . a:lines[i]) - endfor - return lines -endfunction - -" a:file: a path string or a buffer number -function fuf#makePreviewLinesForFile(file, count, maxHeight) - let lines = fuf#getFileLines(a:file) - if empty(lines) - return [] - endif - let bufnr = (type(a:file) ==# type(0) ? a:file : bufnr('^' . a:file . '$')) - if exists('s:bufferCursorPosMap[bufnr]') - let indices = [s:bufferCursorPosMap[bufnr][1] - 1] - else - let indices = [] - endif - return fuf#makePreviewLinesAround( - \ lines, indices, a:count, a:maxHeight) -endfunction - -" -function fuf#echoWarning(msg) - call l9#echoHl('WarningMsg', a:msg, '[fuf] ', 1) -endfunction - -" -function fuf#echoError(msg) - call l9#echoHl('ErrorMsg', a:msg, '[fuf] ', 1) -endfunction - -" -function fuf#openBuffer(bufNr, mode, reuse) - if a:reuse && ((a:mode ==# s:OPEN_TYPE_SPLIT && - \ l9#moveToBufferWindowInCurrentTabpage(a:bufNr)) || - \ (a:mode ==# s:OPEN_TYPE_VSPLIT && - \ l9#moveToBufferWindowInCurrentTabpage(a:bufNr)) || - \ (a:mode ==# s:OPEN_TYPE_TAB && - \ l9#moveToBufferWindowInOtherTabpage(a:bufNr))) - return - endif - execute printf({ - \ s:OPEN_TYPE_CURRENT : '%sbuffer' , - \ s:OPEN_TYPE_SPLIT : '%ssbuffer' , - \ s:OPEN_TYPE_VSPLIT : 'vertical %ssbuffer', - \ s:OPEN_TYPE_TAB : 'tab %ssbuffer' , - \ }[a:mode], a:bufNr) -endfunction - -" -function fuf#openFile(path, mode, reuse) - let bufNr = bufnr('^' . a:path . '$') - if bufNr > -1 - call fuf#openBuffer(bufNr, a:mode, a:reuse) - else - execute { - \ s:OPEN_TYPE_CURRENT : 'edit ' , - \ s:OPEN_TYPE_SPLIT : 'split ' , - \ s:OPEN_TYPE_VSPLIT : 'vsplit ' , - \ s:OPEN_TYPE_TAB : 'tabedit ', - \ }[a:mode] . fnameescape(fnamemodify(a:path, ':~:.')) - endif -endfunction - -" -function fuf#openTag(tag, mode) - execute { - \ s:OPEN_TYPE_CURRENT : 'tjump ' , - \ s:OPEN_TYPE_SPLIT : 'stjump ' , - \ s:OPEN_TYPE_VSPLIT : 'vertical stjump ', - \ s:OPEN_TYPE_TAB : 'tab stjump ' , - \ }[a:mode] . a:tag -endfunction - -" -function fuf#openHelp(tag, mode) - execute { - \ s:OPEN_TYPE_CURRENT : 'help ' , - \ s:OPEN_TYPE_SPLIT : 'help ' , - \ s:OPEN_TYPE_VSPLIT : 'vertical help ', - \ s:OPEN_TYPE_TAB : 'tab help ' , - \ }[a:mode] . a:tag -endfunction - -" -function fuf#prejump(mode) - execute { - \ s:OPEN_TYPE_CURRENT : '' , - \ s:OPEN_TYPE_SPLIT : 'split' , - \ s:OPEN_TYPE_VSPLIT : 'vsplit' , - \ s:OPEN_TYPE_TAB : 'tab split', - \ }[a:mode] -endfunction - -" -function fuf#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 fuf#makePathItem(fname, menu, appendsDirSuffix) - let pathPair = fuf#splitPath(a:fname) - let dirSuffix = (a:appendsDirSuffix && isdirectory(expand(a:fname)) - \ ? l9#getPathSeparator() - \ : '') - return { - \ 'word' : a:fname . dirSuffix, - \ 'wordForPrimaryHead': s:toLowerForIgnoringCase(pathPair.head), - \ 'wordForPrimaryTail': s:toLowerForIgnoringCase(pathPair.tail), - \ 'wordForBoundary' : s:toLowerForIgnoringCase(s:getWordBoundaries(pathPair.tail)), - \ 'wordForRefining' : s:toLowerForIgnoringCase(a:fname . dirSuffix), - \ 'wordForRank' : s:toLowerForIgnoringCase(pathPair.tail), - \ 'menu' : a:menu, - \ } -endfunction - -" -function fuf#makeNonPathItem(word, menu) - let wordL = s:toLowerForIgnoringCase(a:word) - return { - \ 'word' : a:word, - \ 'wordForPrimary' : wordL, - \ 'wordForBoundary': s:toLowerForIgnoringCase(s:getWordBoundaries(a:word)), - \ 'wordForRefining': wordL, - \ 'wordForRank' : wordL, - \ 'menu' : a:menu, - \ } -endfunction - -" -function fuf#makePatternSet(patternBase, interpreter, partialMatching) - let MakeMatchingExpr = function(a:partialMatching - \ ? 's:makePartialMatchingExpr' - \ : 's:makeFuzzyMatchingExpr') - let [primary; refinings] = split(a:patternBase, g:fuf_patternSeparator, 1) - let elements = call(a:interpreter, [primary]) - let primaryExprs = map(elements.matchingPairs, 'MakeMatchingExpr(v:val[0], v:val[1])') - let refiningExprs = map(refinings, 's:makeRefiningExpr(v:val)') - return { - \ 'primary' : elements.primary, - \ 'primaryForRank': elements.primaryForRank, - \ 'filteringExpr' : join(primaryExprs + refiningExprs, ' && '), - \ } -endfunction - -" -function fuf#enumExpandedDirsEntries(dir, exclude) - let entries = fuf#glob(a:dir . '*') + fuf#glob(a:dir . '.*') - " removes "*/." and "*/.." - call filter(entries, 'v:val !~ ''\v(^|[/\\])\.\.?$''') - call map(entries, 'fuf#makePathItem(v:val, "", 1)') - if len(a:exclude) - call filter(entries, 'v:val.word !~ a:exclude') - endif - return entries -endfunction - -" -function fuf#mapToSetAbbrWithSnippedWordAsPath(items) - let maxLenStats = {} - call map(a:items, 's:makeFileAbbrInfo(v:val, maxLenStats)') - let snippedHeads = - \ map(maxLenStats, 's:getSnippedHead(v:key[: -2], v:val)') - return map(a:items, 's:setAbbrWithFileAbbrData(v:val, snippedHeads)') -endfunction - -" -function fuf#setAbbrWithFormattedWord(item, abbrIndex) - let lenMenu = (exists('a:item.menu') ? len(a:item.menu) + 2 : 0) - let abbrPrefix = (exists('a:item.abbrPrefix') ? a:item.abbrPrefix : '') - let a:item.abbr = abbrPrefix . a:item.word - if a:abbrIndex - let a:item.abbr = printf('%4d: ', a:item.index) . a:item.abbr - endif - let a:item.abbr = l9#snipTail(a:item.abbr, g:fuf_maxMenuWidth - lenMenu, s:ABBR_SNIP_MASK) - return a:item -endfunction - -" -function s:onCommandPre() - for m in filter(copy(fuf#getModeNames()), 'fuf#{v:val}#requiresOnCommandPre()') - call fuf#{m}#onCommandPre(getcmdtype() . getcmdline()) - endfor - " lets last entry become the newest in the history - call histadd(getcmdtype(), getcmdline()) - " this is not mapped again (:help recursive_mapping) - return "\" -endfunction - -" -let s:modeNames = [] - -" -function fuf#addMode(modeName) - if count(g:fuf_modesDisable, a:modeName) > 0 - return - endif - call add(s:modeNames, a:modeName) - call fuf#{a:modeName}#renewCache() - call fuf#{a:modeName}#onInit() - if fuf#{a:modeName}#requiresOnCommandPre() - " cnoremap has a problem, which doesn't expand cabbrev. - cmap onCommandPre() - endif -endfunction - -" -function fuf#getModeNames() - return s:modeNames -endfunction - -" -function fuf#defineLaunchCommand(CmdName, modeName, prefixInitialPattern, tempVars) - if empty(a:tempVars) - let preCmd = '' - else - let preCmd = printf('call l9#tempvariables#setList(%s, %s) | ', - \ string(s:TEMP_VARIABLES_GROUP), string(a:tempVars)) - endif - execute printf('command! -range -bang -narg=? %s %s call fuf#launch(%s, %s . , len())', - \ a:CmdName, preCmd, string(a:modeName), a:prefixInitialPattern) -endfunction - -" -function fuf#defineKeyMappingInHandler(key, func) - " hacks to be able to use feedkeys(). - execute printf( - \ 'inoremap %s =fuf#getRunningHandler().%s ? "" : ""', - \ a:key, a:func) -endfunction - -" -let s:oneTimeVariables = [] - -" -function fuf#setOneTimeVariables(...) - let s:oneTimeVariables += a:000 -endfunction - -" -function fuf#launch(modeName, initialPattern, partialMatching) - if exists('s:runningHandler') - call fuf#echoWarning('FuzzyFinder is running.') - endif - if count(fuf#getModeNames(), a:modeName) == 0 - echoerr 'This mode is not available: ' . a:modeName - return - endif - let s:runningHandler = fuf#{a:modeName}#createHandler(copy(s:handlerBase)) - let s:runningHandler.stats = fuf#loadDataFile(s:runningHandler.getModeName(), 'stats') - let s:runningHandler.partialMatching = a:partialMatching - let s:runningHandler.bufNrPrev = bufnr('%') - let s:runningHandler.lastCol = -1 - let s:runningHandler.windowRestoringCommand = winrestcmd() - call s:runningHandler.onModeEnterPre() - " NOTE: updatetime is set, because in Buffer-Tag mode on Vim 7.3 on Windows, - " Vim keeps from triggering CursorMovedI for updatetime after system() is - " called. I don't know why. - call fuf#setOneTimeVariables( - \ ['&completeopt', 'menuone'], - \ ['&ignorecase', 0], - \ ['&updatetime', 10], - \ ) - if s:runningHandler.getPreviewHeight() > 0 - call fuf#setOneTimeVariables( - \ ['&cmdheight', s:runningHandler.getPreviewHeight() + 1]) - endif - call l9#tempvariables#setList(s:TEMP_VARIABLES_GROUP, s:oneTimeVariables) - let s:oneTimeVariables = [] - call s:activateFufBuffer() - augroup FufLocal - autocmd! - autocmd CursorMovedI call s:runningHandler.onCursorMovedI() - autocmd InsertLeave nested call s:runningHandler.onInsertLeave() - augroup END - for [key, func] in [ - \ [ g:fuf_keyOpen , 'onCr(' . s:OPEN_TYPE_CURRENT . ')' ], - \ [ g:fuf_keyOpenSplit , 'onCr(' . s:OPEN_TYPE_SPLIT . ')' ], - \ [ g:fuf_keyOpenVsplit , 'onCr(' . s:OPEN_TYPE_VSPLIT . ')' ], - \ [ g:fuf_keyOpenTabpage , 'onCr(' . s:OPEN_TYPE_TAB . ')' ], - \ [ '' , 'onBs()' ], - \ [ '' , 'onBs()' ], - \ [ '' , 'onDeleteWord()' ], - \ [ g:fuf_keyPreview , 'onPreviewBase(1)' ], - \ [ g:fuf_keyNextMode , 'onSwitchMode(+1)' ], - \ [ g:fuf_keyPrevMode , 'onSwitchMode(-1)' ], - \ [ g:fuf_keySwitchMatching, 'onSwitchMatching()' ], - \ [ g:fuf_keyPrevPattern , 'onRecallPattern(+1)' ], - \ [ g:fuf_keyNextPattern , 'onRecallPattern(-1)' ], - \ ] - call fuf#defineKeyMappingInHandler(key, func) - endfor - " Starts Insert mode and makes CursorMovedI event now. Command prompt is - " needed to forces a completion menu to update every typing. - call setline(1, s:runningHandler.getPrompt() . a:initialPattern) - call s:runningHandler.onModeEnterPost() - call feedkeys("A", 'n') " startinsert! does not work in InsertLeave event handler - redraw -endfunction - -" -function fuf#loadDataFile(modeName, dataName) - if !s:dataFileAvailable - return [] - endif - let lines = l9#readFile(l9#concatPaths([g:fuf_dataDir, a:modeName, a:dataName])) - return map(lines, 'eval(v:val)') -endfunction - -" -function fuf#saveDataFile(modeName, dataName, items) - if !s:dataFileAvailable - return -1 - endif - let lines = map(copy(a:items), 'string(v:val)') - return l9#writeFile(lines, l9#concatPaths([g:fuf_dataDir, a:modeName, a:dataName])) -endfunction - -" -function fuf#getDataFileTime(modeName, dataName) - if !s:dataFileAvailable - return -1 - endif - return getftime(expand(l9#concatPaths([g:fuf_dataDir, a:modeName, a:dataName]))) -endfunction - -" -function s:createDataBufferListener(dataFile) - let listener = { 'dataFile': a:dataFile } - - function listener.onWrite(lines) - let [modeName, dataName] = split(self.dataFile, l9#getPathSeparator()) - let items = map(filter(a:lines, '!empty(v:val)'), 'eval(v:val)') - call fuf#saveDataFile(modeName, dataName, items) - echo "Data files updated" - return 1 - endfunction - - return listener -endfunction - -" -function s:createEditDataListener() - let listener = {} - - function listener.onComplete(dataFile, method) - let bufName = '[fuf-info]' - let lines = l9#readFile(l9#concatPaths([g:fuf_dataDir, a:dataFile])) - call l9#tempbuffer#openWritable(bufName, 'vim', lines, 0, 0, 0, - \ s:createDataBufferListener(a:dataFile)) - endfunction - - return listener -endfunction - -" -function s:getEditableDataFiles(modeName) - let dataFiles = fuf#{a:modeName}#getEditableDataNames() - call filter(dataFiles, 'fuf#getDataFileTime(a:modeName, v:val) != -1') - return map(dataFiles, 'l9#concatPaths([a:modeName, v:val])') -endfunction - -" -function fuf#editDataFile() - let dataFiles = map(copy(fuf#getModeNames()), 's:getEditableDataFiles(v:val)') - let dataFiles = l9#concat(dataFiles) - call fuf#callbackitem#launch('', 0, '>Mode>', s:createEditDataListener(), dataFiles, 0) -endfunction - -" -function fuf#getRunningHandler() - return s:runningHandler -endfunction - -" -function fuf#onComplete(findstart, base) - return s:runningHandler.onComplete(a:findstart, a:base) -endfunction - -" }}}1 -"============================================================================= -" LOCAL FUNCTIONS/VARIABLES {{{1 - -let s:TEMP_VARIABLES_GROUP = expand(':p') -let s:ABBR_SNIP_MASK = '...' -let s:OPEN_TYPE_CURRENT = 1 -let s:OPEN_TYPE_SPLIT = 2 -let s:OPEN_TYPE_VSPLIT = 3 -let s:OPEN_TYPE_TAB = 4 - -" a:pattern: 'str' -> '\V\.\*s\.\*t\.\*r\.\*' -function s:makeFuzzyMatchingExpr(target, pattern) - let wi = '' - for c in split(a:pattern, '\zs') - if wi =~# '[^*?]$' && c !~ '[*?]' - let wi .= '*' - endif - let wi .= c - endfor - return s:makePartialMatchingExpr(a:target, wi) -endfunction - -" a:pattern: 'str' -> '\Vstr' -" 'st*r' -> '\Vst\.\*r' -function s:makePartialMatchingExpr(target, pattern) - let patternMigemo = s:makeAdditionalMigemoPattern(a:pattern) - if a:pattern !~ '[*?]' && empty(patternMigemo) - " NOTE: stridx is faster than regexp matching - return 'stridx(' . a:target . ', ' . string(a:pattern) . ') >= 0' - endif - return a:target . ' =~# ' . - \ string(l9#convertWildcardToRegexp(a:pattern)) . patternMigemo -endfunction - -" -function s:makeRefiningExpr(pattern) - if g:fuf_fuzzyRefining - let expr = s:makeFuzzyMatchingExpr('v:val.wordForRefining', a:pattern) - else - let expr = s:makePartialMatchingExpr('v:val.wordForRefining', a:pattern) - endif - if a:pattern =~# '\D' - return expr - else - return '(' . expr . ' || v:val.index == ' . string(a:pattern) . ')' - endif -endfunction - -" -function s:makeAdditionalMigemoPattern(pattern) - if !g:fuf_useMigemo || a:pattern =~# '[^\x01-\x7e]' - return '' - endif - return '\|\m' . substitute(migemo(a:pattern), '\\_s\*', '.*', 'g') -endfunction - -" -function s:interpretPrimaryPatternForPathTail(pattern) - let pattern = fuf#expandTailDotSequenceToParentDir(a:pattern) - let pairL = fuf#splitPath(s:toLowerForIgnoringCase(pattern)) - return { - \ 'primary' : pattern, - \ 'primaryForRank': pairL.tail, - \ 'matchingPairs' : [['v:val.wordForPrimaryTail', pairL.tail],], - \ } -endfunction - -" -function s:interpretPrimaryPatternForPath(pattern) - let pattern = fuf#expandTailDotSequenceToParentDir(a:pattern) - let patternL = s:toLowerForIgnoringCase(pattern) - let pairL = fuf#splitPath(patternL) - if g:fuf_splitPathMatching - let matches = [ - \ ['v:val.wordForPrimaryHead', pairL.head], - \ ['v:val.wordForPrimaryTail', pairL.tail], - \ ] - else - let matches = [ - \ ['v:val.wordForPrimaryHead . v:val.wordForPrimaryTail', patternL], - \ ] - endif - return { - \ 'primary' : pattern, - \ 'primaryForRank': pairL.tail, - \ 'matchingPairs' : matches, - \ } -endfunction - -" -function s:interpretPrimaryPatternForNonPath(pattern) - let patternL = s:toLowerForIgnoringCase(a:pattern) - return { - \ 'primary' : a:pattern, - \ 'primaryForRank': patternL, - \ 'matchingPairs' : [['v:val.wordForPrimary', patternL],], - \ } -endfunction - -" -function s:getWordBoundaries(word) - return substitute(a:word, '\a\zs\l\+\|\zs\A', '', 'g') -endfunction - -" -function s:toLowerForIgnoringCase(str) - return (g:fuf_ignoreCase ? tolower(a:str) : a:str) -endfunction - -" -function s:setRanks(item, pattern, exprBoundary, stats) - "let word2 = substitute(a:eval_word, '\a\zs\l\+\|\zs\A', '', 'g') - let a:item.ranks = [ - \ s:evaluateLearningRank(a:item.word, a:stats), - \ -s:scoreSequentialMatching(a:item.wordForRank, a:pattern), - \ -s:scoreBoundaryMatching(a:item.wordForBoundary, - \ a:pattern, a:exprBoundary), - \ a:item.index, - \ ] - return a:item -endfunction - -" -function s:evaluateLearningRank(word, stats) - for i in range(len(a:stats)) - if a:stats[i].word ==# a:word - return i - endif - endfor - return len(a:stats) -endfunction - -" range of return value is [0.0, 1.0] -function s:scoreSequentialMatching(word, pattern) - if empty(a:pattern) - return str2float('0.0') - endif - let pos = stridx(a:word, a:pattern) - if pos < 0 - return str2float('0.0') - endif - let lenRest = len(a:word) - len(a:pattern) - pos - return str2float(pos == 0 ? '0.5' : '0.0') + str2float('0.5') / (lenRest + 1) -endfunction - -" range of return value is [0.0, 1.0] -function s:scoreBoundaryMatching(wordForBoundary, pattern, exprBoundary) - if empty(a:pattern) - return str2float('0.0') - endif - if !eval(a:exprBoundary) - return 0 - endif - return (s:scoreSequentialMatching(a:wordForBoundary, a:pattern) + 1) / 2 -endfunction - -" -function s:highlightPrompt(prompt) - syntax clear - execute printf('syntax match %s /^\V%s/', g:fuf_promptHighlight, escape(a:prompt, '\/')) -endfunction - -" -function s:highlightError() - syntax clear - syntax match Error /^.*$/ -endfunction - -" -function s:expandAbbrevMap(pattern, abbrevMap) - let result = [a:pattern] - for [pattern, subs] in items(a:abbrevMap) - let exprs = result - let result = [] - for expr in exprs - let result += map(copy(subs), 'substitute(expr, pattern, escape(v:val, ''\''), "g")') - endfor - endfor - return l9#unique(result) -endfunction - -" -function s:makeFileAbbrInfo(item, maxLenStats) - let head = matchstr(a:item.word, '^.*[/\\]\ze.') - let a:item.abbr = { 'head' : head, - \ 'tail' : a:item.word[strlen(head):], - \ 'key' : head . '.', - \ 'prefix' : printf('%4d: ', a:item.index), } - if exists('a:item.abbrPrefix') - let a:item.abbr.prefix .= a:item.abbrPrefix - endif - let len = len(a:item.abbr.prefix) + len(a:item.word) + - \ (exists('a:item.menu') ? len(a:item.menu) + 2 : 0) - if !exists('a:maxLenStats[a:item.abbr.key]') || len > a:maxLenStats[a:item.abbr.key] - let a:maxLenStats[a:item.abbr.key] = len - endif - return a:item -endfunction - -" -function s:getSnippedHead(head, baseLen) - return l9#snipMid(a:head, len(a:head) + g:fuf_maxMenuWidth - a:baseLen, s:ABBR_SNIP_MASK) -endfunction - -" -function s:setAbbrWithFileAbbrData(item, snippedHeads) - let lenMenu = (exists('a:item.menu') ? len(a:item.menu) + 2 : 0) - let abbr = a:item.abbr.prefix . a:snippedHeads[a:item.abbr.key] . a:item.abbr.tail - let a:item.abbr = l9#snipTail(abbr, g:fuf_maxMenuWidth - lenMenu, s:ABBR_SNIP_MASK) - return a:item -endfunction - -" -let s:FUF_BUF_NAME = '[fuf]' - -" -function s:activateFufBuffer() - " lcd . : To avoid the strange behavior that unnamed buffer changes its cwd - " if 'autochdir' was set on. - lcd . - let cwd = getcwd() - call l9#tempbuffer#openScratch(s:FUF_BUF_NAME, 'fuf', [], 1, 0, 1, {}) - resize 1 " for issue #21 - " lcd ... : countermeasure against auto-cd script - lcd `=cwd` - setlocal nocursorline " for highlighting - setlocal nocursorcolumn " for highlighting - setlocal omnifunc=fuf#onComplete - redraw " for 'lazyredraw' - if exists(':AcpLock') - AcpLock - elseif exists(':AutoComplPopLock') - AutoComplPopLock - endif -endfunction - -" -function s:deactivateFufBuffer() - if exists(':AcpUnlock') - AcpUnlock - elseif exists(':AutoComplPopUnlock') - AutoComplPopUnlock - endif - call l9#tempbuffer#close(s:FUF_BUF_NAME) -endfunction - -" }}}1 -"============================================================================= -" s:handlerBase {{{1 - -let s:handlerBase = {} - -"----------------------------------------------------------------------------- -" PURE VIRTUAL FUNCTIONS {{{2 -" -" " -" s:handler.getModeName() -" -" " -" s:handler.getPrompt() -" -" " -" s:handler.getCompleteItems(patternSet) -" -" " -" s:handler.onOpen(word, mode) -" -" " Before entering FuzzyFinder buffer. This function should return in a short time. -" s:handler.onModeEnterPre() -" -" " After entering FuzzyFinder buffer. -" s:handler.onModeEnterPost() -" -" " After leaving FuzzyFinder buffer. -" s:handler.onModeLeavePost(opened) -" -" }}}2 -"----------------------------------------------------------------------------- - -" -function s:handlerBase.concretize(deriv) - call extend(self, a:deriv, 'error') - return self -endfunction - -" -function s:handlerBase.addStat(pattern, word) - let stat = { 'pattern' : a:pattern, 'word' : a:word } - call filter(self.stats, 'v:val !=# stat') - call insert(self.stats, stat) - let self.stats = self.stats[0 : g:fuf_learningLimit - 1] -endfunction - -" -function s:handlerBase.getMatchingCompleteItems(patternBase) - let MakeMatchingExpr = function(self.partialMatching - \ ? 's:makePartialMatchingExpr' - \ : 's:makeFuzzyMatchingExpr') - let patternSet = self.makePatternSet(a:patternBase) - let exprBoundary = s:makeFuzzyMatchingExpr('a:wordForBoundary', patternSet.primaryForRank) - let stats = filter( - \ copy(self.stats), 'v:val.pattern ==# patternSet.primaryForRank') - let items = self.getCompleteItems(patternSet.primary) - " NOTE: In order to know an excess, plus 1 to limit number - let items = l9#filterWithLimit( - \ items, patternSet.filteringExpr, g:fuf_enumeratingLimit + 1) - return map(items, - \ 's:setRanks(v:val, patternSet.primaryForRank, exprBoundary, stats)') -endfunction - -" -function s:handlerBase.onComplete(findstart, base) - if a:findstart - return 0 - elseif !self.existsPrompt(a:base) - return [] - endif - call s:highlightPrompt(self.getPrompt()) - let items = [] - for patternBase in s:expandAbbrevMap(self.removePrompt(a:base), g:fuf_abbrevMap) - let items += self.getMatchingCompleteItems(patternBase) - if len(items) > g:fuf_enumeratingLimit - let items = items[ : g:fuf_enumeratingLimit - 1] - call s:highlightError() - break - endif - endfor - if empty(items) - call s:highlightError() - else - call sort(items, 'fuf#compareRanks') - if g:fuf_autoPreview - call feedkeys("\\\=fuf#getRunningHandler().onPreviewBase(0) ? '' : ''\", 'n') - else - call feedkeys("\\", 'n') - endif - let self.lastFirstWord = items[0].word - endif - return items -endfunction - -" -function s:handlerBase.existsPrompt(line) - return strlen(a:line) >= strlen(self.getPrompt()) && - \ a:line[:strlen(self.getPrompt()) -1] ==# self.getPrompt() -endfunction - -" -function s:handlerBase.removePrompt(line) - return a:line[(self.existsPrompt(a:line) ? strlen(self.getPrompt()) : 0):] -endfunction - -" -function s:handlerBase.restorePrompt(line) - let i = 0 - while i < len(self.getPrompt()) && i < len(a:line) && self.getPrompt()[i] ==# a:line[i] - let i += 1 - endwhile - return self.getPrompt() . a:line[i : ] -endfunction - -" -function s:handlerBase.onCursorMovedI() - if !self.existsPrompt(getline('.')) - call setline('.', self.restorePrompt(getline('.'))) - call feedkeys("\", 'n') - elseif col('.') <= len(self.getPrompt()) - " if the cursor is moved before command prompt - call feedkeys(repeat("\", len(self.getPrompt()) - col('.') + 1), 'n') - elseif col('.') > strlen(getline('.')) && col('.') != self.lastCol - " if the cursor is placed on the end of the line and has been actually moved. - let self.lastCol = col('.') - let self.lastPattern = self.removePrompt(getline('.')) - call feedkeys("\\", 'n') - endif -endfunction - -" -function s:handlerBase.onInsertLeave() - unlet s:runningHandler - let tempVars = l9#tempvariables#getList(s:TEMP_VARIABLES_GROUP) - call l9#tempvariables#end(s:TEMP_VARIABLES_GROUP) - call s:deactivateFufBuffer() - call fuf#saveDataFile(self.getModeName(), 'stats', self.stats) - execute self.windowRestoringCommand - let fOpen = exists('s:reservedCommand') - if fOpen - call self.onOpen(s:reservedCommand[0], s:reservedCommand[1]) - unlet s:reservedCommand - endif - call self.onModeLeavePost(fOpen) - if exists('self.reservedMode') - call l9#tempvariables#setList(s:TEMP_VARIABLES_GROUP, tempVars) - call fuf#launch(self.reservedMode, self.lastPattern, self.partialMatching) - endif -endfunction - -" -function s:handlerBase.onCr(openType) - if pumvisible() - call feedkeys(printf("\\=fuf#getRunningHandler().onCr(%d) ? '' : ''\", - \ a:openType), 'n') - return - endif - if !empty(self.lastPattern) - call self.addStat(self.lastPattern, self.removePrompt(getline('.'))) - endif - if !self.isOpenable(getline('.')) - " To clear i_ expression (fuf#getRunningHandler().onCr...) - echo '' - return - endif - let s:reservedCommand = [self.removePrompt(getline('.')), a:openType] - call feedkeys("\", 'n') " stopinsert behavior is strange... -endfunction - -" -function s:handlerBase.onBs() - call feedkeys((pumvisible() ? "\\" : "\"), 'n') -endfunction - -" -function s:getLastBlockLength(pattern, patternIsPath) - let separatorPos = strridx(a:pattern, g:fuf_patternSeparator) - if separatorPos >= 0 - return len(a:pattern) - separatorPos - endif - if a:patternIsPath && a:pattern =~# '[/\\].' - return len(matchstr(a:pattern, '[^/\\]*.$')) - endif - return len(a:pattern) -endfunction - -" -function s:handlerBase.onDeleteWord() - let pattern = self.removePrompt(getline('.')[ : col('.') - 2]) - let numBs = s:getLastBlockLength(pattern, 1) - call feedkeys((pumvisible() ? "\" : "") . repeat("\", numBs), 'n') -endfunction - -" -function s:handlerBase.onPreviewBase(repeatable) - if self.getPreviewHeight() <= 0 - return - elseif !pumvisible() - return - elseif !self.existsPrompt(getline('.')) - let word = self.removePrompt(getline('.')) - elseif !exists('self.lastFirstWord') - return - else - let word = self.lastFirstWord - endif - redraw - if a:repeatable && exists('self.lastPreviewInfo') && self.lastPreviewInfo.word ==# word - let self.lastPreviewInfo.count += 1 - else - let self.lastPreviewInfo = {'word': word, 'count': 0} - endif - let lines = self.makePreviewLines(word, self.lastPreviewInfo.count) - let lines = lines[: self.getPreviewHeight() - 1] - call map(lines, 'substitute(v:val, "\t", repeat(" ", &tabstop), "g")') - call map(lines, 'strtrans(v:val)') - call map(lines, 'l9#snipTail(v:val, &columns - 1, s:ABBR_SNIP_MASK)') - echo join(lines, "\n") -endfunction - -" -function s:handlerBase.onSwitchMode(shift) - let modes = copy(fuf#getModeNames()) - call map(modes, '{ "ranks": [ fuf#{v:val}#getSwitchOrder(), v:val ] }') - call filter(modes, 'v:val.ranks[0] >= 0') - call sort(modes, 'fuf#compareRanks') - let self.reservedMode = self.getModeName() - for i in range(len(modes)) - if modes[i].ranks[1] ==# self.getModeName() - let self.reservedMode = modes[(i + a:shift) % len(modes)].ranks[1] - break - endif - endfor - call feedkeys("\", 'n') " stopinsert doesn't work. -endfunction - -" -function s:handlerBase.onSwitchMatching() - let self.partialMatching = !self.partialMatching - let self.lastCol = -1 - call setline('.', self.restorePrompt(self.lastPattern)) - call feedkeys("\", 'n') - "call self.onCursorMovedI() -endfunction - -" -function s:handlerBase.onRecallPattern(shift) - let patterns = map(copy(self.stats), 'v:val.pattern') - if !exists('self.indexRecall') - let self.indexRecall = -1 - endif - let self.indexRecall += a:shift - if self.indexRecall < 0 - let self.indexRecall = -1 - elseif self.indexRecall >= len(patterns) - let self.indexRecall = len(patterns) - 1 - else - call setline('.', self.getPrompt() . patterns[self.indexRecall]) - call feedkeys("\", 'n') - endif -endfunction - -" }}}1 -"============================================================================= -" INITIALIZATION {{{1 - -augroup FufGlobal - autocmd! - autocmd BufLeave * let s:bufferCursorPosMap[bufnr('')] = getpos('.') -augroup END - -let s:bufferCursorPosMap = {} - -" -let s:DATA_FILE_VERSION = 400 - -" -function s:checkDataFileCompatibility() - if empty(g:fuf_dataDir) - let s:dataFileAvailable = 0 - return - endif - let versionPath = l9#concatPaths([g:fuf_dataDir, 'VERSION']) - let lines = l9#readFile(versionPath) - if empty(lines) - call l9#writeFile([s:DATA_FILE_VERSION], versionPath) - let s:dataFileAvailable = 1 - elseif str2nr(lines[0]) == s:DATA_FILE_VERSION - let s:dataFileAvailable = 1 - else - call fuf#echoWarning(printf( - \ "=======================================================\n" . - \ " Existing data files for FuzzyFinder is no longer \n" . - \ " compatible with this version of FuzzyFinder. Remove \n" . - \ " %-53s\n" . - \ "=======================================================\n" , - \ string(g:fuf_dataDir))) - call l9#inputHl('Question', 'Press Enter') - let s:dataFileAvailable = 0 - endif -endfunction - -call s:checkDataFileCompatibility() - -" }}}1 -"============================================================================= -" vim: set fdm=marker: - diff --git a/bundle/fuzzyfinder/autoload/fuf/bookmarkdir.vim b/bundle/fuzzyfinder/autoload/fuf/bookmarkdir.vim deleted file mode 100644 index 01585ff..0000000 --- a/bundle/fuzzyfinder/autoload/fuf/bookmarkdir.vim +++ /dev/null @@ -1,163 +0,0 @@ -"============================================================================= -" Copyright (c) 2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" GLOBAL FUNCTIONS {{{1 - -" -function fuf#bookmarkdir#createHandler(base) - return a:base.concretize(copy(s:handler)) -endfunction - -" -function fuf#bookmarkdir#getSwitchOrder() - return g:fuf_bookmarkdir_switchOrder -endfunction - -" -function fuf#bookmarkdir#getEditableDataNames() - return ['items'] -endfunction - -" -function fuf#bookmarkdir#renewCache() -endfunction - -" -function fuf#bookmarkdir#requiresOnCommandPre() - return 0 -endfunction - -" -function fuf#bookmarkdir#onInit() - call fuf#defineLaunchCommand('FufBookmarkDir', s:MODE_NAME, '""', []) - command! -bang -narg=? FufBookmarkDirAdd call s:bookmark() -endfunction - -" }}}1 -"============================================================================= -" LOCAL FUNCTIONS/VARIABLES {{{1 - -let s:MODE_NAME = expand(':t:r') -let s:OPEN_TYPE_DELETE = -1 - -" -function s:bookmark(word) - let item = { - \ 'time' : localtime(), - \ } - - let item.path = l9#inputHl('Question', '[fuf] Directory to bookmark:', - \ fnamemodify(getcwd(), ':p:~'), 'dir') - if item.path !~ '\S' - call fuf#echoWarning('Canceled') - return - endif - let item.word = l9#inputHl('Question', '[fuf] Bookmark as:', - \ fnamemodify(getcwd(), ':p:~')) - if item.word !~ '\S' - call fuf#echoWarning('Canceled') - return - endif - let items = fuf#loadDataFile(s:MODE_NAME, 'items') - call insert(items, item) - call fuf#saveDataFile(s:MODE_NAME, 'items', items) -endfunction - -" -function s:findItem(items, word) - for item in a:items - if item.word ==# a:word - return item - endif - endfor - return {} -endfunction - -" }}}1 -"============================================================================= -" s:handler {{{1 - -let s:handler = {} - -" -function s:handler.getModeName() - return s:MODE_NAME -endfunction - -" -function s:handler.getPrompt() - return fuf#formatPrompt(g:fuf_bookmarkdir_prompt, self.partialMatching, '') -endfunction - -" -function s:handler.getPreviewHeight() - return 0 -endfunction - -" -function s:handler.isOpenable(enteredPattern) - return 1 -endfunction - -" -function s:handler.makePatternSet(patternBase) - return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath', - \ self.partialMatching) -endfunction - -" -function s:handler.makePreviewLines(word, count) - return [] -endfunction - -" -function s:handler.getCompleteItems(patternPrimary) - return self.items -endfunction - -" -function s:handler.onOpen(word, mode) - if a:mode ==# s:OPEN_TYPE_DELETE - let items = fuf#loadDataFile(s:MODE_NAME, 'items') - call filter(items, 'v:val.word !=# a:word') - call fuf#saveDataFile(s:MODE_NAME, 'items', items) - let self.reservedMode = self.getModeName() - return - else - let item = s:findItem(fuf#loadDataFile(s:MODE_NAME, 'items'), a:word) - if !empty(item) - execute ':cd ' . fnameescape(item.path) - endif - endif -endfunction - -" -function s:handler.onModeEnterPre() -endfunction - -" -function s:handler.onModeEnterPost() - call fuf#defineKeyMappingInHandler(g:fuf_bookmarkdir_keyDelete, - \ 'onCr(' . s:OPEN_TYPE_DELETE . ')') - let self.items = fuf#loadDataFile(s:MODE_NAME, 'items') - call map(self.items, 'fuf#makeNonPathItem(v:val.word, strftime(g:fuf_timeFormat, v:val.time))') - call fuf#mapToSetSerialIndex(self.items, 1) - call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') -endfunction - -" -function s:handler.onModeLeavePost(opened) -endfunction - -" }}}1 -"============================================================================= -" vim: set fdm=marker: diff --git a/bundle/fuzzyfinder/autoload/fuf/bookmarkfile.vim b/bundle/fuzzyfinder/autoload/fuf/bookmarkfile.vim deleted file mode 100644 index 12ac80f..0000000 --- a/bundle/fuzzyfinder/autoload/fuf/bookmarkfile.vim +++ /dev/null @@ -1,199 +0,0 @@ -"============================================================================= -" Copyright (c) 2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" GLOBAL FUNCTIONS {{{1 - -" -function fuf#bookmarkfile#createHandler(base) - return a:base.concretize(copy(s:handler)) -endfunction - -" -function fuf#bookmarkfile#getSwitchOrder() - return g:fuf_bookmarkfile_switchOrder -endfunction - -" -function fuf#bookmarkfile#getEditableDataNames() - return ['items'] -endfunction - -" -function fuf#bookmarkfile#renewCache() -endfunction - -" -function fuf#bookmarkfile#requiresOnCommandPre() - return 0 -endfunction - -" -function fuf#bookmarkfile#onInit() - call fuf#defineLaunchCommand('FufBookmarkFile', s:MODE_NAME, '""', []) - command! -bang -narg=? FufBookmarkFileAdd call s:bookmarkHere() - command! -bang -narg=0 -range FufBookmarkFileAddAsSelectedText call s:bookmarkHere(l9#getSelectedText()) -endfunction - -" }}}1 -"============================================================================= -" LOCAL FUNCTIONS/VARIABLES {{{1 - -let s:MODE_NAME = expand(':t:r') -let s:OPEN_TYPE_DELETE = -1 - -" opens a:path and jumps to the line matching to a:pattern from a:lnum within -" a:range. if not found, jumps to a:lnum. -function s:jumpToBookmark(path, mode, pattern, lnum) - call fuf#openFile(a:path, a:mode, g:fuf_reuseWindow) - call cursor(s:getMatchingLineNumber(getline(1, '$'), a:pattern, a:lnum), 0) - normal! zvzz -endfunction - -" -function s:getMatchingLineNumber(lines, pattern, lnumBegin) - let l = min([a:lnumBegin, len(a:lines)]) - for [l0, l1] in map(range(0, g:fuf_bookmarkfile_searchRange), - \ '[l + v:val, l - v:val]') - if l0 <= len(a:lines) && a:lines[l0 - 1] =~# a:pattern - return l0 - elseif l1 >= 0 && a:lines[l1 - 1] =~# a:pattern - return l1 - endif - endfor - return l -endfunction - -" -function s:getLinePattern(lnum) - return '\C\V\^' . escape(getline(a:lnum), '\') . '\$' -endfunction - -" -function s:bookmarkHere(word) - if !empty(&buftype) || expand('%') !~ '\S' - call fuf#echoWarning('Can''t bookmark this buffer.') - return - endif - let item = { - \ 'word' : (a:word =~# '\S' ? substitute(a:word, '\n', ' ', 'g') - \ : pathshorten(expand('%:p:~')) . '|' . line('.') . '| ' . getline('.')), - \ 'path' : expand('%:p'), - \ 'lnum' : line('.'), - \ 'pattern' : s:getLinePattern(line('.')), - \ 'time' : localtime(), - \ } - let item.word = l9#inputHl('Question', '[fuf] Bookmark as:', item.word) - if item.word !~ '\S' - call fuf#echoWarning('Canceled') - return - endif - let items = fuf#loadDataFile(s:MODE_NAME, 'items') - call insert(items, item) - call fuf#saveDataFile(s:MODE_NAME, 'items', items) -endfunction - -" -function s:findItem(items, word) - for item in a:items - if item.word ==# a:word - return item - endif - endfor - return {} -endfunction - -" }}}1 -"============================================================================= -" s:handler {{{1 - -let s:handler = {} - -" -function s:handler.getModeName() - return s:MODE_NAME -endfunction - -" -function s:handler.getPrompt() - return fuf#formatPrompt(g:fuf_bookmarkfile_prompt, self.partialMatching, '') -endfunction - -" -function s:handler.getPreviewHeight() - return g:fuf_previewHeight -endfunction - -" -function s:handler.isOpenable(enteredPattern) - return 1 -endfunction - -" -function s:handler.makePatternSet(patternBase) - return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath', - \ self.partialMatching) -endfunction - -" -function s:handler.makePreviewLines(word, count) - let item = s:findItem(fuf#loadDataFile(s:MODE_NAME, 'items'), a:word) - let lines = fuf#getFileLines(item.path) - if empty(lines) - return [] - endif - let index = s:getMatchingLineNumber(lines, item.pattern, item.lnum) - 1 - return fuf#makePreviewLinesAround( - \ lines, [index], a:count, self.getPreviewHeight()) -endfunction - -" -function s:handler.getCompleteItems(patternPrimary) - return self.items -endfunction - -" -function s:handler.onOpen(word, mode) - if a:mode ==# s:OPEN_TYPE_DELETE - let items = fuf#loadDataFile(s:MODE_NAME, 'items') - call filter(items, 'v:val.word !=# a:word') - call fuf#saveDataFile(s:MODE_NAME, 'items', items) - let self.reservedMode = self.getModeName() - return - else - let item = s:findItem(fuf#loadDataFile(s:MODE_NAME, 'items'), a:word) - if !empty(item) - call s:jumpToBookmark(item.path, a:mode, item.pattern, item.lnum) - endif - endif -endfunction - -" -function s:handler.onModeEnterPre() -endfunction - -" -function s:handler.onModeEnterPost() - call fuf#defineKeyMappingInHandler(g:fuf_bookmarkfile_keyDelete, - \ 'onCr(' . s:OPEN_TYPE_DELETE . ')') - let self.items = fuf#loadDataFile(s:MODE_NAME, 'items') - call map(self.items, 'fuf#makeNonPathItem(v:val.word, strftime(g:fuf_timeFormat, v:val.time))') - call fuf#mapToSetSerialIndex(self.items, 1) - call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') -endfunction - -" -function s:handler.onModeLeavePost(opened) -endfunction - -" }}}1 -"============================================================================= -" vim: set fdm=marker: diff --git a/bundle/fuzzyfinder/autoload/fuf/buffer.vim b/bundle/fuzzyfinder/autoload/fuf/buffer.vim deleted file mode 100644 index 08b954a..0000000 --- a/bundle/fuzzyfinder/autoload/fuf/buffer.vim +++ /dev/null @@ -1,189 +0,0 @@ -"============================================================================= -" Copyright (c) 2007-2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" GLOBAL FUNCTIONS {{{1 - -" -function fuf#buffer#createHandler(base) - return a:base.concretize(copy(s:handler)) -endfunction - -" -function fuf#buffer#getSwitchOrder() - return g:fuf_buffer_switchOrder -endfunction - -" -function fuf#buffer#getEditableDataNames() - return [] -endfunction - -" -function fuf#buffer#renewCache() -endfunction - -" -function fuf#buffer#requiresOnCommandPre() - return 0 -endfunction - -" -function fuf#buffer#onInit() - call fuf#defineLaunchCommand('FufBuffer', s:MODE_NAME, '""', []) - augroup fuf#buffer - autocmd! - autocmd BufEnter * call s:updateBufTimes() - autocmd BufWritePost * call s:updateBufTimes() - augroup END -endfunction - -" }}}1 -"============================================================================= -" LOCAL FUNCTIONS/VARIABLES {{{1 - -let s:MODE_NAME = expand(':t:r') -let s:OPEN_TYPE_DELETE = -1 - -let s:bufTimes = {} - -" -function s:updateBufTimes() - let s:bufTimes[bufnr('%')] = localtime() -endfunction - -" -function s:makeItem(nr) - let fname = (empty(bufname(a:nr)) - \ ? '[No Name]' - \ : fnamemodify(bufname(a:nr), ':p:~:.')) - let time = (exists('s:bufTimes[a:nr]') ? s:bufTimes[a:nr] : 0) - let item = fuf#makePathItem(fname, strftime(g:fuf_timeFormat, time), 0) - let item.index = a:nr - let item.bufNr = a:nr - let item.time = time - let item.abbrPrefix = s:getBufIndicator(a:nr) . ' ' - return item -endfunction - -" -function s:getBufIndicator(bufNr) - if !getbufvar(a:bufNr, '&modifiable') - return '[-]' - elseif getbufvar(a:bufNr, '&modified') - return '[+]' - elseif getbufvar(a:bufNr, '&readonly') - return '[R]' - else - return ' ' - endif -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:findItem(items, word) - for item in a:items - if item.word ==# a:word - return item - endif - endfor - return {} -endfunction - -" }}}1 -"============================================================================= -" s:handler {{{1 - -let s:handler = {} - -" -function s:handler.getModeName() - return s:MODE_NAME -endfunction - -" -function s:handler.getPrompt() - return fuf#formatPrompt(g:fuf_buffer_prompt, self.partialMatching, '') -endfunction - -" -function s:handler.getPreviewHeight() - return g:fuf_previewHeight -endfunction - -" -function s:handler.isOpenable(enteredPattern) - return 1 -endfunction - -" -function s:handler.makePatternSet(patternBase) - return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath', - \ self.partialMatching) -endfunction - -" -function s:handler.makePreviewLines(word, count) - let item = s:findItem(self.items, a:word) - if empty(item) - return [] - endif - return fuf#makePreviewLinesForFile(item.bufNr, a:count, self.getPreviewHeight()) -endfunction - -" -function s:handler.getCompleteItems(patternPrimary) - return self.items -endfunction - -" -function s:handler.onOpen(word, mode) - " not use bufnr(a:word) in order to handle unnamed buffer - let item = s:findItem(self.items, a:word) - if empty(item) - " do nothing - elseif a:mode ==# s:OPEN_TYPE_DELETE - execute item.bufNr . 'bdelete' - let self.reservedMode = self.getModeName() - else - call fuf#openBuffer(item.bufNr, a:mode, g:fuf_reuseWindow) - endif -endfunction - -" -function s:handler.onModeEnterPre() -endfunction - -" -function s:handler.onModeEnterPost() - call fuf#defineKeyMappingInHandler(g:fuf_buffer_keyDelete, - \ 'onCr(' . s:OPEN_TYPE_DELETE . ')') - let self.items = range(1, bufnr('$')) - call filter(self.items, 'buflisted(v:val) && v:val != self.bufNrPrev && v:val != bufnr("%")') - call map(self.items, 's:makeItem(v:val)') - if g:fuf_buffer_mruOrder - call sort(self.items, 's:compareTimeDescending') - call fuf#mapToSetSerialIndex(self.items, 1) - endif - let self.items = fuf#mapToSetAbbrWithSnippedWordAsPath(self.items) -endfunction - -" -function s:handler.onModeLeavePost(opened) -endfunction - -" }}}1 -"============================================================================= -" vim: set fdm=marker: diff --git a/bundle/fuzzyfinder/autoload/fuf/buffertag.vim b/bundle/fuzzyfinder/autoload/fuf/buffertag.vim deleted file mode 100644 index 392b996..0000000 --- a/bundle/fuzzyfinder/autoload/fuf/buffertag.vim +++ /dev/null @@ -1,300 +0,0 @@ -"============================================================================= -" Copyright (c) 2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" GLOBAL FUNCTIONS {{{1 - -" -function fuf#buffertag#createHandler(base) - return a:base.concretize(copy(s:handler)) -endfunction - -" -function fuf#buffertag#getSwitchOrder() - return g:fuf_buffertag_switchOrder -endfunction - -" -function fuf#buffertag#getEditableDataNames() - return [] -endfunction - -" -function fuf#buffertag#renewCache() - let s:tagItemsCache = {} - let s:tagDataCache = {} -endfunction - -" -function fuf#buffertag#requiresOnCommandPre() - return 0 -endfunction - -" -function fuf#buffertag#onInit() - call fuf#defineLaunchCommand('FufBufferTag', s:MODE_NAME, '""', - \ [['g:fuf_buffertag_forAll', 0]]) - call fuf#defineLaunchCommand('FufBufferTagAll', s:MODE_NAME, '""', - \ [['g:fuf_buffertag_forAll', 1]]) - call fuf#defineLaunchCommand('FufBufferTagWithCursorWord', s:MODE_NAME, - \ 'expand('''')', [['g:fuf_buffertag_forAll', 0]]) - call fuf#defineLaunchCommand('FufBufferTagAllWithCursorWord', s:MODE_NAME, - \ 'expand('''')', [['g:fuf_buffertag_forAll', 1]]) - call fuf#defineLaunchCommand('FufBufferTagWithSelectedText', s:MODE_NAME, - \ 'l9#getSelectedText()', [['g:fuf_buffertag_forAll', 0]]) - call fuf#defineLaunchCommand('FufBufferTagAllWithSelectedText', s:MODE_NAME, - \ 'l9#getSelectedText()', [['g:fuf_buffertag_forAll', 1]]) - call l9#defineVariableDefault('g:fuf_buffertag_forAll', 0) " private option - " the following settings originate from taglist.vim - call l9#defineVariableDefault('g:fuf_buffertag__asm' , '--language-force=asm --asm-types=dlmt') - call l9#defineVariableDefault('g:fuf_buffertag__aspperl' , '--language-force=asp --asp-types=fsv') - call l9#defineVariableDefault('g:fuf_buffertag__aspvbs' , '--language-force=asp --asp-types=fsv') - call l9#defineVariableDefault('g:fuf_buffertag__awk' , '--language-force=awk --awk-types=f') - call l9#defineVariableDefault('g:fuf_buffertag__beta' , '--language-force=beta --beta-types=fsv') - call l9#defineVariableDefault('g:fuf_buffertag__c' , '--language-force=c --c-types=dgsutvf') - call l9#defineVariableDefault('g:fuf_buffertag__cpp' , '--language-force=c++ --c++-types=nvdtcgsuf') - call l9#defineVariableDefault('g:fuf_buffertag__cs' , '--language-force=c# --c#-types=dtncEgsipm') - call l9#defineVariableDefault('g:fuf_buffertag__cobol' , '--language-force=cobol --cobol-types=dfgpPs') - call l9#defineVariableDefault('g:fuf_buffertag__eiffel' , '--language-force=eiffel --eiffel-types=cf') - call l9#defineVariableDefault('g:fuf_buffertag__erlang' , '--language-force=erlang --erlang-types=drmf') - call l9#defineVariableDefault('g:fuf_buffertag__expect' , '--language-force=tcl --tcl-types=cfp') - call l9#defineVariableDefault('g:fuf_buffertag__fortran' , '--language-force=fortran --fortran-types=pbceiklmntvfs') - call l9#defineVariableDefault('g:fuf_buffertag__html' , '--language-force=html --html-types=af') - call l9#defineVariableDefault('g:fuf_buffertag__java' , '--language-force=java --java-types=pcifm') - call l9#defineVariableDefault('g:fuf_buffertag__javascript', '--language-force=javascript --javascript-types=f') - call l9#defineVariableDefault('g:fuf_buffertag__lisp' , '--language-force=lisp --lisp-types=f') - call l9#defineVariableDefault('g:fuf_buffertag__lua' , '--language-force=lua --lua-types=f') - call l9#defineVariableDefault('g:fuf_buffertag__make' , '--language-force=make --make-types=m') - call l9#defineVariableDefault('g:fuf_buffertag__pascal' , '--language-force=pascal --pascal-types=fp') - call l9#defineVariableDefault('g:fuf_buffertag__perl' , '--language-force=perl --perl-types=clps') - call l9#defineVariableDefault('g:fuf_buffertag__php' , '--language-force=php --php-types=cdvf') - call l9#defineVariableDefault('g:fuf_buffertag__python' , '--language-force=python --python-types=cmf') - call l9#defineVariableDefault('g:fuf_buffertag__rexx' , '--language-force=rexx --rexx-types=s') - call l9#defineVariableDefault('g:fuf_buffertag__ruby' , '--language-force=ruby --ruby-types=cfFm') - call l9#defineVariableDefault('g:fuf_buffertag__scheme' , '--language-force=scheme --scheme-types=sf') - call l9#defineVariableDefault('g:fuf_buffertag__sh' , '--language-force=sh --sh-types=f') - call l9#defineVariableDefault('g:fuf_buffertag__csh' , '--language-force=sh --sh-types=f') - call l9#defineVariableDefault('g:fuf_buffertag__zsh' , '--language-force=sh --sh-types=f') - call l9#defineVariableDefault('g:fuf_buffertag__slang' , '--language-force=slang --slang-types=nf') - call l9#defineVariableDefault('g:fuf_buffertag__sml' , '--language-force=sml --sml-types=ecsrtvf') - call l9#defineVariableDefault('g:fuf_buffertag__sql' , '--language-force=sql --sql-types=cFPrstTvfp') - call l9#defineVariableDefault('g:fuf_buffertag__tcl' , '--language-force=tcl --tcl-types=cfmp') - call l9#defineVariableDefault('g:fuf_buffertag__vera' , '--language-force=vera --vera-types=cdefgmpPtTvx') - call l9#defineVariableDefault('g:fuf_buffertag__verilog' , '--language-force=verilog --verilog-types=mcPertwpvf') - call l9#defineVariableDefault('g:fuf_buffertag__vim' , '--language-force=vim --vim-types=avf') - call l9#defineVariableDefault('g:fuf_buffertag__yacc' , '--language-force=yacc --yacc-types=l') -endfunction - -" }}}1 -"============================================================================= -" LOCAL FUNCTIONS/VARIABLES {{{1 - -let s:MODE_NAME = expand(':t:r') - -" -function s:parseTagLine(line) - " tag W:\Win32\SRC7\NCSIM\NCVW32\CUBEFACE.H /^#define CUBEFACE_H$/;" macro line:4 - let fields = matchlist(a:line, '\v^([^\t]+)\t(.+)\t\/\^(.+)\$\/\;\"\t(.+)\tline\:(\d+)') - if empty(fields) - return {} - endif - return { - \ 'tag' : fields[1], - \ 'fname' : fields[2], - \ 'pattern': fields[3], - \ 'kind' : fields[4], - \ 'lnum' : str2nr(fields[5]), - \ } -endfunction - -" -let s:TEMP_VARIABLES_GROUP = expand(':p') - -" -function s:getFileType(bufNr) - let ft = getbufvar(a:bufNr, '&filetype') - if !empty(ft) || bufloaded(a:bufNr) - return ft - endif - let ft = getbufvar(a:bufNr, 'fuf_buffertag_filetype') - if !empty(ft) - return ft - endif - call l9#tempvariables#set(s:TEMP_VARIABLES_GROUP, '&eventignore', 'FileType') - call l9#tempvariables#set(s:TEMP_VARIABLES_GROUP, '&filetype', &filetype) - " from taglist.vim - execute 'doautocmd filetypedetect BufRead ' . bufname(a:bufNr) - let ft = &filetype - call l9#tempvariables#end(s:TEMP_VARIABLES_GROUP) - call setbufvar(a:bufNr, 'fuf_buffertag_filetype', ft) - return ft -endfunction - -" -function s:makeCtagsCmd(bufNr) - let ft = s:getFileType(a:bufNr) - if !exists('g:fuf_buffertag__{ft}') - return '' - endif - " - let cmd = join([g:fuf_buffertag_ctagsPath, - \ '-f - --sort=no --excmd=pattern --fields=nKs', - \ g:fuf_buffertag__{ft}, - \ shellescape(fnamemodify(bufname(a:bufNr), ':p'))]) - return cmd -endfunction - -" -function s:getTagItems(bufNr) - let cmd = s:makeCtagsCmd(a:bufNr) - if empty(cmd) - return [] - elseif !exists('s:tagItemsCache[cmd]') || - \ s:tagItemsCache[cmd].time < getftime(expand(bufname(a:bufNr))) - let items = split(system(cmd), "\n") - if v:shell_error - call fuf#echoError([cmd] + items) - throw "Command error" - endif - call map(items, 's:parseTagLine(v:val)') - call filter(items, '!empty(v:val)') - let s:tagItemsCache[cmd] = { - \ 'time' : localtime(), - \ 'items' : items, - \ } - endif - return s:tagItemsCache[cmd].items -endfunction - -" -function s:makeItem(tag, itemMap) - let menu = fnamemodify(a:itemMap[a:tag][0].fname, ':t') - \ . ' [' . a:itemMap[a:tag][0].kind . ']' - if len(a:itemMap[a:tag]) > 1 - let menu .= ' (' . len(a:itemMap[a:tag]) . ')' - endif - let item = fuf#makeNonPathItem(a:tag, menu) - return item -endfunction - -" -function s:getTagData(bufNrs) - let key = join([0] + sort(copy(a:bufNrs)), "\n") - let bufNames = map(copy(a:bufNrs), 'bufname(v:val)') - if !exists('s:tagDataCache[key]') || - \ fuf#countModifiedFiles(bufNames, s:tagDataCache[key].time) > 0 - let itemMap = {} - for item in l9#concat(map(copy(a:bufNrs), 's:getTagItems(v:val)')) - if !exists('itemMap[item.tag]') - let itemMap[item.tag] = [] - endif - call add(itemMap[item.tag], item) - endfor - let items = sort(keys(itemMap)) - call map(items, 's:makeItem(v:val, itemMap)') - call fuf#mapToSetSerialIndex(items, 1) - call map(items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') - let s:tagDataCache[key] = { - \ 'time' : localtime(), - \ 'itemMap': itemMap, - \ 'items' : items, - \ } - endif - return [s:tagDataCache[key].items, s:tagDataCache[key].itemMap] -endfunction - -" -function s:jumpToTag(item, mode) - call fuf#openFile(a:item.fname, a:mode, g:fuf_reuseWindow) - call cursor(a:item.lnum, 1) - normal! zvzz -endfunction - -" }}}1 -"============================================================================= -" s:handler {{{1 - -let s:handler = {} - -" -function s:handler.getModeName() - return s:MODE_NAME -endfunction - -" -function s:handler.getPrompt() - return fuf#formatPrompt(g:fuf_buffertag_prompt, self.partialMatching, '') -endfunction - -" -function s:handler.getPreviewHeight() - return 0 -endfunction - -" -function s:handler.isOpenable(enteredPattern) - return 1 -endfunction - -" -function s:handler.makePatternSet(patternBase) - return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath', - \ self.partialMatching) -endfunction - -" -function s:handler.makePreviewLines(word, count) - return [] -endfunction - -" -function s:handler.getCompleteItems(patternPrimary) - return self.items -endfunction - -" -function s:handler.onOpen(word, mode) - if !exists('self.itemMap[a:word][0]') - call fuf#echoError('Definition not found:' . a:word) - return - elseif len(self.itemMap[a:word]) == 1 - let i = 0 - else - let list = map(fuf#mapToSetSerialIndex(copy(self.itemMap[a:word]), 1), - \ 'printf(" %2d: %s|%d| [%s] %s",v:val.index, fnamemodify(v:val.fname, ":~:."), v:val.lnum, v:val.kind, v:val.pattern)') - let i = inputlist(['Select a definition of "' . a:word . '":'] + list) - 1 - endif - if 0 <= i && i < len(self.itemMap[a:word]) - call s:jumpToTag(self.itemMap[a:word][i], a:mode) - endif -endfunction - -" -function s:handler.onModeEnterPre() -endfunction - -" -function s:handler.onModeEnterPost() - if g:fuf_buffertag_forAll - let bufNrs = filter(range(1, bufnr('$')), 'buflisted(v:val)') - else - let bufNrs = [self.bufNrPrev] - endif - let [self.items, self.itemMap] = s:getTagData(bufNrs) -endfunction - -" -function s:handler.onModeLeavePost(opened) -endfunction - -" }}}1 -"============================================================================= -" vim: set fdm=marker: diff --git a/bundle/fuzzyfinder/autoload/fuf/callbackfile.vim b/bundle/fuzzyfinder/autoload/fuf/callbackfile.vim deleted file mode 100644 index fedf0cf..0000000 --- a/bundle/fuzzyfinder/autoload/fuf/callbackfile.vim +++ /dev/null @@ -1,137 +0,0 @@ -"============================================================================= -" Copyright (c) 2007-2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" GLOBAL FUNCTIONS {{{1 - -" -function fuf#callbackfile#createHandler(base) - return a:base.concretize(copy(s:handler)) -endfunction - -" -function fuf#callbackfile#getSwitchOrder() - return -1 -endfunction - -" -function fuf#callbackfile#getEditableDataNames() - return [] -endfunction - -" -function fuf#callbackfile#renewCache() - let s:cache = {} -endfunction - -" -function fuf#callbackfile#requiresOnCommandPre() - return 0 -endfunction - -" -function fuf#callbackfile#onInit() -endfunction - -" -function fuf#callbackfile#launch(initialPattern, partialMatching, prompt, exclude, listener) - let s:prompt = (empty(a:prompt) ? '>' : a:prompt) - let s:exclude = a:exclude - let s:listener = a:listener - call fuf#launch(s:MODE_NAME, a:initialPattern, a:partialMatching) -endfunction - -" }}}1 -"============================================================================= -" LOCAL FUNCTIONS/VARIABLES {{{1 - -let s:MODE_NAME = expand(':t:r') - -" -function s:enumItems(dir) - let key = getcwd() . g:fuf_ignoreCase . s:exclude . "\n" . a:dir - if !exists('s:cache[key]') - let s:cache[key] = fuf#enumExpandedDirsEntries(a:dir, s:exclude) - if isdirectory(a:dir) - call insert(s:cache[key], fuf#makePathItem(a:dir . '.', '', 0)) - endif - call fuf#mapToSetSerialIndex(s:cache[key], 1) - call fuf#mapToSetAbbrWithSnippedWordAsPath(s:cache[key]) - endif - return s:cache[key] -endfunction - -" }}}1 -"============================================================================= -" s:handler {{{1 - -let s:handler = {} - -" -function s:handler.getModeName() - return s:MODE_NAME -endfunction - -" -function s:handler.getPrompt() - return fuf#formatPrompt(s:prompt, self.partialMatching, '') -endfunction - -" -function s:handler.getPreviewHeight() - return g:fuf_previewHeight -endfunction - -" -function s:handler.isOpenable(enteredPattern) - return a:enteredPattern =~# '[^/\\]$' -endfunction - -" -function s:handler.makePatternSet(patternBase) - return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPathTail', - \ self.partialMatching) -endfunction - -" -function s:handler.makePreviewLines(word, count) - return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight()) -endfunction - -" -function s:handler.getCompleteItems(patternPrimary) - let items = copy(s:enumItems(fuf#splitPath(a:patternPrimary).head)) - return filter(items, 'bufnr("^" . v:val.word . "$") != self.bufNrPrev') -endfunction - -" -function s:handler.onOpen(word, mode) - call s:listener.onComplete(a:word, a:mode) -endfunction - -" -function s:handler.onModeEnterPre() -endfunction - -" -function s:handler.onModeEnterPost() -endfunction - -" -function s:handler.onModeLeavePost(opened) - if !a:opened && exists('s:listener.onAbort()') - call s:listener.onAbort() - endif -endfunction - -" }}}1 -"============================================================================= -" vim: set fdm=marker: diff --git a/bundle/fuzzyfinder/autoload/fuf/callbackitem.vim b/bundle/fuzzyfinder/autoload/fuf/callbackitem.vim deleted file mode 100644 index 118ee08..0000000 --- a/bundle/fuzzyfinder/autoload/fuf/callbackitem.vim +++ /dev/null @@ -1,139 +0,0 @@ -"============================================================================= -" Copyright (c) 2007-2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" GLOBAL FUNCTIONS {{{1 - -" -function fuf#callbackitem#createHandler(base) - return a:base.concretize(copy(s:handler)) -endfunction - -" -function fuf#callbackitem#getSwitchOrder() - return -1 -endfunction - -" -function fuf#callbackitem#getEditableDataNames() - return [] -endfunction - -" -function fuf#callbackitem#renewCache() -endfunction - -" -function fuf#callbackitem#requiresOnCommandPre() - return 0 -endfunction - -" -function fuf#callbackitem#onInit() -endfunction - -" -function fuf#callbackitem#launch(initialPattern, partialMatching, prompt, listener, items, forPath) - let s:prompt = (empty(a:prompt) ? '>' : a:prompt) - let s:listener = a:listener - let s:forPath = a:forPath - let s:items = copy(a:items) - if s:forPath - call map(s:items, 'fuf#makePathItem(v:val, "", 1)') - call fuf#mapToSetSerialIndex(s:items, 1) - call fuf#mapToSetAbbrWithSnippedWordAsPath(s:items) - else - call map(s:items, 'fuf#makeNonPathItem(v:val, "")') - call fuf#mapToSetSerialIndex(s:items, 1) - call map(s:items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') - endif - call fuf#launch(s:MODE_NAME, a:initialPattern, a:partialMatching) -endfunction - -" }}}1 -"============================================================================= -" LOCAL FUNCTIONS/VARIABLES {{{1 - -let s:MODE_NAME = expand(':t:r') - -" }}}1 -"============================================================================= -" s:handler {{{1 - -let s:handler = {} - -" -function s:handler.getModeName() - return s:MODE_NAME -endfunction - -" -function s:handler.getPrompt() - return fuf#formatPrompt(s:prompt, self.partialMatching, '') -endfunction - -" -function s:handler.getPreviewHeight() - if s:forPath - return g:fuf_previewHeight - endif - return 0 -endfunction - -" -function s:handler.isOpenable(enteredPattern) - return 1 -endfunction - -" -function s:handler.makePatternSet(patternBase) - let parser = (s:forPath - \ ? 's:interpretPrimaryPatternForPath' - \ : 's:interpretPrimaryPatternForNonPath') - return fuf#makePatternSet(a:patternBase, parser, self.partialMatching) -endfunction - -" -function s:handler.makePreviewLines(word, count) - if s:forPath - return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight()) - endif - return [] -endfunction - -" -function s:handler.getCompleteItems(patternPrimary) - return s:items -endfunction - -" -function s:handler.onOpen(word, mode) - call s:listener.onComplete(a:word, a:mode) -endfunction - -" -function s:handler.onModeEnterPre() -endfunction - -" -function s:handler.onModeEnterPost() -endfunction - -" -function s:handler.onModeLeavePost(opened) - if !a:opened && exists('s:listener.onAbort()') - call s:listener.onAbort() - endif -endfunction - -" }}}1 -"============================================================================= -" vim: set fdm=marker: diff --git a/bundle/fuzzyfinder/autoload/fuf/changelist.vim b/bundle/fuzzyfinder/autoload/fuf/changelist.vim deleted file mode 100644 index 545f6ca..0000000 --- a/bundle/fuzzyfinder/autoload/fuf/changelist.vim +++ /dev/null @@ -1,172 +0,0 @@ -"============================================================================= -" Copyright (c) 2007-2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" GLOBAL FUNCTIONS {{{1 - -" -function fuf#changelist#createHandler(base) - return a:base.concretize(copy(s:handler)) -endfunction - -" -function fuf#changelist#getSwitchOrder() - return g:fuf_changelist_switchOrder -endfunction - -" -function fuf#changelist#getEditableDataNames() - return [] -endfunction - -" -function fuf#changelist#renewCache() -endfunction - -" -function fuf#changelist#requiresOnCommandPre() - return 0 -endfunction - -" -function fuf#changelist#onInit() - call fuf#defineLaunchCommand('FufChangeList', s:MODE_NAME, '""', []) -endfunction - -" }}}1 -"============================================================================= -" LOCAL FUNCTIONS/VARIABLES {{{1 - -let s:MODE_NAME = expand(':t:r') - -" -function s:getChangesLines() - redir => result - :silent changes - redir END - return split(result, "\n") -endfunction - -" -function s:parseChangesLine(line) - " return matchlist(a:line, '^\(.\)\s\+\(\d\+\)\s\(.*\)$') - let elements = matchlist(a:line, '\v^(.)\s*(\d+)\s+(\d+)\s+(\d+)\s*(.*)$') - if empty(elements) - return {} - endif - return { - \ 'prefix': elements[1], - \ 'count' : elements[2], - \ 'lnum' : elements[3], - \ 'text' : printf('|%d:%d|%s', elements[3], elements[4], elements[5]), - \ } -endfunction - -" -function s:makeItem(line) - let parsed = s:parseChangesLine(a:line) - if empty(parsed) - return {} - endif - let item = fuf#makeNonPathItem(parsed.text, '') - let item.abbrPrefix = parsed.prefix - let item.lnum = parsed.lnum - return item -endfunction - -" }}}1 -"============================================================================= -" s:handler {{{1 - -let s:handler = {} - -" -function s:handler.getModeName() - return s:MODE_NAME -endfunction - -" -function s:handler.getPrompt() - return fuf#formatPrompt(g:fuf_changelist_prompt, self.partialMatching, '') -endfunction - -" -function s:handler.getPreviewHeight() - return g:fuf_previewHeight -endfunction - -" -function s:handler.isOpenable(enteredPattern) - return 1 -endfunction - -" -function s:handler.makePatternSet(patternBase) - return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath', - \ self.partialMatching) -endfunction - -" -function s:handler.makePreviewLines(word, count) - let items = filter(copy(self.items), 'v:val.word ==# a:word') - if empty(items) - return [] - endif - let lines = fuf#getFileLines(self.bufNrPrev) - return fuf#makePreviewLinesAround( - \ lines, [items[0].lnum - 1], a:count, self.getPreviewHeight()) -endfunction - -" -function s:handler.getCompleteItems(patternPrimary) - return self.items -endfunction - -" -function s:handler.onOpen(word, mode) - call fuf#prejump(a:mode) - let older = 0 - for line in reverse(s:getChangesLines()) - if stridx(line, '>') == 0 - let older = 1 - endif - let parsed = s:parseChangesLine(line) - if !empty(parsed) && parsed.text ==# a:word - if parsed.count != 0 - execute 'normal! ' . parsed.count . (older ? 'g;' : 'g,') . 'zvzz' - endif - break - endif - endfor -endfunction - -" -function s:handler.onModeEnterPre() - let self.items = s:getChangesLines() -endfunction - -" -function s:handler.onModeEnterPost() - call map(self.items, 's:makeItem(v:val)') - call filter(self.items, '!empty(v:val)') - call reverse(self.items) - call fuf#mapToSetSerialIndex(self.items, 1) - call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') -endfunction - -" -function s:handler.onModeLeavePost(opened) -endfunction - -" }}}1 -"============================================================================= -" vim: set fdm=marker: - diff --git a/bundle/fuzzyfinder/autoload/fuf/coveragefile.vim b/bundle/fuzzyfinder/autoload/fuf/coveragefile.vim deleted file mode 100644 index 1471ef8..0000000 --- a/bundle/fuzzyfinder/autoload/fuf/coveragefile.vim +++ /dev/null @@ -1,199 +0,0 @@ -"============================================================================= -" Copyright (c) 2007-2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" GLOBAL FUNCTIONS {{{1 - -" -function fuf#coveragefile#createHandler(base) - return a:base.concretize(copy(s:handler)) -endfunction - -" -function fuf#coveragefile#getSwitchOrder() - return g:fuf_coveragefile_switchOrder -endfunction - -" -function fuf#coveragefile#getEditableDataNames() - return ['coverages'] -endfunction - -" -function fuf#coveragefile#renewCache() - let s:cache = {} -endfunction - -" -function fuf#coveragefile#requiresOnCommandPre() - return 0 -endfunction - -" -function fuf#coveragefile#onInit() - call fuf#defineLaunchCommand('FufCoverageFile', s:MODE_NAME, '""', []) - call l9#defineVariableDefault('g:fuf_coveragefile_name', '') " private option - command! -bang -narg=0 FufCoverageFileRegister call s:registerCoverage() - command! -bang -narg=? FufCoverageFileChange call s:changeCoverage() -endfunction - -" }}}1 -"============================================================================= -" LOCAL FUNCTIONS/VARIABLES {{{1 - -let s:MODE_NAME = expand(':t:r') - -" -function s:enumItems() - let key = join([getcwd(), g:fuf_ignoreCase, g:fuf_coveragefile_exclude, - \ g:fuf_coveragefile_globPatterns], "\n") - if !exists('s:cache[key]') - let s:cache[key] = l9#concat(map(copy(g:fuf_coveragefile_globPatterns), - \ 'fuf#glob(v:val)')) - call filter(s:cache[key], 'filereadable(v:val)') " filter out directories - call map(s:cache[key], 'fuf#makePathItem(fnamemodify(v:val, ":~:."), "", 0)') - if len(g:fuf_coveragefile_exclude) - call filter(s:cache[key], 'v:val.word !~ g:fuf_coveragefile_exclude') - endif - call fuf#mapToSetSerialIndex(s:cache[key], 1) - call fuf#mapToSetAbbrWithSnippedWordAsPath(s:cache[key]) - endif - return s:cache[key] -endfunction - -" -function s:registerCoverage() - let patterns = [] - while 1 - let pattern = l9#inputHl('Question', '[fuf] Glob pattern for coverage ( and end):', - \ '', 'file') - if pattern !~ '\S' - break - endif - call add(patterns, pattern) - endwhile - if empty(patterns) - call fuf#echoWarning('Canceled') - return - endif - echo '[fuf] patterns: ' . string(patterns) - let name = l9#inputHl('Question', '[fuf] Coverage name:') - if name !~ '\S' - call fuf#echoWarning('Canceled') - return - endif - let coverages = fuf#loadDataFile(s:MODE_NAME, 'coverages') - call insert(coverages, {'name': name, 'patterns': patterns}) - call fuf#saveDataFile(s:MODE_NAME, 'coverages', coverages) -endfunction - -" -function s:createChangeCoverageListener() - let listener = {} - - function listener.onComplete(name, method) - call s:changeCoverage(a:name) - endfunction - - return listener -endfunction - -" -function s:changeCoverage(name) - let coverages = fuf#loadDataFile(s:MODE_NAME, 'coverages') - if a:name !~ '\S' - let names = map(copy(coverages), 'v:val.name') - call fuf#callbackitem#launch('', 0, '>Coverage>', s:createChangeCoverageListener(), names, 0) - return - else - let name = a:name - endif - call filter(coverages, 'v:val.name ==# name') - if empty(coverages) - call fuf#echoError('Coverage not found: ' . name) - return - endif - call fuf#setOneTimeVariables( - \ ['g:fuf_coveragefile_globPatterns', coverages[0].patterns], - \ ['g:fuf_coveragefile_name' , a:name] - \ ) - FufCoverageFile -endfunction - -" }}}1 -"============================================================================= -" s:handler {{{1 - -let s:handler = {} - -" -function s:handler.getModeName() - return s:MODE_NAME -endfunction - -" -function s:handler.getPrompt() - let nameString = (empty(g:fuf_coveragefile_name) ? '' - \ : '[' . g:fuf_coveragefile_name . ']') - return fuf#formatPrompt(g:fuf_coveragefile_prompt, self.partialMatching, - \ nameString) -endfunction - -" -function s:handler.getPreviewHeight() - return g:fuf_previewHeight -endfunction - -" -function s:handler.isOpenable(enteredPattern) - return 1 -endfunction - -" -function s:handler.makePatternSet(patternBase) - return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath', - \ self.partialMatching) -endfunction - -" -function s:handler.makePreviewLines(word, count) - return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight()) -endfunction - -" -function s:handler.getCompleteItems(patternPrimary) - return self.items -endfunction - -" -function s:handler.onOpen(word, mode) - call fuf#openFile(a:word, a:mode, g:fuf_reuseWindow) -endfunction - -" -function s:handler.onModeEnterPre() -endfunction - -" -function s:handler.onModeEnterPost() - " NOTE: Comparing filenames is faster than bufnr('^' . fname . '$') - let bufNamePrev = fnamemodify(bufname(self.bufNrPrev), ':~:.') - let self.items = copy(s:enumItems()) - call filter(self.items, 'v:val.word !=# bufNamePrev') -endfunction - -" -function s:handler.onModeLeavePost(opened) -endfunction - -" }}}1 -"============================================================================= -" vim: set fdm=marker: diff --git a/bundle/fuzzyfinder/autoload/fuf/dir.vim b/bundle/fuzzyfinder/autoload/fuf/dir.vim deleted file mode 100644 index 5316093..0000000 --- a/bundle/fuzzyfinder/autoload/fuf/dir.vim +++ /dev/null @@ -1,132 +0,0 @@ -"============================================================================= -" Copyright (c) 2007-2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" GLOBAL FUNCTIONS {{{1 - -" -function fuf#dir#createHandler(base) - return a:base.concretize(copy(s:handler)) -endfunction - -" -function fuf#dir#getSwitchOrder() - return g:fuf_dir_switchOrder -endfunction - -" -function fuf#dir#getEditableDataNames() - return [] -endfunction - -" -function fuf#dir#renewCache() - let s:cache = {} -endfunction - -" -function fuf#dir#requiresOnCommandPre() - return 0 -endfunction - -" -function fuf#dir#onInit() - call fuf#defineLaunchCommand('FufDir' , s:MODE_NAME, '""', []) - call fuf#defineLaunchCommand('FufDirWithFullCwd' , s:MODE_NAME, 'fnamemodify(getcwd(), '':p'')', []) - call fuf#defineLaunchCommand('FufDirWithCurrentBufferDir', s:MODE_NAME, 'expand(''%:~:.'')[:-1-len(expand(''%:~:.:t''))]', []) -endfunction - -" }}}1 -"============================================================================= -" LOCAL FUNCTIONS/VARIABLES {{{1 - -let s:MODE_NAME = expand(':t:r') - -" -function s:enumItems(dir) - let key = getcwd() . g:fuf_ignoreCase . g:fuf_dir_exclude . "\n" . a:dir - if !exists('s:cache[key]') - let s:cache[key] = fuf#enumExpandedDirsEntries(a:dir, g:fuf_dir_exclude) - call filter(s:cache[key], 'v:val.word =~# ''[/\\]$''') - if isdirectory(a:dir) - call insert(s:cache[key], fuf#makePathItem(a:dir . '.', '', 0)) - endif - call fuf#mapToSetSerialIndex(s:cache[key], 1) - call fuf#mapToSetAbbrWithSnippedWordAsPath(s:cache[key]) - endif - return s:cache[key] -endfunction - -" }}}1 -"============================================================================= -" s:handler {{{1 - -let s:handler = {} - -" -function s:handler.getModeName() - return s:MODE_NAME -endfunction - -" -function s:handler.getPrompt() - return fuf#formatPrompt(g:fuf_dir_prompt, self.partialMatching, '') -endfunction - -" -function s:handler.getPreviewHeight() - return g:fuf_previewHeight -endfunction - -" -function s:handler.isOpenable(enteredPattern) - return a:enteredPattern =~# '[^/\\]$' -endfunction - -" -function s:handler.makePatternSet(patternBase) - return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPathTail', - \ self.partialMatching) -endfunction - -" -function s:handler.makePreviewLines(word, count) - return fuf#makePreviewLinesAround( - \ fuf#glob(fnamemodify(a:word, ':p') . '*'), - \ [], a:count, self.getPreviewHeight()) - return -endfunction - -" -function s:handler.getCompleteItems(patternPrimary) - return s:enumItems(fuf#splitPath(a:patternPrimary).head) -endfunction - -" -function s:handler.onOpen(word, mode) - execute ':cd ' . fnameescape(a:word) -endfunction - -" -function s:handler.onModeEnterPre() -endfunction - -" -function s:handler.onModeEnterPost() -endfunction - -" -function s:handler.onModeLeavePost(opened) -endfunction - -" }}}1 -"============================================================================= -" vim: set fdm=marker: diff --git a/bundle/fuzzyfinder/autoload/fuf/file.vim b/bundle/fuzzyfinder/autoload/fuf/file.vim deleted file mode 100644 index 1569192..0000000 --- a/bundle/fuzzyfinder/autoload/fuf/file.vim +++ /dev/null @@ -1,139 +0,0 @@ -"============================================================================= -" Copyright (c) 2007-2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" GLOBAL FUNCTIONS {{{1 - -" -function fuf#file#createHandler(base) - return a:base.concretize(copy(s:handler)) -endfunction - -" -function fuf#file#getSwitchOrder() - return g:fuf_file_switchOrder -endfunction - -" -function fuf#file#getEditableDataNames() - return [] -endfunction - -" -function fuf#file#renewCache() - let s:cache = {} -endfunction - -" -function fuf#file#requiresOnCommandPre() - return 0 -endfunction - -" -function fuf#file#onInit() - call fuf#defineLaunchCommand('FufFile' , s:MODE_NAME, '""', []) - call fuf#defineLaunchCommand('FufFileWithFullCwd' , s:MODE_NAME, 'fnamemodify(getcwd(), '':p'')', []) - call fuf#defineLaunchCommand('FufFileWithCurrentBufferDir', s:MODE_NAME, 'expand(''%:~:.'')[:-1-len(expand(''%:~:.:t''))]', []) -endfunction - -" }}}1 -"============================================================================= -" LOCAL FUNCTIONS/VARIABLES {{{1 - -let s:MODE_NAME = expand(':t:r') - -" -function s:enumItems(dir) - let key = join([getcwd(), g:fuf_ignoreCase, g:fuf_file_exclude, a:dir], "\n") - if !exists('s:cache[key]') - let s:cache[key] = fuf#enumExpandedDirsEntries(a:dir, g:fuf_file_exclude) - call fuf#mapToSetSerialIndex(s:cache[key], 1) - call fuf#mapToSetAbbrWithSnippedWordAsPath(s:cache[key]) - endif - return s:cache[key] -endfunction - -" -function s:enumNonCurrentItems(dir, bufNrPrev, cache) - let key = a:dir . 'AVOIDING EMPTY KEY' - if !exists('a:cache[key]') - " NOTE: Comparing filenames is faster than bufnr('^' . fname . '$') - let bufNamePrev = bufname(a:bufNrPrev) - let a:cache[key] = - \ filter(copy(s:enumItems(a:dir)), 'v:val.word !=# bufNamePrev') - endif - return a:cache[key] -endfunction - -" }}}1 -"============================================================================= -" s:handler {{{1 - -let s:handler = {} - -" -function s:handler.getModeName() - return s:MODE_NAME -endfunction - -" -function s:handler.getPrompt() - return fuf#formatPrompt(g:fuf_file_prompt, self.partialMatching, '') -endfunction - -" -function s:handler.getPreviewHeight() - return g:fuf_previewHeight -endfunction - -" -function s:handler.isOpenable(enteredPattern) - return a:enteredPattern =~# '[^/\\]$' -endfunction - -" -function s:handler.makePatternSet(patternBase) - return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPathTail', - \ self.partialMatching) -endfunction - -" -function s:handler.makePreviewLines(word, count) - return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight()) -endfunction - -" -function s:handler.getCompleteItems(patternPrimary) - return s:enumNonCurrentItems( - \ fuf#splitPath(a:patternPrimary).head, self.bufNrPrev, self.cache) -endfunction - -" -function s:handler.onOpen(word, mode) - call fuf#openFile(a:word, a:mode, g:fuf_reuseWindow) -endfunction - -" -function s:handler.onModeEnterPre() -endfunction - -" -function s:handler.onModeEnterPost() - let self.cache = {} -endfunction - -" -function s:handler.onModeLeavePost(opened) -endfunction - -" }}}1 -"============================================================================= -" vim: set fdm=marker: diff --git a/bundle/fuzzyfinder/autoload/fuf/givencmd.vim b/bundle/fuzzyfinder/autoload/fuf/givencmd.vim deleted file mode 100644 index d59178c..0000000 --- a/bundle/fuzzyfinder/autoload/fuf/givencmd.vim +++ /dev/null @@ -1,123 +0,0 @@ -"============================================================================= -" Copyright (c) 2007-2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" GLOBAL FUNCTIONS {{{1 - -" -function fuf#givencmd#createHandler(base) - return a:base.concretize(copy(s:handler)) -endfunction - -" -function fuf#givencmd#getSwitchOrder() - return -1 -endfunction - -" -function fuf#givencmd#getEditableDataNames() - return [] -endfunction - -" -function fuf#givencmd#renewCache() -endfunction - -" -function fuf#givencmd#requiresOnCommandPre() - return 0 -endfunction - -" -function fuf#givencmd#onInit() -endfunction - -" -function fuf#givencmd#launch(initialPattern, partialMatching, prompt, items) - let s:prompt = (empty(a:prompt) ? '>' : a:prompt) - let s:items = copy(a:items) - call map(s:items, 'fuf#makeNonPathItem(v:val, "")') - call fuf#mapToSetSerialIndex(s:items, 1) - call map(s:items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') - call fuf#launch(s:MODE_NAME, a:initialPattern, a:partialMatching) -endfunction - -" }}}1 -"============================================================================= -" LOCAL FUNCTIONS/VARIABLES {{{1 - -let s:MODE_NAME = expand(':t:r') - -" }}}1 -"============================================================================= -" s:handler {{{1 - -let s:handler = {} - -" -function s:handler.getModeName() - return s:MODE_NAME -endfunction - -" -function s:handler.getPrompt() - return fuf#formatPrompt(s:prompt, self.partialMatching, '') -endfunction - -" -function s:handler.getPreviewHeight() - return 0 -endfunction - -" -function s:handler.isOpenable(enteredPattern) - return 1 -endfunction - -" -function s:handler.makePatternSet(patternBase) - return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath', - \ self.partialMatching) -endfunction - -" -function s:handler.makePreviewLines(word, count) - return [] -endfunction - -" -function s:handler.getCompleteItems(patternPrimary) - return s:items -endfunction - -" -function s:handler.onOpen(word, mode) - if a:word[0] =~# '[:/?]' - call histadd(a:word[0], a:word[1:]) - endif - call feedkeys(a:word . "\", 'n') -endfunction - -" -function s:handler.onModeEnterPre() -endfunction - -" -function s:handler.onModeEnterPost() -endfunction - -" -function s:handler.onModeLeavePost(opened) -endfunction - -" }}}1 -"============================================================================= -" vim: set fdm=marker: diff --git a/bundle/fuzzyfinder/autoload/fuf/givendir.vim b/bundle/fuzzyfinder/autoload/fuf/givendir.vim deleted file mode 100644 index e654d85..0000000 --- a/bundle/fuzzyfinder/autoload/fuf/givendir.vim +++ /dev/null @@ -1,123 +0,0 @@ -"============================================================================= -" Copyright (c) 2007-2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" GLOBAL FUNCTIONS {{{1 - -" -function fuf#givendir#createHandler(base) - return a:base.concretize(copy(s:handler)) -endfunction - -" -function fuf#givendir#getSwitchOrder() - return -1 -endfunction - -" -function fuf#givendir#getEditableDataNames() - return [] -endfunction - -" -function fuf#givendir#renewCache() -endfunction - -" -function fuf#givendir#requiresOnCommandPre() - return 0 -endfunction - -" -function fuf#givendir#onInit() -endfunction - -" -function fuf#givendir#launch(initialPattern, partialMatching, prompt, items) - let s:prompt = (empty(a:prompt) ? '>' : a:prompt) - let s:items = map(copy(a:items), 'substitute(v:val, ''[/\\]\?$'', "", "")') - let s:items = map(s:items, 'fuf#makePathItem(v:val, "", 0)') - call fuf#mapToSetSerialIndex(s:items, 1) - call fuf#mapToSetAbbrWithSnippedWordAsPath(s:items) - call fuf#launch(s:MODE_NAME, a:initialPattern, a:partialMatching) -endfunction - -" }}}1 -"============================================================================= -" LOCAL FUNCTIONS/VARIABLES {{{1 - -let s:MODE_NAME = expand(':t:r') - -" }}}1 -"============================================================================= -" s:handler {{{1 - -let s:handler = {} - -" -function s:handler.getModeName() - return s:MODE_NAME -endfunction - -" -function s:handler.getPrompt() - return fuf#formatPrompt(s:prompt, self.partialMatching, '') -endfunction - -" -function s:handler.getPreviewHeight() - return g:fuf_previewHeight -endfunction - -" -function s:handler.isOpenable(enteredPattern) - return 1 -endfunction - -" -function s:handler.makePatternSet(patternBase) - return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath', - \ self.partialMatching) -endfunction - -" -function s:handler.makePreviewLines(word, count) - return fuf#makePreviewLinesAround( - \ fuf#glob(fnamemodify(a:word, ':p') . '*'), - \ [], a:count, self.getPreviewHeight()) - return -endfunction - -" -function s:handler.getCompleteItems(patternPrimary) - return s:items -endfunction - -" -function s:handler.onOpen(word, mode) - execute ':cd ' . fnameescape(a:word) -endfunction - -" -function s:handler.onModeEnterPre() -endfunction - -" -function s:handler.onModeEnterPost() -endfunction - -" -function s:handler.onModeLeavePost(opened) -endfunction - -" }}}1 -"============================================================================= -" vim: set fdm=marker: diff --git a/bundle/fuzzyfinder/autoload/fuf/givenfile.vim b/bundle/fuzzyfinder/autoload/fuf/givenfile.vim deleted file mode 100644 index 5419ff8..0000000 --- a/bundle/fuzzyfinder/autoload/fuf/givenfile.vim +++ /dev/null @@ -1,121 +0,0 @@ -"============================================================================= -" Copyright (c) 2007-2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" GLOBAL FUNCTIONS {{{1 - -" -function fuf#givenfile#createHandler(base) - return a:base.concretize(copy(s:handler)) -endfunction - -" -function fuf#givenfile#getSwitchOrder() - return -1 -endfunction - -" -function fuf#givenfile#getEditableDataNames() - return [] -endfunction - -" -function fuf#givenfile#renewCache() -endfunction - -" -function fuf#givenfile#requiresOnCommandPre() - return 0 -endfunction - -" -function fuf#givenfile#onInit() -endfunction - -" -function fuf#givenfile#launch(initialPattern, partialMatching, prompt, items) - let s:prompt = (empty(a:prompt) ? '>' : a:prompt) - let s:items = map(copy(a:items), 'fuf#makePathItem(v:val, "", 0)') - call fuf#mapToSetSerialIndex(s:items, 1) - call map(s:items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') - call fuf#launch(s:MODE_NAME, a:initialPattern, a:partialMatching) -endfunction - - -" }}}1 -"============================================================================= -" LOCAL FUNCTIONS/VARIABLES {{{1 - -let s:MODE_NAME = expand(':t:r') - -" }}}1 -"============================================================================= -" s:handler {{{1 - -let s:handler = {} - -" -function s:handler.getModeName() - return s:MODE_NAME -endfunction - -" -function s:handler.getPrompt() - return fuf#formatPrompt(s:prompt, self.partialMatching, '') -endfunction - -" -function s:handler.getPreviewHeight() - return g:fuf_previewHeight -endfunction - -" -function s:handler.isOpenable(enteredPattern) - return 1 -endfunction - -" -function s:handler.makePatternSet(patternBase) - return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath', - \ self.partialMatching) -endfunction - -" -function s:handler.makePreviewLines(word, count) - return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight()) -endfunction - -" -function s:handler.getCompleteItems(patternPrimary) - return s:items -endfunction - -" -function s:handler.onOpen(word, mode) - call fuf#openFile(a:word, a:mode, g:fuf_reuseWindow) -endfunction - - -" -function s:handler.onModeEnterPre() -endfunction - -" -function s:handler.onModeEnterPost() -endfunction - -" -function s:handler.onModeLeavePost(opened) -endfunction - -" }}}1 -"============================================================================= -" vim: set fdm=marker: diff --git a/bundle/fuzzyfinder/autoload/fuf/help.vim b/bundle/fuzzyfinder/autoload/fuf/help.vim deleted file mode 100644 index 8f03e36..0000000 --- a/bundle/fuzzyfinder/autoload/fuf/help.vim +++ /dev/null @@ -1,198 +0,0 @@ -"============================================================================= -" Copyright (c) 2007-2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" GLOBAL FUNCTIONS {{{1 - -" -function fuf#help#createHandler(base) - return a:base.concretize(copy(s:handler)) -endfunction - -" -function fuf#help#getSwitchOrder() - return g:fuf_help_switchOrder -endfunction - -" -function fuf#help#getEditableDataNames() - return [] -endfunction - -" -function fuf#help#renewCache() - let s:cache = {} -endfunction - -" -function fuf#help#requiresOnCommandPre() - return 0 -endfunction - -" -function fuf#help#onInit() - call fuf#defineLaunchCommand('FufHelp' , s:MODE_NAME, '""', []) - call fuf#defineLaunchCommand('FufHelpWithCursorWord', s:MODE_NAME, 'expand('''')', []) -endfunction - -" }}}1 -"============================================================================= -" LOCAL FUNCTIONS/VARIABLES {{{1 - -let s:MODE_NAME = expand(':t:r') - -" -function s:getCurrentHelpTagFiles() - let prefix = 'doc' . l9#getPathSeparator() - let tagFiles = split(globpath(&runtimepath, prefix . 'tags' ), "\n") - \ + split(globpath(&runtimepath, prefix . 'tags-??'), "\n") - return sort(map(tagFiles, 'fnamemodify(v:val, ":p")')) -endfunction - -" -function s:parseHelpTagEntry(line, tagFile) - let elements = split(a:line, "\t") - if len(elements) != 3 || elements[0][0] ==# '!' - return {} - endif - let suffix = matchstr(a:tagFile, '-\zs..$') - if empty(suffix) - let suffix = '@en' - else - let suffix = '@' . suffix - endif - let dir = fnamemodify(a:tagFile, ':h') . l9#getPathSeparator() - return { - \ 'word' : elements[0] . suffix, - \ 'path' : dir . elements[1], - \ 'pattern': elements[2][1:], - \ } -endfunction - -" -function s:getHelpTagEntries(tagFile) - let names = map(l9#readFile(a:tagFile), 's:parseHelpTagEntry(v:val, a:tagFile)') - return filter(names, '!empty(v:val)') -endfunction - -" -function s:parseHelpTagFiles(tagFiles, key) - let cacheName = 'cache-' . l9#hash224(a:key) - let cacheTime = fuf#getDataFileTime(s:MODE_NAME, cacheName) - if cacheTime != -1 && fuf#countModifiedFiles(a:tagFiles, cacheTime) == 0 - return fuf#loadDataFile(s:MODE_NAME, cacheName) - endif - let items = l9#unique(l9#concat(map(copy(a:tagFiles), 's:getHelpTagEntries(v:val)'))) - let items = map(items, 'extend(v:val, fuf#makeNonPathItem(v:val.word, ""))') - call fuf#mapToSetSerialIndex(items, 1) - let items = map(items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') - call fuf#saveDataFile(s:MODE_NAME, cacheName, items) - return items -endfunction - -" -function s:enumHelpTags(tagFiles) - if !len(a:tagFiles) - return [] - endif - let key = join([g:fuf_ignoreCase] + a:tagFiles, "\n") - if !exists('s:cache[key]') || fuf#countModifiedFiles(a:tagFiles, s:cache[key].time) - let s:cache[key] = { - \ 'time' : localtime(), - \ 'items' : s:parseHelpTagFiles(a:tagFiles, key) - \ } - endif - return s:cache[key].items -endfunction - -" -function s:getMatchingIndex(lines, pattern) - if empty(a:pattern) - return -1 - endif - for i in range(len(a:lines)) - if stridx(a:lines[i], a:pattern) >= 0 - return i - endif - endfor - return -1 -endfunction - -" }}}1 -"============================================================================= -" s:handler {{{1 - -let s:handler = {} - -" -function s:handler.getModeName() - return s:MODE_NAME -endfunction - -" -function s:handler.getPrompt() - return fuf#formatPrompt(g:fuf_help_prompt, self.partialMatching, '') -endfunction - -" -function s:handler.getPreviewHeight() - return g:fuf_previewHeight -endfunction - -" -function s:handler.isOpenable(enteredPattern) - return 1 -endfunction - -" -function s:handler.makePatternSet(patternBase) - return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath', - \ self.partialMatching) -endfunction - -" -function s:handler.makePreviewLines(word, count) - let items = filter(copy(s:enumHelpTags(self.tagFiles)), 'v:val.word ==# a:word') - if empty(items) - return [] - endif - let lines = fuf#getFileLines(items[0].path) - let index = s:getMatchingIndex(lines, items[0].pattern) - return [items[0].path . ':'] + fuf#makePreviewLinesAround( - \ lines, (index < 0 ? [] : [index]), a:count, self.getPreviewHeight() - 1) -endfunction - -" -function s:handler.getCompleteItems(patternPrimary) - return s:enumHelpTags(self.tagFiles) -endfunction - -" -function s:handler.onOpen(word, mode) - call fuf#openHelp(a:word, a:mode) -endfunction - -" -function s:handler.onModeEnterPre() - let self.tagFiles = s:getCurrentHelpTagFiles() -endfunction - -" -function s:handler.onModeEnterPost() -endfunction - -" -function s:handler.onModeLeavePost(opened) -endfunction - -" }}}1 -"============================================================================= -" vim: set fdm=marker: diff --git a/bundle/fuzzyfinder/autoload/fuf/jumplist.vim b/bundle/fuzzyfinder/autoload/fuf/jumplist.vim deleted file mode 100644 index ddbb1ab..0000000 --- a/bundle/fuzzyfinder/autoload/fuf/jumplist.vim +++ /dev/null @@ -1,182 +0,0 @@ -"============================================================================= -" Copyright (c) 2007-2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" GLOBAL FUNCTIONS {{{1 - -" -function fuf#jumplist#createHandler(base) - return a:base.concretize(copy(s:handler)) -endfunction - -" -function fuf#jumplist#getSwitchOrder() - return g:fuf_jumplist_switchOrder -endfunction - -" -function fuf#jumplist#getEditableDataNames() - return [] -endfunction - -" -function fuf#jumplist#renewCache() -endfunction - -" -function fuf#jumplist#requiresOnCommandPre() - return 0 -endfunction - -" -function fuf#jumplist#onInit() - call fuf#defineLaunchCommand('FufJumpList', s:MODE_NAME, '""', []) -endfunction - -" }}}1 -"============================================================================= -" LOCAL FUNCTIONS/VARIABLES {{{1 - -let s:MODE_NAME = expand(':t:r') - -" -function s:getJumpsLines() - redir => result - :silent jumps - redir END - return split(result, "\n") -endfunction - -" -function s:parseJumpsLine(line, bufnrPrev) - "return matchlist(a:line, '^\(.\)\s\+\(\d\+\)\s\(.*\)$') - let elements = matchlist(a:line, '\v^(.)\s*(\d+)\s+(\d+)\s+(\d+)\s*(.*)$') - if empty(elements) - return {} - endif - let linePrevBuffer = join(getbufline(a:bufnrPrev, elements[3])) - if stridx(linePrevBuffer, elements[5]) >= 0 - let fname = bufname(a:bufnrPrev) - let text = elements[5] - else - let fname = elements[5] - let text = join(getbufline('^' . elements[5] . '$', elements[3])) - endif - return { - \ 'prefix': elements[1], - \ 'count' : elements[2], - \ 'lnum' : elements[3], - \ 'fname' : fname, - \ 'text' : printf('%s|%d:%d|%s', fname, elements[3], elements[4], text), - \ } -endfunction - -" -function s:makeItem(line, bufnrPrev) - let parsed = s:parseJumpsLine(a:line, a:bufnrPrev) - if empty(parsed) - return {} - endif - let item = fuf#makeNonPathItem(parsed.text, '') - let item.abbrPrefix = parsed.prefix - let item.lnum = parsed.lnum - let item.fname = parsed.fname - return item -endfunction - -" }}}1 -"============================================================================= -" s:handler {{{1 - -let s:handler = {} - -" -function s:handler.getModeName() - return s:MODE_NAME -endfunction - -" -function s:handler.getPrompt() - return fuf#formatPrompt(g:fuf_jumplist_prompt, self.partialMatching, '') -endfunction - -" -function s:handler.getPreviewHeight() - return g:fuf_previewHeight -endfunction - -" -function s:handler.isOpenable(enteredPattern) - return 1 -endfunction - -" -function s:handler.makePatternSet(patternBase) - return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath', - \ self.partialMatching) -endfunction - -" -function s:handler.makePreviewLines(word, count) - let items = filter(copy(self.items), 'v:val.word ==# a:word') - if empty(items) - return [] - endif - let lines = fuf#getFileLines(items[0].fname) - return fuf#makePreviewLinesAround( - \ lines, [items[0].lnum - 1], a:count, self.getPreviewHeight()) -endfunction - -" -function s:handler.getCompleteItems(patternPrimary) - return self.items -endfunction - -" -function s:handler.onOpen(word, mode) - call fuf#prejump(a:mode) - let older = 0 - for line in reverse(s:getJumpsLines()) - if stridx(line, '>') == 0 - let older = 1 - endif - let parsed = s:parseJumpsLine(line, self.bufNrPrev) - if !empty(parsed) && parsed.text ==# a:word - if parsed.count != 0 - execute 'normal! ' . parsed.count . (older ? "\" : "\") . 'zvzz' - endif - break - endif - endfor -endfunction - -" -function s:handler.onModeEnterPre() - let self.items = s:getJumpsLines() -endfunction - -" -function s:handler.onModeEnterPost() - call map(self.items, 's:makeItem(v:val, self.bufNrPrev)') - call filter(self.items, '!empty(v:val)') - call reverse(self.items) - call fuf#mapToSetSerialIndex(self.items, 1) - call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') -endfunction - -" -function s:handler.onModeLeavePost(opened) -endfunction - -" }}}1 -"============================================================================= -" vim: set fdm=marker: - diff --git a/bundle/fuzzyfinder/autoload/fuf/line.vim b/bundle/fuzzyfinder/autoload/fuf/line.vim deleted file mode 100644 index 60447b5..0000000 --- a/bundle/fuzzyfinder/autoload/fuf/line.vim +++ /dev/null @@ -1,135 +0,0 @@ -"============================================================================= -" Copyright (c) 2007-2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" GLOBAL FUNCTIONS {{{1 - -" -function fuf#line#createHandler(base) - return a:base.concretize(copy(s:handler)) -endfunction - -" -function fuf#line#getSwitchOrder() - return g:fuf_line_switchOrder -endfunction - -" -function fuf#line#getEditableDataNames() - return [] -endfunction - -" -function fuf#line#renewCache() -endfunction - -" -function fuf#line#requiresOnCommandPre() - return 0 -endfunction - -" -function fuf#line#onInit() - call fuf#defineLaunchCommand('FufLine', s:MODE_NAME, '""', []) -endfunction - -" }}}1 -"============================================================================= -" LOCAL FUNCTIONS/VARIABLES {{{1 - -let s:MODE_NAME = expand(':t:r') -let s:OPEN_TYPE_DELETE = -1 - -" }}}1 -"============================================================================= -" s:handler {{{1 - -let s:handler = {} - -" -function s:handler.getModeName() - return s:MODE_NAME -endfunction - -" -function s:handler.getPrompt() - return fuf#formatPrompt(g:fuf_line_prompt, self.partialMatching, '') -endfunction - -" -function s:handler.getPreviewHeight() - return g:fuf_previewHeight -endfunction - -" -function s:handler.isOpenable(enteredPattern) - return 1 -endfunction - -" -function s:handler.makePatternSet(patternBase) - return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath', - \ self.partialMatching) -endfunction - -" -function s:handler.makePreviewLines(word, count) - let items = filter(copy(self.items), 'v:val.word ==# a:word') - if empty(items) - return [] - endif - let lines = fuf#getFileLines(self.bufNrPrev) - return fuf#makePreviewLinesAround( - \ lines, [items[0].index - 1], a:count, self.getPreviewHeight()) -endfunction - -" -function s:handler.getCompleteItems(patternPrimary) - return self.items -endfunction - -" -function s:handler.onOpen(word, mode) - call fuf#prejump(a:mode) - call filter(self.items, 'v:val.word ==# a:word') - if empty(self.items) - return - execute 'cc ' . self.items[0].index - endif - call cursor(self.items[0].index, 0) - normal! zvzz -endfunction - -" -function s:handler.onModeEnterPre() -endfunction - -" -function s:handler.onModeEnterPost() - let tab = repeat(' ', getbufvar(self.bufNrPrev, '&tabstop')) - let self.items = getbufline(self.bufNrPrev, 1, '$') - let lnumFormat = '%' . len(string(len(self.items) + 1)) . 'd|' - for i in range(len(self.items)) - let self.items[i] = printf(lnumFormat, i + 1) - \ . substitute(self.items[i], "\t", tab, 'g') - endfor - call map(self.items, 'fuf#makeNonPathItem(v:val, "")') - call fuf#mapToSetSerialIndex(self.items, 1) - call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 0)') -endfunction - -" -function s:handler.onModeLeavePost(opened) -endfunction - -" }}}1 -"============================================================================= -" vim: set fdm=marker: diff --git a/bundle/fuzzyfinder/autoload/fuf/mrucmd.vim b/bundle/fuzzyfinder/autoload/fuf/mrucmd.vim deleted file mode 100644 index 58632ce..0000000 --- a/bundle/fuzzyfinder/autoload/fuf/mrucmd.vim +++ /dev/null @@ -1,134 +0,0 @@ -"============================================================================= -" Copyright (c) 2007-2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" GLOBAL FUNCTIONS {{{1 - -" -function fuf#mrucmd#createHandler(base) - return a:base.concretize(copy(s:handler)) -endfunction - -" -function fuf#mrucmd#getSwitchOrder() - return g:fuf_mrucmd_switchOrder -endfunction - -" -function fuf#mrucmd#getEditableDataNames() - return ['items'] -endfunction - -" -function fuf#mrucmd#renewCache() -endfunction - -" -function fuf#mrucmd#requiresOnCommandPre() - return 1 -endfunction - -" -function fuf#mrucmd#onInit() - call fuf#defineLaunchCommand('FufMruCmd', s:MODE_NAME, '""', []) -endfunction - -" -function fuf#mrucmd#onCommandPre(cmd) - if getcmdtype() =~# '^[:/?]' - call s:updateInfo(a:cmd) - endif -endfunction - - -" }}}1 -"============================================================================= -" LOCAL FUNCTIONS/VARIABLES {{{1 - -let s:MODE_NAME = expand(':t:r') - -" -function s:updateInfo(cmd) - let items = fuf#loadDataFile(s:MODE_NAME, 'items') - let items = fuf#updateMruList( - \ items, { 'word' : a:cmd, 'time' : localtime() }, - \ g:fuf_mrucmd_maxItem, g:fuf_mrucmd_exclude) - call fuf#saveDataFile(s:MODE_NAME, 'items', items) -endfunction - -" }}}1 -"============================================================================= -" s:handler {{{1 - -let s:handler = {} - -" -function s:handler.getModeName() - return s:MODE_NAME -endfunction - -" -function s:handler.getPrompt() - return fuf#formatPrompt(g:fuf_mrucmd_prompt, self.partialMatching, '') -endfunction - -" -function s:handler.getPreviewHeight() - return 0 -endfunction - -" -function s:handler.isOpenable(enteredPattern) - return 1 -endfunction - -" -function s:handler.makePatternSet(patternBase) - return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath', - \ self.partialMatching) -endfunction - -" -function s:handler.makePreviewLines(word, count) - return [] -endfunction - -" -function s:handler.getCompleteItems(patternPrimary) - return self.items -endfunction - -" -function s:handler.onOpen(word, mode) - call s:updateInfo(a:word) - call histadd(a:word[0], a:word[1:]) - call feedkeys(a:word . "\", 'n') -endfunction - -" -function s:handler.onModeEnterPre() -endfunction - -" -function s:handler.onModeEnterPost() - let self.items = fuf#loadDataFile(s:MODE_NAME, 'items') - call map(self.items, 'fuf#makeNonPathItem(v:val.word, strftime(g:fuf_timeFormat, v:val.time))') - call fuf#mapToSetSerialIndex(self.items, 1) - call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') -endfunction - -" -function s:handler.onModeLeavePost(opened) -endfunction - -" }}}1 -"============================================================================= -" vim: set fdm=marker: diff --git a/bundle/fuzzyfinder/autoload/fuf/mrufile.vim b/bundle/fuzzyfinder/autoload/fuf/mrufile.vim deleted file mode 100644 index f90b9e3..0000000 --- a/bundle/fuzzyfinder/autoload/fuf/mrufile.vim +++ /dev/null @@ -1,234 +0,0 @@ -"============================================================================= -" Copyright (c) 2007-2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" GLOBAL FUNCTIONS {{{1 - -" -function fuf#mrufile#createHandler(base) - return a:base.concretize(copy(s:handler)) -endfunction - -" -function fuf#mrufile#getSwitchOrder() - return g:fuf_mrufile_switchOrder -endfunction - -" -function fuf#mrufile#getEditableDataNames() - return ['items', 'itemdirs'] -endfunction - -" -function fuf#mrufile#renewCache() - let s:cache = {} - let s:aroundCache = {} -endfunction - -" -function fuf#mrufile#requiresOnCommandPre() - return 0 -endfunction - -" -function fuf#mrufile#onInit() - call fuf#defineLaunchCommand('FufMruFile', s:MODE_NAME, '""', []) - call fuf#defineLaunchCommand('FufMruFileInCwd', s:MODE_NAME, - \ '""', [['g:fuf_mrufile_underCwd', 1]]) - call l9#defineVariableDefault('g:fuf_mrufile_underCwd', 0) " private option - call l9#defineVariableDefault('g:fuf_mrufile_searchAroundLevel', -1) " private option - augroup fuf#mrufile - autocmd! - autocmd BufEnter * call s:updateData() - autocmd BufWritePost * call s:updateData() - augroup END -endfunction - -" }}}1 -"============================================================================= -" LOCAL FUNCTIONS/VARIABLES {{{1 - -let s:MODE_NAME = expand(':t:r') -let s:OPEN_TYPE_EXPAND = -1 - -" -function s:updateData() - if !empty(&buftype) || !filereadable(expand('%')) - return - endif - let items = fuf#loadDataFile(s:MODE_NAME, 'items') - let items = fuf#updateMruList( - \ items, { 'word' : expand('%:p'), 'time' : localtime() }, - \ g:fuf_mrufile_maxItem, g:fuf_mrufile_exclude) - call fuf#saveDataFile(s:MODE_NAME, 'items', items) - call s:removeItemFromCache(expand('%:p')) - let itemDirs = fuf#loadDataFile(s:MODE_NAME, 'itemdirs') - let itemDirs = fuf#updateMruList( - \ itemDirs, { 'word' : expand('%:p:h') }, - \ g:fuf_mrufile_maxItemDir, g:fuf_mrufile_exclude) - call fuf#saveDataFile(s:MODE_NAME, 'itemdirs', itemDirs) -endfunction - -" -function s:removeItemFromCache(word) - for items in values(s:cache) - if exists('items[a:word]') - unlet items[a:word] - endif - endfor -endfunction - -" returns empty value if invalid item -function s:formatItemUsingCache(item) - if a:item.word !~ '\S' - return {} - endif - if !exists('s:cache[a:item.word]') - if filereadable(a:item.word) - let s:cache[a:item.word] = fuf#makePathItem( - \ fnamemodify(a:item.word, ':p:~'), strftime(g:fuf_timeFormat, a:item.time), 0) - else - let s:cache[a:item.word] = {} - endif - endif - return s:cache[a:item.word] -endfunction - -" -function s:expandSearchDir(dir, level) - let dirs = [a:dir] - let dirPrev = a:dir - for i in range(a:level) - let dirPrev = l9#concatPaths([dirPrev, '*']) - call add(dirs, dirPrev) - endfor - let dirPrev = a:dir - for i in range(a:level) - let dirPrevPrev = dirPrev - let dirPrev = fnamemodify(dirPrev, ':h') - if dirPrevPrev ==# dirPrev - break - endif - call add(dirs, dirPrev) - endfor - return dirs -endfunction - -" -function s:listAroundFiles(dir) - if !exists('s:aroundCache[a:dir]') - let s:aroundCache[a:dir] = [a:dir] + - \ fuf#glob(l9#concatPaths([a:dir, '*' ])) + - \ fuf#glob(l9#concatPaths([a:dir, '.*'])) - call filter(s:aroundCache[a:dir], 'filereadable(v:val)') - call map(s:aroundCache[a:dir], 'fuf#makePathItem(fnamemodify(v:val, ":~"), "", 0)') - if len(g:fuf_mrufile_exclude) - call filter(s:aroundCache[a:dir], 'v:val.word !~ g:fuf_mrufile_exclude') - endif - endif - return s:aroundCache[a:dir] -endfunction - -" }}}1 -"============================================================================= -" s:handler {{{1 - -let s:handler = {} - -" -function s:handler.getModeName() - return s:MODE_NAME -endfunction - -" -function s:handler.getPrompt() - let cwdString = (g:fuf_mrufile_underCwd ? '[CWD]' : '') - let levelString = (g:fuf_mrufile_searchAroundLevel < 0 ? '' - \ : '[Around:' . g:fuf_mrufile_searchAroundLevel . ']') - return fuf#formatPrompt(g:fuf_mrufile_prompt, self.partialMatching, cwdString . levelString) -endfunction - -" -function s:handler.getPreviewHeight() - return g:fuf_previewHeight -endfunction - -" -function s:handler.isOpenable(enteredPattern) - return 1 -endfunction - -" -function s:handler.makePatternSet(patternBase) - return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath', - \ self.partialMatching) -endfunction - -" -function s:handler.makePreviewLines(word, count) - return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight()) -endfunction - -" -function s:handler.getCompleteItems(patternPrimary) - return self.items -endfunction - -" -function s:handler.onOpen(word, mode) - if a:mode ==# s:OPEN_TYPE_EXPAND - let nextLevel = (self.searchAroundLevel < 0 ? 0 : self.searchAroundLevel + 1) - call fuf#setOneTimeVariables(['g:fuf_mrufile_searchAroundLevel', nextLevel]) - let self.reservedMode = self.getModeName() - return - else - call fuf#openFile(a:word, a:mode, g:fuf_reuseWindow) - endif -endfunction - -" -function s:handler.onModeEnterPre() -endfunction - -" -function s:handler.onModeEnterPost() - let self.searchAroundLevel = g:fuf_mrufile_searchAroundLevel - call fuf#defineKeyMappingInHandler(g:fuf_mrufile_keyExpand, - \ 'onCr(' . s:OPEN_TYPE_EXPAND . ')') - if self.searchAroundLevel < 0 - let self.items = fuf#loadDataFile(s:MODE_NAME, 'items') - call map(self.items, 's:formatItemUsingCache(v:val)') - else - let self.items = fuf#loadDataFile(s:MODE_NAME, 'itemdirs') - call map(self.items, 's:expandSearchDir(v:val.word, g:fuf_mrufile_searchAroundLevel)') - let self.items = l9#concat(self.items) - let self.items = l9#unique(self.items) - call map(self.items, 's:listAroundFiles(v:val)') - let self.items = l9#concat(self.items) - endif - " NOTE: Comparing filenames is faster than bufnr('^' . fname . '$') - let bufNamePrev = fnamemodify(bufname(self.bufNrPrev), ':p:~') - call filter(self.items, '!empty(v:val) && v:val.word !=# bufNamePrev') - if g:fuf_mrufile_underCwd - let cwd = fnamemodify(getcwd(), ':p:~') - call filter(self.items, 'stridx(v:val.word, cwd) == 0') - endif - call fuf#mapToSetSerialIndex(self.items, 1) - call fuf#mapToSetAbbrWithSnippedWordAsPath(self.items) -endfunction - -" -function s:handler.onModeLeavePost(opened) -endfunction - -" }}}1 -"============================================================================= -" vim: set fdm=marker: diff --git a/bundle/fuzzyfinder/autoload/fuf/quickfix.vim b/bundle/fuzzyfinder/autoload/fuf/quickfix.vim deleted file mode 100644 index dd5d67c..0000000 --- a/bundle/fuzzyfinder/autoload/fuf/quickfix.vim +++ /dev/null @@ -1,154 +0,0 @@ -"============================================================================= -" Copyright (c) 2007-2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" GLOBAL FUNCTIONS {{{1 - -" -function fuf#quickfix#createHandler(base) - return a:base.concretize(copy(s:handler)) -endfunction - -" -function fuf#quickfix#getSwitchOrder() - return g:fuf_quickfix_switchOrder -endfunction - -" -function fuf#quickfix#getEditableDataNames() - return [] -endfunction - -" -function fuf#quickfix#renewCache() -endfunction - -" -function fuf#quickfix#requiresOnCommandPre() - return 0 -endfunction - -" -function fuf#quickfix#onInit() - call fuf#defineLaunchCommand('FufQuickfix', s:MODE_NAME, '""', []) -endfunction - -" }}}1 -"============================================================================= -" LOCAL FUNCTIONS/VARIABLES {{{1 - -let s:MODE_NAME = expand(':t:r') - -" -function s:getJumpsLines() - redir => result - :silent jumps - redir END - return split(result, "\n") -endfunction - -" -function s:parseJumpsLine(line) - return matchlist(a:line, '^\(.\)\s\+\(\d\+\)\s\(.*\)$') -endfunction - -" -function s:makeItem(qfItem) - if !a:qfItem.valid - return {} - endif - let item = fuf#makeNonPathItem( - \ printf('%s|%d:%d|%s', bufname(a:qfItem.bufnr), a:qfItem.lnum, - \ a:qfItem.col, matchstr(a:qfItem.text, '\s*\zs.*\S')) - \ , '') - let item.bufnr = a:qfItem.bufnr - let item.lnum = a:qfItem.lnum - return item -endfunction - -" }}}1 -"============================================================================= -" s:handler {{{1 - -let s:handler = {} - -" -function s:handler.getModeName() - return s:MODE_NAME -endfunction - -" -function s:handler.getPrompt() - return fuf#formatPrompt(g:fuf_quickfix_prompt, self.partialMatching, '') -endfunction - -" -function s:handler.getPreviewHeight() - return g:fuf_previewHeight -endfunction - -" -function s:handler.isOpenable(enteredPattern) - return 1 -endfunction - -" -function s:handler.makePatternSet(patternBase) - return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath', - \ self.partialMatching) -endfunction - -" -function s:handler.makePreviewLines(word, count) - let items = filter(copy(self.items), 'v:val.word ==# a:word') - if empty(items) - return [] - endif - let lines = fuf#getFileLines(items[0].bufnr) - return fuf#makePreviewLinesAround( - \ lines, [items[0].lnum - 1], a:count, self.getPreviewHeight()) -endfunction - -" -function s:handler.getCompleteItems(patternPrimary) - return self.items -endfunction - -" -function s:handler.onOpen(word, mode) - call fuf#prejump(a:mode) - call filter(self.items, 'v:val.word ==# a:word') - if !empty(self.items) - execute 'cc ' . self.items[0].index - endif -endfunction - -" -function s:handler.onModeEnterPre() -endfunction - -" -function s:handler.onModeEnterPost() - let self.items = getqflist() - call map(self.items, 's:makeItem(v:val)') - call fuf#mapToSetSerialIndex(self.items, 1) - call filter(self.items, 'exists("v:val.word")') - call map(self.items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') -endfunction - -" -function s:handler.onModeLeavePost(opened) -endfunction - -" }}}1 -"============================================================================= -" vim: set fdm=marker: - diff --git a/bundle/fuzzyfinder/autoload/fuf/tag.vim b/bundle/fuzzyfinder/autoload/fuf/tag.vim deleted file mode 100644 index 362cabf..0000000 --- a/bundle/fuzzyfinder/autoload/fuf/tag.vim +++ /dev/null @@ -1,178 +0,0 @@ -"============================================================================= -" Copyright (c) 2007-2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" GLOBAL FUNCTIONS {{{1 - -" -function fuf#tag#createHandler(base) - return a:base.concretize(copy(s:handler)) -endfunction - -" -function fuf#tag#getSwitchOrder() - return g:fuf_tag_switchOrder -endfunction - -" -function fuf#tag#getEditableDataNames() - return [] -endfunction - -" -function fuf#tag#renewCache() - let s:cache = {} -endfunction - -" -function fuf#tag#requiresOnCommandPre() - return 0 -endfunction - -" -function fuf#tag#onInit() - call fuf#defineLaunchCommand('FufTag' , s:MODE_NAME, '""', []) - call fuf#defineLaunchCommand('FufTagWithCursorWord', s:MODE_NAME, 'expand('''')', []) -endfunction - -" }}}1 -"============================================================================= -" LOCAL FUNCTIONS/VARIABLES {{{1 - -let s:MODE_NAME = expand(':t:r') - -" -function s:getTagNames(tagFile) - let names = map(l9#readFile(a:tagFile), 'matchstr(v:val, ''^[^!\t][^\t]*'')') - return filter(names, 'v:val =~# ''\S''') -endfunction - -" -function s:parseTagFiles(tagFiles, key) - let cacheName = 'cache-' . l9#hash224(a:key) - let cacheTime = fuf#getDataFileTime(s:MODE_NAME, cacheName) - if cacheTime != -1 && fuf#countModifiedFiles(a:tagFiles, cacheTime) == 0 - return fuf#loadDataFile(s:MODE_NAME, cacheName) - endif - let items = l9#unique(l9#concat(map(copy(a:tagFiles), 's:getTagNames(v:val)'))) - let items = map(items, 'fuf#makeNonPathItem(v:val, "")') - call fuf#mapToSetSerialIndex(items, 1) - let items = map(items, 'fuf#setAbbrWithFormattedWord(v:val, 1)') - call fuf#saveDataFile(s:MODE_NAME, cacheName, items) - return items -endfunction - -" -function s:enumTags(tagFiles) - if !len(a:tagFiles) - return [] - endif - let key = join([g:fuf_ignoreCase] + a:tagFiles, "\n") - if !exists('s:cache[key]') || fuf#countModifiedFiles(a:tagFiles, s:cache[key].time) - let s:cache[key] = { - \ 'time' : localtime(), - \ 'items' : s:parseTagFiles(a:tagFiles, key) - \ } - endif - return s:cache[key].items -endfunction - -" -function s:getMatchingIndex(lines, cmd) - if a:cmd !~# '\D' - return str2nr(a:cmd) - endif - let pattern = matchstr(a:cmd, '^\/\^\zs.*\ze\$\/$') - if empty(pattern) - return -1 - endif - for i in range(len(a:lines)) - if a:lines[i] ==# pattern - return i - endif - endfor - return -1 -endfunction - -" }}}1 -"============================================================================= -" s:handler {{{1 - -let s:handler = {} - -" -function s:handler.getModeName() - return s:MODE_NAME -endfunction - -" -function s:handler.getPrompt() - return fuf#formatPrompt(g:fuf_tag_prompt, self.partialMatching, '') -endfunction - -" -function s:handler.getPreviewHeight() - return g:fuf_previewHeight -endfunction - -" -function s:handler.isOpenable(enteredPattern) - return 1 -endfunction - -" -function s:handler.makePatternSet(patternBase) - return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForNonPath', - \ self.partialMatching) -endfunction - -" 'cmd' is '/^hoge hoge$/' or line number -function s:handler.makePreviewLines(word, count) - let tags = taglist('^' . a:word . '$') - if empty(tags) - return [] - endif - let i = a:count % len(tags) - let title = printf('(%d/%d) %s', i + 1, len(tags), tags[i].filename) - let lines = fuf#getFileLines(tags[i].filename) - let index = s:getMatchingIndex(lines, tags[i].cmd) - return [title] + fuf#makePreviewLinesAround( - \ lines, (index < 0 ? [] : [index]), 0, self.getPreviewHeight() - 1) -endfunction - -" -function s:handler.getCompleteItems(patternPrimary) - return s:enumTags(self.tagFiles) -endfunction - -" -function s:handler.onOpen(word, mode) - call fuf#openTag(a:word, a:mode) -endfunction - -" -function s:handler.onModeEnterPre() - let self.tagFiles = fuf#getCurrentTagFiles() -endfunction - -" -function s:handler.onModeEnterPost() - let &l:tags = join(self.tagFiles, ',') -endfunction - -" -function s:handler.onModeLeavePost(opened) - let &l:tags = '' -endfunction - -" }}}1 -"============================================================================= -" vim: set fdm=marker: diff --git a/bundle/fuzzyfinder/autoload/fuf/taggedfile.vim b/bundle/fuzzyfinder/autoload/fuf/taggedfile.vim deleted file mode 100644 index 74652fc..0000000 --- a/bundle/fuzzyfinder/autoload/fuf/taggedfile.vim +++ /dev/null @@ -1,159 +0,0 @@ -"============================================================================= -" Copyright (c) 2007-2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" GLOBAL FUNCTIONS {{{1 - -" -function fuf#taggedfile#createHandler(base) - return a:base.concretize(copy(s:handler)) -endfunction - -" -function fuf#taggedfile#getSwitchOrder() - return g:fuf_taggedfile_switchOrder -endfunction - -" -function fuf#taggedfile#getEditableDataNames() - return [] -endfunction - -" -function fuf#taggedfile#renewCache() - let s:cache = {} -endfunction - -" -function fuf#taggedfile#requiresOnCommandPre() - return 0 -endfunction - -" -function fuf#taggedfile#onInit() - call fuf#defineLaunchCommand('FufTaggedFile', s:MODE_NAME, '""', []) -endfunction - -" }}}1 -"============================================================================= -" LOCAL FUNCTIONS/VARIABLES {{{1 - -let s:MODE_NAME = expand(':t:r') - -" -function s:getTaggedFileList(tagfile) - execute 'cd ' . fnamemodify(a:tagfile, ':h') - let result = map(l9#readFile(a:tagfile), 'matchstr(v:val, ''^[^!\t][^\t]*\t\zs[^\t]\+'')') - call map(l9#readFile(a:tagfile), 'fnamemodify(v:val, ":p")') - cd - - call map(l9#readFile(a:tagfile), 'fnamemodify(v:val, ":~:.")') - return filter(result, 'v:val =~# ''[^/\\ ]$''') -endfunction - -" -function s:parseTagFiles(tagFiles, key) - let cacheName = 'cache-' . l9#hash224(a:key) - let cacheTime = fuf#getDataFileTime(s:MODE_NAME, cacheName) - if cacheTime != -1 && fuf#countModifiedFiles(a:tagFiles, cacheTime) == 0 - return fuf#loadDataFile(s:MODE_NAME, cacheName) - endif - let items = l9#unique(l9#concat(map(copy(a:tagFiles), 's:getTaggedFileList(v:val)'))) - call map(items, 'fuf#makePathItem(v:val, "", 0)') - call fuf#mapToSetSerialIndex(items, 1) - call fuf#mapToSetAbbrWithSnippedWordAsPath(items) - call fuf#saveDataFile(s:MODE_NAME, cacheName, items) - return items -endfunction - -" -function s:enumTaggedFiles(tagFiles) - if !len(a:tagFiles) - return [] - endif - let key = join([getcwd(), g:fuf_ignoreCase] + a:tagFiles, "\n") - if !exists('s:cache[key]') || fuf#countModifiedFiles(a:tagFiles, s:cache[key].time) - let s:cache[key] = { - \ 'time' : localtime(), - \ 'items' : s:parseTagFiles(a:tagFiles, key) - \ } - endif - return s:cache[key].items -endfunction - -" }}}1 -"============================================================================= -" s:handler {{{1 - -let s:handler = {} - -" -function s:handler.getModeName() - return s:MODE_NAME -endfunction - -" -function s:handler.getPrompt() - return fuf#formatPrompt(g:fuf_taggedfile_prompt, self.partialMatching, '') -endfunction - -" -function s:handler.getPreviewHeight() - return g:fuf_previewHeight -endfunction - -" -function s:handler.isOpenable(enteredPattern) - return 1 -endfunction - -" -function s:handler.makePatternSet(patternBase) - return fuf#makePatternSet(a:patternBase, 's:interpretPrimaryPatternForPath', - \ self.partialMatching) -endfunction - -" -function s:handler.makePreviewLines(word, count) - return fuf#makePreviewLinesForFile(a:word, a:count, self.getPreviewHeight()) -endfunction - -" -function s:handler.getCompleteItems(patternPrimary) - return self.items -endfunction - -" -function s:handler.onOpen(word, mode) - call fuf#openFile(a:word, a:mode, g:fuf_reuseWindow) -endfunction - -" -function s:handler.onModeEnterPre() - let self.tagFiles = fuf#getCurrentTagFiles() -endfunction - -" -function s:handler.onModeEnterPost() - " NOTE: Comparing filenames is faster than bufnr('^' . fname . '$') - let bufNamePrev = fnamemodify(bufname(self.bufNrPrev), ':p:~:.') - " NOTE: Don't do this in onModeEnterPre() - " because that should return in a short time. - let self.items = copy(s:enumTaggedFiles(self.tagFiles)) - call filter(self.items, 'v:val.word !=# bufNamePrev') -endfunction - -" -function s:handler.onModeLeavePost(opened) -endfunction - -" }}}1 -"============================================================================= -" vim: set fdm=marker: diff --git a/bundle/fuzzyfinder/doc/fuf.txt b/bundle/fuzzyfinder/doc/fuf.txt deleted file mode 100644 index 2e36831..0000000 --- a/bundle/fuzzyfinder/doc/fuf.txt +++ /dev/null @@ -1,1883 +0,0 @@ -*fuf.txt* buffer/file/command/tag/etc explorer with fuzzy matching. - - Copyright (c) 2007-2010 Takeshi NISHIDA - -FuzzyFinder *fuzzyfinder* *fuf* - -INTRODUCTION |fuf-introduction| -INSTALLATION |fuf-installation| -USAGE |fuf-usage| -MODES |fuf-modes| -DETAILED TOPICS |fuf-detailed-topics| -COMMANDS |fuf-commands| -OPTIONS |fuf-options| -VIMRC EXAMPLE |fuf-vimrc-example| -SPECIAL THANKS |fuf-thanks| -CHANGELOG |fuf-changelog| -ABOUT |fuf-about| - -============================================================================== -INTRODUCTION *fuf-introduction* - -FuzzyFinder provides convenient ways to quickly reach the -buffer/file/command/bookmark/tag you want. FuzzyFinder searches with the -fuzzy/partial pattern to which it converted an entered pattern. - - Entered pattern Fuzzy pattern Partial pattern ~ -> - abc *a*b*c* *abc* - 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: - - "./AhLongLongLongLongLongFile.txt" - "./AhLongLongLongLongLongName.txt" - "./OhLongLongLongLongLongFile.txt" - "./OhLongLongLongLongLongName.txt" <- you want :O - -Type "ON" and "OhLongLongLongLongLongName.txt" will be selected. :D - -FuzzyFinder can search: - - - buffers - - files - - directories - - most recently used files - - files around most recently used files - - most recently used command-lines - - bookmarked files - - bookmarked directories - - tags - - files which are included in current tagfiles - - jump list - - change list - - buffer lines - - quickfix - - help - -FuzzyFinder also provides APIs to use its system of searching files or -selecting items. - -FuzzyFinder supports multibyte characters. - - -============================================================================== -INSTALLATION *fuf-installation* - -Put all files into your runtime directory. If you have the zip file, extract -it to your runtime directory. - -You should place the files as follows: -> - /plugin/fuf.vim - /doc/fuf.txt - ... -< -If you are disgusted to make your runtime directory confused with a lot of -plugins, put each of the plugins into a directory individually and just add -the directory path to 'runtimepath'. It's easy to uninstall plugins. - -Then update your help tags files to enable help for this plugin. See -|add-local-help| for details. - -Requirements: ~ - -- L9 library (vimscript #3252) - - -============================================================================== -USAGE *fuf-usage* - -You can launch FuzzyFinder by the following commands: - - Command Mode ~ - |:FufBuffer| - Buffer mode (|fuf-buffer-mode|) - |:FufFile| - File mode (|fuf-file-mode|) - |:FufCoverageFile| - Coverage-File mode (|fuf-coveragefile-mode|) - |:FufDir| - Directory mode (|fuf-dir-mode|) - |:FufMruFile| - MRU-File mode (|fuf-mrufile-mode|) - |:FufMruCmd| - MRU-Command mode (|fuf-mrucmd-mode|) - |:FufBookmarkFile| - Bookmark-File mode (|fuf-bookmarkfile-mode|) - |:FufBookmarkDir| - Bookmark-Dir mode (|fuf-bookmarkdir-mode|) - |:FufTag| - Tag mode (|fuf-tag-mode|) - |:FufBufferTag| - Buffer-Tag mode (|fuf-buffertag-mode|) - |:FufTaggedFile| - Tagged-File mode (|fuf-taggedfile-mode|) - |:FufJumpList| - Jump-List mode (|fuf-jumplist-mode|) - |:FufChangeList| - Change-List mode (|fuf-changelist-mode|) - |:FufQuickfix| - Quickfix mode (|fuf-quickfix-mode|) - |:FufLine| - Line mode (|fuf-line-mode|) - |:FufHelp| - Help mode (|fuf-help-mode|) - -It is recommended to map these commands. - -These commands open 1-line buffer to enter search pattern and start insert -mode. - -FuzzyFinder searchs for matching items with an entered pattern and shows them -in a completion menu. For more details on pattern matching, see -|fuf-search-patterns|. - -If there are a lot of matching items, FuzzyFinder limits the number of -enumerating items (|g:fuf_enumeratingLimit|) to speed up a response time, and -highlights the pattern with "Error" group. - -The first item in the completion menu will be selected automatically. - -Typing deletes one block of an entered pattern before the cursor, like a -directory name. - -with (|g:fuf_keyPrevPattern|) and (|g:fuf_keyNextPattern|), You -can recall patterns which have been entered before from history. - -You can open a selected item in various ways: - - (|g:fuf_keyOpen|) - opens in a previous window. - (|g:fuf_keyOpenSplit|) - opens in a split window. - (|g:fuf_keyOpenVsplit|) - opens in a vertical-split window. - (|g:fuf_keyOpenTabpage|) - opens in a new tab page. - -To cancel and return to previous window, just leave Insert mode. - -With (|g:fuf_keySwitchMatching|), You can switch search method -between fuzzy matching and partial matching. - -With (|g:fuf_keyNextMode|) and (|g:fuf_keyPrevMode|), You can -switch current mode without leaving Insert mode . - -You can preview selected item with (|g:fuf_keyPreview|) in some modes. -Repeating the key on the same item shows another information. The height -of command-line area is changed to |g:fuf_previewHeight| when you launch a -mode supporting preview. This feature is available when |g:fuf_previewHeight| -is not 0. - - -============================================================================== -MODES *fuf-modes* - - *fuf-buffer-mode* -Buffer mode ~ - -This mode provides an interface to select a buffer from a list of existing -buffers and open it. - -Press (|g:fuf_buffer_keyDelete|) in this mode and selected buffer will -be deleted. - - *fuf-file-mode* -File mode ~ - -This mode provides an interface to search a file tree for a file and open it. - - *fuf-coveragefile-mode* -Coverage-File mode ~ - -This mode provides an interface to select a file from all files of a preset -coverage and open it. - -By default, This mode lists all files under the current working directory -recursively. (|g:fuf_coveragefile_globPatterns|) - -If you want to search other coverage, execute |FufCoverageFileRegister| -command to register new search coverage and |FufCoverageFileChange| command to -choose a search coverage and launch Coverage-File mode. - -In addition, there is another way to change a search coverage with -|fuf#setOneTimeVariables()| function. - -Example: search only .h and .c files: -> - call fuf#setOneTimeVariables(['g:fuf_coveragefile_globPatterns', ['**/*.h', '**/*.c']]) - \ | FufCoverageFile -< -Example: search your home directory in addition to the default coverage: -> - call fuf#setOneTimeVariables(['g:fuf_coveragefile_globPatterns', g:fuf_coveragefile_globPatterns + ['~/**/.*', '~/**/*']]) - \ | FufCoverageFile -< - - *fuf-dir-mode* -Directory mode ~ - -This mode provides an interface to search a file tree for a directory and -change the current directory. - - *fuf-mrufile-mode* -MRU-File mode ~ - -This mode provides an interface to select a file from the most recently used -files and open it. - -Press (|g:fuf_mrufile_keyExpand|) in this mode and files around the most -recently used files are listed. Each time the key is pressed, the search range -are expanded one level along the directory tree upwardly/downwardly. - -This mode is set to disable by default (|g:fuf_modesDisable|) because -processes for this mode in |BufEnter| and |BufWritePost| could cause -Performance issue. - -See also: |FufMruFileInCwd| - - *fuf-mrucmd-mode* -MRU-Command mode ~ - -This mode provides an interface to select a command from the most recently -used commands and execute it. - -This mode is set to disable by default (|g:fuf_modesDisable|) because mapping - of Command-line mode required by this mode has side effects. - - *fuf-bookmarkfile-mode* -Bookmark-File mode ~ - -This mode provides an interface to select one of the bookmarks you have added -beforehand and jump there. - -You can add a cursor line to bookmarks by |:FufBookmarkFileAdd| command. -Execute that command and you will be prompted to enter a bookmark name. - -FuzzyFinder adjusts a line number for jump. If a line of bookmarked position -does not match to a pattern when the bookmark was added, FuzzyFinder searches -a matching line around bookmarked position. So you can jump to a bookmarked -line even if the line is out of bookmarked position. If you want to jump to -bookmarked line number without the adjustment, set -|g:fuf_bookmarkfile_searchRange| option to 0. - -Press (|g:fuf_bookmarkfile_keyDelete|) in this mode and selected -bookmark will be deleted. - - *fuf-bookmarkdir-mode* -Bookmark-Dir mode ~ - -This mode provides an interface to select one of the bookmarks you have added -beforehand and change the current directory. - -You can add a directory to bookmarks by |:FufBookmarkDirAdd| command. Execute -that command and you will be prompted to enter a directory path and a -bookmark name. - -Press (|g:fuf_bookmarkdir_keyDelete|) in this mode and selected bookmark -will be deleted. - - *fuf-tag-mode* -Tag mode ~ - -This mode provides an interface to select a tag and jump to the definition of -it. - -Following mapping is a replacement for : -> - noremap :FufTagWithCursorWord! -< - - *fuf-buffertag-mode* -Buffer-Tag mode ~ - -This mode provides an interface to select a tag of current buffer or all -buffers and jump to the definition of it. - -Tag list is instantly created when FuzzyFinder is launched, so there is no -need to make tags file in advance. - -|FufBufferTag| covers current buffer and |FufBufferTagAll| covers all buffers. - -Following mapping is a replacement for : -> - nnoremap :FufBufferTagWithCursorWord! - vnoremap :FufBufferTagAllWithSelectedText! -< -or -> - nnoremap :FufBufferTagAllWithCursorWord! - vnoremap :FufBufferTagAllWithSelectedText! -< -This mode is inspired by taglist.vim (vimscript #273) and refered its codes. - - *fuf-taggedfile-mode* -Tagged-File mode ~ - -This mode provides an interface to select one of the files which are included -in current tagfiles and open it. - - *fuf-jumplist-mode* -Jump-List mode ~ - -This mode provides an interface to select one from the |jumplist| of the -current window and jump there. - - *fuf-changelist-mode* -Change-List mode ~ - -This mode provides an interface to select one from the |changelist| of the -current buffer and jump there. - - *fuf-quickfix-mode* -Quickfix mode ~ - -This mode provides an interface to select one from the |quickfix| list and -jump there. - - *fuf-line-mode* -Line mode ~ - -This mode provides an interface to select a line from current buffer and jump -there. - - *fuf-help-mode* -Help mode ~ - -This mode provides an interface to select a help tag and jump to the help -page. - - *fuf-givenfile-mode* -Given-File mode ~ - -This mode provides an API to open a selected file from a given list. - -API function: -> - function fuf#givenfile#launch( - \ initialPattern, partialMatching, prompt, items) -< - initialPattern - String which is inserted after launching - FuzzyFinder. - partialMatching - If non-zero, enable partial matching instead of - fuzzy matching. - prompt - Prompt string - items - List of items. - -Example of use: -> - " Open one of your dotfiles. - call fuf#givenfile#launch('', 0, '>', split(glob('~/.*'), "\n")) -< - - *fuf-givendir-mode* -Given-Directory mode ~ - -This mode provides an API to change current working directory to a selected -one from a given list. - -API function: -> - function fuf#givendir#launch( - \ initialPattern, partialMatching, prompt, items) -< - initialPattern - String which is inserted after launching - FuzzyFinder. - partialMatching - If non-zero, enable partial matching instead of - fuzzy matching. - prompt - Prompt string - items - List of items. - - -Example of use: -> - " Change current working directory to one of your runtime directory. - call fuf#givendir#launch('', 0, '>', split(&runtimepath, ',')) -< - - *fuf-givencmd-mode* -Given-Command mode ~ - -This mode provides an API to execute a selected command from a given list. - -A selected command is executed by |feedkeys()|, so it is able to emulate a -series of key input in Normal mode. - -API function: -> - function fuf#givencmd#launch( - \ initialPattern, partialMatching, prompt, items) -< - initialPattern - String which is inserted after launching - FuzzyFinder. - partialMatching - If non-zero, enable partial matching instead of - fuzzy matching. - prompt - Prompt string - items - List of items. - - -Example of use: -> - function GetAllCommands() - redir => commands - silent command - redir END - return map((split(commands, "\n")[3:]), - \ '":" . matchstr(v:val, ''^....\zs\S*'')') - endfunction - - " execute one of the user-defined commands - call fuf#givencmd#launch('', 0, '>', GetAllCommands()) - -< - - *fuf-callbackfile-mode* -Callback-File mode ~ - -This mode provides an API to find and get a file path which is selected by an -user. - -API function: -> - function fuf#callbackfile#launch( - \ initialPattern, partialMatching, prompt, exclude, listener) -< - initialPattern - String which is inserted after launching - FuzzyFinder. - partialMatching - If non-zero, enable partial matching instead of - fuzzy matching. - prompt - Prompt string. - exclude - Regexp pattern for items which you want to exclude - from completion list. - listener - |Dictionary| which has 'onComplete' and 'onAbort'. - They are called at the end of FuzzyFinder. - listener.onComplete(item, method) is called with 2 - arguments which are a name of selected item and a - number of open method when completed. - listener.onAbort() is called when aborted. - -Example of use: -> - let listener = {} - - function listener.onComplete(item, method) - echo "Item: " . a:item . "\nMethod: " . a:method - endfunction - - function listener.onAbort() - echo "Abort" - endfunction - - " Find a file from current working directory. - call fuf#callbackfile#launch('', 0, '>', '', listener) - - " Find a file from home directory. - call fuf#callbackfile#launch('~/', 0, '>', '', listener) -< - - *fuf-callbackitem-mode* -Callback-Item mode ~ - -This mode provides an API to get an item which is selected from a given list -by an user. - -API function: -> - function fuf#callbackitem#launch( - \ initialPattern, partialMatching, prompt, listener, items, forPath) -< - initialPattern - String which is inserted after launching - FuzzyFinder. - partialMatching - If non-zero, enable partial matching instead of - fuzzy matching. - prompt - Prompt string - listener - |Dictionary| which has 'onComplete' and 'onAbort'. - They are called at the end of FuzzyFinder. - listener.onComplete(item, method) is called with 2 - arguments which are a name of selected item and a - number of open method when completed. - listener.onAbort() is called when aborted. - items - List of items. - forPath - If non-zero, use a matching method for files. - -Example of use: -> - let listener = {} - - function listener.onComplete(item, method) - echo "Item: " . a:item . "\nMethod: " . a:method - endfunction - - function listener.onAbort() - echo "Abort" - endfunction - - " Select an item from a given list. - call fuf#callbackitem#launch('', 0, '>', listener, ['ed', 'vi', 'vim'], 0) - - " Select a file from a given list. - call fuf#callbackitem#launch('', 0, '>', listener, ['../foo/bar', 'baz'], 1) -< - -============================================================================== -DETAILED TOPICS *fuf-detailed-topics* - - *fuf-setting-one-time-option* *fuf#setOneTimeVariables()* -Setting One-Time Options ~ - -If you want to set one-time options only for the next FuzzyFinder, -|fuf#setOneTimeVariables()| function will be of help. This function is used as -follows: -> - call fuf#setOneTimeVariables(['g:fuf_ignoreCase', 0], ['&lines', 50]) -< -This function takes 0 or more arguments and each of them is a pair of a -variable name and its value. Specified options will be set practically next -time FuzzyFinder is launched, and restored when FuzzyFinder is closed. - - *fuf-search-patterns* -Search Patterns ~ - -You can enter one primary pattern and zero or more refining patterns as search -patterns. An entered pattern is separated by ";" (|g:fuf_patternSeparator|), -and the first pattern is a primary pattern and the rest of patterns is a -refining pattern. -> - primary refining refining - |----------| |-------| |----| - >MruFile>bookmark.vim;autoload/;/home/ -< -A refining pattern is used to narrow down the list of matching items by -another pattern. - -With a primary pattern, FuzzyFinder does fuzzy matching or partial matching, -which you specified. With a refining pattern, FuzzyFinder does partial -matching by default. (|g:fuf_fuzzyRefining|) - -When you enter a number as refining pattern, it also can match the index of -each item. - -In a mode which targets a static set of file paths (such as Buffer or MRU-File -mode, not File or Directory) and |g:fuf_splitPathMatching| is non-zero, -matching with a primary pattern is divided into head part and tail part and -done individually. -> - head tail - |------||-----| - foo/bar/baz.vim - - fuzzy matching example: - +----------------+---------+---------+---------+ - | item \ pattern | foo/bar | foo/ | bar | - +----------------+---------+---------+---------+ - | foo/bar | match | match | match | - | foo/abc | unmatch | match | unmatch | - | abc/bar | unmatch | unmatch | match | - | foobar | unmatch | unmatch | match | - | foooo/barrrr | match | match | match | - | foooo/fooooo | unmatch | match | unmatch | - +----------------+---------+---------+---------+ -< -refining pattern can match anywhere on each path in the above case. - - *fuf-sorting-of-completion-items* -Sorting Of Completion Items ~ - -FuzzyFinder sorts completion items with some rules. - -An item, one part of which is matched with a whole pattern, is placed upper. -E.g., with the pattern "bc", the item "abc" is placed upper than "bac". - -In the above case, items, each having matching part at the head of itself, are -placed upper than others. E.g., with the pattern "foo", the item "foobar" is -placed upper than "foobarbaz". - -And the shorter the length of the item after matching position puts it higher. -E.g., with the pattern "bar", the item "foobar" is placed upper than -"foobarbaz". - -If a pattern matches an item at only word boundaries of it, the item is placed -upper. E.g., with a pattern "fb", items such as "fooBarBaz" and "foo_bar_baz" -is placed upper. - -Plus, FuzzyFinder has a learning system. An item which has been completed in -the past with current pattern is placed upper. - - *fuf-reusing-window* -Reusing Of A Window Containing Target Buffer/File ~ - -If a window containing target buffer is found in current tab page when -FuzzyFinder is going to open the buffer in a split new window, move to it. If -a window containing target buffer is found in other tab page when FuzzyFinder -is going to open the buffer in a new tab page, move to it. - -You can disable that feature via 'reuse_window' options if always want to open -a buffer in a new window. - - *fuf-hiding-menu* -To Hide The Completion Menu Temporarily In FuzzyFinder ~ - -You can close it by and reopen it by . - - *fuf-abbreviation* *fuf-multiple-search* -Abbreviations And Multiple Search ~ - -You can use abbreviations and multiple search in all modes by setting -|g:fuf_abbrevMap| option. - -For example, set as below: -> - let g:fuf_abbrevMap = { - \ "^doc:" : [ - \ "~/project/**/doc/", - \ ".vim/doc/", - \ ], - \ } -< -and enter "doc:txt" in File mode, then FuzzyFinder searches by the following -patterns: - - "~/project/**/doc/*t*x*t*" - ".vim/doc/*t*x*t*" - -and show concatenated search results. - - *fuf-data-file* -Data File ~ - -FuzzyFinder writes completion statistics, MRU data, bookmark, etc to files -under |g:fuf_dataDir|. - -|:FufEditDataFile| command is helpful in editing your data files. This command -reads the data file in new unnamed buffer. Write the buffer and the data file -will be updated. - - *fuf-cache* -Cache ~ - -Once a cache was created, It is not automatically updated to speed up the -response time by default. To update it, use |:FufRenewCache| command. - - *fuf-dot-sequence* -Going Up Parent Directories With Dot Sequence ~ - -You can go up parent directories with entering dot sequence. Dot sequence -after a path separator is expanded to "../" sequence. - - Dot sequence Expanded pattern ~ - /.. /../ - /... /../../ - /.... /../../../ - - *fuf-how-to-add-mode* -How To Add Mode ~ - -To add "mymode" mode, put the source file at autoload/fuf/mymode.vim and call -fuf#addMode("mymode") . - - *fuf-migemo* -What Is Migemo ~ - -Migemo is a search method for Japanese language. - - -============================================================================== -COMMANDS *fuf-commands* - -See also: |fuf-vimrc-example| - - *:FufBuffer* -:FufBuffer[!] [{pattern}] - Launchs Buffer mode. - - If a command was executed with a ! modifier, it does partial matching - instead of fuzzy matching. - - {pattern} will be inserted after launching FuzzyFinder. - - *:FufFile* -:FufFile[!] [{pattern}] - Launchs File mode. - - If a command was executed with a ! modifier, it does partial matching - instead of fuzzy matching. - - {pattern} will be inserted after launching FuzzyFinder. - - *:FufFileWithFullCwd* -:FufFileWithFullCwd[!] [{pattern}] - Is mostly the same as |:FufFile|, except that initial pattern is a - full path of current working directory. - - *:FufFileWithCurrentBufferDir* -:FufFileWithCurrentBufferDir[!] [{pattern}] - Is mostly the same as |:FufFile|, except that initial pattern is a - path of directory current buffer is in. - - *:FufCoverageFile* -:FufCoverageFile[!] [{pattern}] - Launchs Coverage-File mode. - - If a command was executed with a ! modifier, it does partial matching - instead of fuzzy matching. - - {pattern} will be inserted after launching FuzzyFinder. - - *:FufDir* -:FufDir[!] [{pattern}] - Launchs Directory mode. - - If a command was executed with a ! modifier, it does partial matching - instead of fuzzy matching. - - {pattern} will be inserted after launching FuzzyFinder. - - *:FufDirWithFullCwd* -:FufDirWithFullCwd[!] [{pattern}] - Is mostly the same as |:FufDir|, except that initial pattern is a full - path of current working directory. - - *:FufDirWithCurrentBufferDir* -:FufDirWithCurrentBufferDir[!] [{pattern}] - Is mostly the same as |:FufDir|, except that initial pattern is a path - of directory current buffer is in. - - *:FufMruFile* -:FufMruFile[!] [{pattern}] - Launchs MRU-File mode. - - If a command was executed with a ! modifier, it does partial matching - instead of fuzzy matching. - - {pattern} will be inserted after launching FuzzyFinder. - - *:FufMruFileInCwd* -:FufMruFileInCwd[!] [{pattern}] - Is mostly the same as |:FufMruFile|, except that files - only in current working directory are listed. - - *:FufMruCmd* -:FufMruCmd[!] [{pattern}] - Launchs MRU-Command mode. - - If a command was executed with a ! modifier, it does partial matching - instead of fuzzy matching. - - {pattern} will be inserted after launching FuzzyFinder. - - *:FufBookmarkFile* -:FufBookmarkFile[!] [{pattern}] - Launchs Bookmark-File mode. - - If a command was executed with a ! modifier, it does partial matching - instead of fuzzy matching. - - {pattern} will be inserted after launching FuzzyFinder. - - *:FufBookmarkDir* -:FufBookmarkDir[!] [{pattern}] - Launchs Bookmark-Dir mode. - - If a command was executed with a ! modifier, it does partial matching - instead of fuzzy matching. - - {pattern} will be inserted after launching FuzzyFinder. - - *:FufTag* -:FufTag[!] [{pattern}] - Launchs Tag mode. - - If a command was executed with a ! modifier, it does partial matching - instead of fuzzy matching. - - {pattern} will be inserted after launching FuzzyFinder. - - *:FufTagWithCursorWord* -:FufTagWithCursorWord[!] [{pattern}] - Is mostly the same as |:FufTag|, except that initial pattern is the - word under the cursor. - - *:FufBufferTag* -:FufBufferTag[!] [{pattern}] - Launchs Buffer-Tag mode. - - If a command was executed with a ! modifier, it does partial matching - instead of fuzzy matching. - - {pattern} will be inserted after launching FuzzyFinder. - - *:FufBufferTagAll* -:FufBufferTagAll[!] [{pattern}] - Is mostly the same as |:FufBufferTag|, except that tags are gathered - from all other buffers in addition to the current one. - - *:FufBufferTagWithCursorWord* -:FufBufferTagWithCursorWord[!] [{pattern}] - Is mostly the same as |:FufBufferTag|, except that initial pattern is - the word under the cursor. - - *:FufBufferTagAllWithCursorWord* -:FufBufferTagAllWithCursorWord[!] [{pattern}] - Is mostly the same as |:FufBufferTagAll|, except that initial pattern - is the word under the cursor. - - *:FufBufferTagWithSelectedText* -:FufBufferTagWithSelectedText[!] [{pattern}] - Is mostly the same as |:FufBufferTag|, except that initial pattern is - the last selected text. - - *:FufBufferTagAllWithSelectedText* -:FufBufferTagAllWithSelectedText[!] [{pattern}] - Is mostly the same as |:FufBufferTagAll|, except that initial pattern - is the last selected text. - - *:FufTaggedFile* -:FufTaggedFile[!] [{pattern}] - Launchs Tagged-File mode. - - If a command was executed with a ! modifier, it does partial matching - instead of fuzzy matching. - - {pattern} will be inserted after launching FuzzyFinder. - - *:FufJumpList* -:FufJumpList[!] [{pattern}] - Launchs Jump-List mode. - - If a command was executed with a ! modifier, it does partial matching - instead of fuzzy matching. - - {pattern} will be inserted after launching FuzzyFinder. - - *:FufChangeList* -:FufChangeList[!] [{pattern}] - Launchs Change-List mode. - - If a command was executed with a ! modifier, it does partial matching - instead of fuzzy matching. - - {pattern} will be inserted after launching FuzzyFinder. - - *:FufQuickfix* -:FufQuickfix[!] [{pattern}] - Launchs Quickfix mode. - - If a command was executed with a ! modifier, it does partial matching - instead of fuzzy matching. - - {pattern} will be inserted after launching FuzzyFinder. - - *:FufLine* -:FufLine[!] [{pattern}] - Launchs Line mode. - - If a command was executed with a ! modifier, it does partial matching - instead of fuzzy matching. - - {pattern} will be inserted after launching FuzzyFinder. - - *:FufHelp* -:FufHelp[!] [{pattern}] - Launchs Help mode. - - If a command was executed with a ! modifier, it does partial matching - instead of fuzzy matching. - - {pattern} will be inserted after launching FuzzyFinder. - - *:FufEditDataFile* -:FufEditDataFile - Opens a buffer for editing your data files. See |fuf-data-file| for - details. - - *:FufCoverageFileRegister* -:FufCoverageFileRegister - Registers new search coverage to be searched in Coverage-File mode. - First, input glob patterns, like ~/* . You can add patterns unless - typing . Next, input coverage name. - - See also: |glob()|, |fuf-coveragefile-mode| - - *:FufCoverageFileChange* -:FufCoverageFileChange [{name}] - Launchs Coverage-File mode with a chosen coverage, registered with - |FufCoverageFileRegister| command. - - If location name is given, the choise process will be skipped. - - See also: |fuf-coveragefile-mode| - - *:FufBookmarkFileAdd* -:FufBookmarkFileAdd [{name}] - Adds a cursor line to bookmarks. - - See also: |fuf-bookmarkfile-mode| - - *:FufBookmarkFileAddAsSelectedText* -:FufBookmarkFileAddAsSelectedText - Is mostly the same as |:FufBookmarkFileAdd|, except that initial - pattern is the last selected one. - - *:FufBookmarkDirAdd* -:FufBookmarkDirAdd [{name}] - Adds a directory to bookmarks. - - See also: |fuf-bookmarkdir-mode| - - *:FufRenewCache* -:FufRenewCache - Removes caches to renew completion items. See |fuf-cache| for details. - - -============================================================================== -OPTIONS *fuf-options* - - *fuf-options-for-all-modes* -For All Modes ~ - - *g:fuf_modesDisable* > - let g:fuf_modesDisable = [ 'mrufile', 'mrucmd', ] -< - List of mode names to disable. - - Modes which are listed will never be initialized and never handle any - event. - - *g:fuf_keyOpen* > - let g:fuf_keyOpen = '' -< - Key mapped to select completion item or finish input and open a - buffer/file in previous window. - - *g:fuf_keyOpenSplit* > - let g:fuf_keyOpenSplit = '' -< - Key mapped to select completion item or finish input and open a - buffer/file in split new window - - *g:fuf_keyOpenVsplit* > - let g:fuf_keyOpenVsplit = '' -< - Key mapped to select completion item or finish input and open a - buffer/file in vertical-split new window. - - *g:fuf_keyOpenTabpage* > - let g:fuf_keyOpenTabpage = '' -< - - Key mapped to select completion item or finish input and open a - buffer/file in a new tab page. - - *g:fuf_keyPreview* > - let g:fuf_keyPreview = '' -< - - Key mapped to show information of selected completion item on - command-line area. This key makes sense only in modes supporting - preview. - - *g:fuf_keyNextMode* > - let g:fuf_keyNextMode = '' -< - Key mapped to switch to next mode. - - *g:fuf_keyPrevMode* > - let g:fuf_keyPrevMode = '' -< - Key mapped to switch to previous mode. - - *g:fuf_keyPrevPattern* > - let g:fuf_keyPrevPattern = '' -< - Key mapped to recall previous entered patten from history. - - *g:fuf_keyNextPattern* > - let g:fuf_keyNextPattern = '' -< - Key mapped to recall next entered patten from history. - - *g:fuf_keySwitchMatching* > - let g:fuf_keySwitchMatching = '' -< - Key mapped to switch between fuzzy matching and partial matching. - - *g:fuf_dataDir* > - let g:fuf_dataDir = '~/.vim-fuf-data' -< - Directory path to which data files is put. If empty string, - FuzzyFinder does not write data files. - - *g:fuf_abbrevMap* > - let g:fuf_abbrevMap = {} -< - |Dictionary|. Each value must be a |List|. All matchs of a - key in entered text is expanded with the value. - - *g:fuf_patternSeparator* > - let g:fuf_patternSeparator = ';' -< - String which sparates a input pattern into a primary pattern and - refining patterns. - - *g:fuf_promptHighlight* > - let g:fuf_promptHighlight = 'Question' -< - a highlight group name for a prompt string. - - *g:fuf_ignoreCase* > - let g:fuf_ignoreCase = 1 -< - If non-zero, FuzzyFinder ignores case in search patterns. - - *g:fuf_splitPathMatching* > - let g:fuf_splitPathMatching = 1 -< - If non-zero, matching with a primary pattern is divided into head part - and tail part and done individually. - - See also: |fuf-search-patterns| - - *g:fuf_fuzzyRefining* > - let g:fuf_fuzzyRefining = 0 -< - If non-zero, fuzzy matching is done with refining pattern instead of - partial matching. - - See also: |fuf-search-patterns| - - *g:fuf_reuseWindow* > - let g:fuf_reuseWindow = 1 -< - If non-zero and when FuzzyFinder opens a buffer which has already been - opened, it reuses a window containing the target buffer. - - *g:fuf_timeFormat* > - let g:fuf_timeFormat = '(%Y-%m-%d %H:%M:%S)' -< - String to format time string. See |strftime()| for details. - - *g:fuf_learningLimit* > - let g:fuf_learningLimit = 100 -< - Ceiling for the number of completion statistics to be stored. - - *g:fuf_enumeratingLimit* > - let g:fuf_enumeratingLimit = 50 -< - To speed up the response time, FuzzyFinder ends enumerating completion - items when found over this. - - *g:fuf_maxMenuWidth* > - let g:fuf_maxMenuWidth = 78 -< - If a length of a completion item is more than this, it is snipped in - completion menu. - - *g:fuf_previewHeight* > - let g:fuf_previewHeight = 0 -< - 'cmdheight' is set to this when a mode supporting preview is launched. - Information of selected completion item will be shown on command-line - area. If zero, preview feature is disabled. - - *g:fuf_autoPreview* > - let g:fuf_autoPreview = 0 -< - If non-zero, previews will be shown automatically. - - *g:fuf_useMigemo* > - let g:fuf_useMigemo = 0 -< - If non-zero, FuzzyFinder uses Migemo. - - *fuf-options-for-buffer-mode* -For Buffer Mode ~ - - *g:fuf_buffer_prompt* > - let g:fuf_buffer_prompt = '>Buffer[]>' -< - Prompt string. "[]" will be substituted with indicators. - - *g:fuf_buffer_switchOrder* > - let g:fuf_buffer_switchOrder = 10 -< - Number of order for switching to the next/previous mode. If negative - number, Fuzzyfinder never switches to this mode. - - *g:fuf_buffer_mruOrder* > - let g:fuf_buffer_mruOrder = 1 -< - If non-zero, completion items is sorted in order of recently used. - - *g:fuf_buffer_keyDelete* > - let g:fuf_buffer_keyDelete = '' -< - Key mapped to delete selected buffer. - - *fuf-options-for-file-mode* -For File Mode ~ - - *g:fuf_file_prompt* > - let g:fuf_file_prompt = '>File[]>' -< - Prompt string. "[]" will be substituted with indicators. - - *g:fuf_file_switchOrder* > - let g:fuf_file_switchOrder = 20 -< - Number of order for switching to the next/previous mode. If negative - number, Fuzzyfinder never switches to this mode. - - *g:fuf_file_exclude* > - let g:fuf_file_exclude = '\v\~$|\.(o|exe|dll|bak|orig|swp)$|(^|[/\\])\.(hg|git|bzr)($|[/\\])' -< - Regexp pattern for items which you want to exclude from completion - list. - - *fuf-options-for-coveragefile-mode* -For Coverage-File Mode ~ - - *g:fuf_coveragefile_prompt* > - let g:fuf_coveragefile_prompt = '>CoverageFile[]>' -< - Prompt string. "[]" will be substituted with indicators. - - *g:fuf_coveragefile_switchOrder* > - let g:fuf_coveragefile_switchOrder = 30 -< - Number of order for switching to the next/previous mode. If negative - number, Fuzzyfinder never switches to this mode. - - *g:fuf_coveragefile_exclude* > - let g:fuf_coveragefile_exclude = '\v\~$|\.(o|exe|dll|bak|orig|swp)$|(^|[/\\])\.(hg|git|bzr)($|[/\\])' -< - Regexp pattern for items which you want to exclude from completion - list. - - *g:fuf_coveragefile_globPatterns* > - let g:fuf_coveragefile_globPatterns = ['**/.*', '**/*'] -< - List of glob patterns to get file paths to be searched. - - See also: |glob()| - - *fuf-options-for-dir-mode* -For Directory Mode ~ - - *g:fuf_dir_prompt* > - let g:fuf_dir_prompt = '>Dir[]>' -< - Prompt string. "[]" will be substituted with indicators. - - *g:fuf_dir_switchOrder* > - let g:fuf_dir_switchOrder = 40 -< - Number of order for switching to the next/previous mode. If negative - number, Fuzzyfinder never switches to this mode. - - *g:fuf_dir_exclude* > - let g:fuf_dir_exclude = '\v(^|[/\\])\.(hg|git|bzr)($|[/\\])' -< - Regexp pattern for items which you want to exclude from completion - list. - - *fuf-options-for-mrufile-mode* -For MRU-File Mode ~ - - *g:fuf_mrufile_prompt* > - let g:fuf_mrufile_prompt = '>MRU-File[]>' -< - Prompt string. "[]" will be substituted with indicators. - - *g:fuf_mrufile_switchOrder* > - let g:fuf_mrufile_switchOrder = 50 -< - Number of order for switching to the next/previous mode. If negative - number, Fuzzyfinder never switches to this mode. - - *g:fuf_mrufile_exclude* > - let g:fuf_mrufile_exclude = '\v\~$|\.(o|exe|dll|bak|orig|sw[po])$|^(\/\/|\\\\|\/mnt\/|\/media\/)' -< - Regexp pattern for items which you want to exclude from completion - list. - - *g:fuf_mrufile_maxItem* > - let g:fuf_mrufile_maxItem = 200 -< - Ceiling for the number of MRU items to be stored. - - *g:fuf_mrufile_maxItemDir* > - let g:fuf_mrufile_maxItemDir = 50 -< - Ceiling for the number of parent directories of MRU items to be - stored, which are used for around search. - - *g:fuf_mrufile_keyExpand* > - let g:fuf_mrufile_keyExpand = '' -< - Key mapped to expand search range. - - *fuf-options-for-mrucmd-mode* -For MRU-Cmd Mode ~ - - *g:fuf_mrucmd_prompt* > - let g:fuf_mrucmd_prompt = '>MRU-Cmd[]>' -< - Prompt string. "[]" will be substituted with indicators. - - *g:fuf_mrucmd_switchOrder* > - let g:fuf_mrucmd_switchOrder = 60 -< - Number of order for switching to the next/previous mode. If negative - number, Fuzzyfinder never switches to this mode. - - *g:fuf_mrucmd_exclude* > - let g:fuf_mrucmd_exclude = '^$' -< - Regexp pattern for items which you want to exclude from completion - list. - - *g:fuf_mrucmd_maxItem* > - let g:fuf_mrucmd_maxItem = 200 -< - This is the ceiling for the number of MRU items to be stored. - - *fuf-options-for-bookmarkfile-mode* -For Bookmark-File Mode ~ - - *g:fuf_bookmarkfile_prompt* > - let g:fuf_bookmarkfile_prompt = '>BookmarkFile[]>' -< - Prompt string. "[]" will be substituted with indicators. - - *g:fuf_bookmarkfile_switchOrder* > - let g:fuf_bookmarkfile_switchOrder = 70 -< - Number of order for switching to the next/previous mode. If negative - number, Fuzzyfinder never switches to this mode. - - *g:fuf_bookmarkfile_searchRange* > - let g:fuf_bookmarkfile_searchRange = 400 -< - Number of lines which FuzzyFinder searches a matching line from - bookmarked position within. - - *g:fuf_bookmarkfile_keyDelete* > - let g:fuf_bookmarkfile_keyDelete = '' -< - Key mapped to delete selected bookmark. - - *fuf-options-for-bookmarkdir-mode* -For Bookmark-Dir Mode ~ - - *g:fuf_bookmarkdir_prompt* > - let g:fuf_bookmarkdir_prompt = '>BookmarkDir[]>' -< - Prompt string. "[]" will be substituted with indicators. - - *g:fuf_bookmarkdir_switchOrder* > - let g:fuf_bookmarkdir_switchOrder = 80 -< - Number of order for switching to the next/previous mode. If negative - number, Fuzzyfinder never switches to this mode. - - *g:fuf_bookmarkdir_keyDelete* > - let g:fuf_bookmarkdir_keyDelete = '' -< - Key mapped to delete selected bookmark. - - *fuf-options-for-tag-mode* -For Tag Mode ~ - - *g:fuf_tag_prompt* > - let g:fuf_tag_prompt = '>Tag[]>' -< - Prompt string. "[]" will be substituted with indicators. - - *g:fuf_tag_switchOrder* > - let g:fuf_tag_switchOrder = 90 -< - Number of order for switching to the next/previous mode. If negative - number, Fuzzyfinder never switches to this mode. - - *fuf-options-for-buffertag-mode* -For Buffer-Tag Mode ~ - - *g:fuf_buffertag_prompt* > - let g:fuf_buffertag_prompt = '>Buffer-Tag[]>' -< - Prompt string. "[]" will be substituted with indicators. - - *g:fuf_buffertag_switchOrder* > - let g:fuf_buffertag_switchOrder = 100 -< - Number of order for switching to the next/previous mode. If negative - number, Fuzzyfinder never switches to this mode. - - *g:fuf_buffertag_ctagsPath* > - let g:fuf_buffertag_ctagsPath = 'ctags' -< - Executable file path of Ctags. - - *fuf-options-for-taggedfile-mode* -For Tagged-File Mode ~ - - *g:fuf_taggedfile_prompt* > - let g:fuf_taggedfile_prompt = '>Tagged-File[]>' -< - Prompt string. "[]" will be substituted with indicators. - - *g:fuf_taggedfile_switchOrder* > - let g:fuf_taggedfile_switchOrder = 110 -< - Number of order for switching to the next/previous mode. If negative - number, Fuzzyfinder never switches to this mode. - - *fuf-options-for-jumplist-mode* -For Jump-List Mode ~ - - *g:fuf_jumplist_prompt* > - let g:fuf_jumplist_prompt = '>Jump-List[]>' -< - Prompt string. "[]" will be substituted with indicators. - - *g:fuf_jumplist_switchOrder* > - let g:fuf_jumplist_switchOrder = 120 -< - Number of order for switching to the next/previous mode. If negative - number, Fuzzyfinder never switches to this mode. - - *fuf-options-for-changelist-mode* -For Change-List Mode ~ - - *g:fuf_changelist_prompt* > - let g:fuf_changelist_prompt = '>Change-List[]>' -< - Prompt string. "[]" will be substituted with indicators. - - *g:fuf_changelist_switchOrder* > - let g:fuf_changelist_switchOrder = 130 -< - Number of order for switching to the next/previous mode. If negative - number, Fuzzyfinder never switches to this mode. - - *fuf-options-for-quickfix-mode* -For Quickfix Mode ~ - - *g:fuf_quickfix_prompt* > - let g:fuf_quickfix_prompt = '>Quickfix[]>' -< - Prompt string. "[]" will be substituted with indicators. - - *g:fuf_quickfix_switchOrder* > - let g:fuf_quickfix_switchOrder = 140 -< - Number of order for switching to the next/previous mode. If negative - number, Fuzzyfinder never switches to this mode. - - *fuf-options-for-line-mode* -For Line Mode ~ - - *g:fuf_line_prompt* > - let g:fuf_line_prompt = '>Line[]>' -< - Prompt string. "[]" will be substituted with indicators. - - *g:fuf_line_switchOrder* > - let g:fuf_line_switchOrder = 150 -< - Number of order for switching to the next/previous mode. If negative - number, Fuzzyfinder never switches to this mode. - - *fuf-options-for-help-mode* -For Help Mode ~ - - *g:fuf_help_prompt* > - let g:fuf_help_prompt = '>Help[]>' -< - Prompt string. "[]" will be substituted with indicators. - - *g:fuf_help_switchOrder* > - let g:fuf_help_switchOrder = 160 -< - Number of order for switching to the next/previous mode. If negative - number, Fuzzyfinder never switches to this mode. - - -============================================================================== -VIMRC EXAMPLE *fuf-vimrc-example* - -> - let g:fuf_modesDisable = [] - let g:fuf_mrufile_maxItem = 400 - let g:fuf_mrucmd_maxItem = 400 - nnoremap sj :FufBuffer - nnoremap sk :FufFileWithCurrentBufferDir - nnoremap sK :FufFileWithFullCwd - nnoremap s :FufFile - nnoremap sl :FufCoverageFileChange - nnoremap sL :FufCoverageFileChange - nnoremap s :FufCoverageFileRegister - nnoremap sd :FufDirWithCurrentBufferDir - nnoremap sD :FufDirWithFullCwd - nnoremap s :FufDir - nnoremap sn :FufMruFile - nnoremap sN :FufMruFileInCwd - nnoremap sm :FufMruCmd - nnoremap su :FufBookmarkFile - nnoremap s :FufBookmarkFileAdd - vnoremap s :FufBookmarkFileAddAsSelectedText - nnoremap si :FufBookmarkDir - nnoremap s :FufBookmarkDirAdd - nnoremap st :FufTag - nnoremap sT :FufTag! - nnoremap s :FufTagWithCursorWord! - nnoremap s, :FufBufferTag - nnoremap s< :FufBufferTag! - vnoremap s, :FufBufferTagWithSelectedText! - vnoremap s< :FufBufferTagWithSelectedText - nnoremap s} :FufBufferTagWithCursorWord! - nnoremap s. :FufBufferTagAll - nnoremap s> :FufBufferTagAll! - vnoremap s. :FufBufferTagAllWithSelectedText! - vnoremap s> :FufBufferTagAllWithSelectedText - nnoremap s] :FufBufferTagAllWithCursorWord! - nnoremap sg :FufTaggedFile - nnoremap sG :FufTaggedFile! - nnoremap so :FufJumpList - nnoremap sp :FufChangeList - nnoremap sq :FufQuickfix - nnoremap sy :FufLine - nnoremap sh :FufHelp - nnoremap se :FufEditDataFile - nnoremap sr :FufRenewCache -< - -============================================================================== -SPECIAL THANKS *fuf-thanks* - -- Vincent Wang -- Ingo Karkat -- Nikolay Golubev -- Brian Doyle -- id:secondlife -- Nathan Neff - - -============================================================================== -CHANGELOG *fuf-changelog* - -4.2.2: - - Fixed a bug that unloaded buffers weren't covered by FufBufferTagAll. - -4.2.1: - - Improved response of Buffer-Tag mode. - - Fixed a bug that buffers which had been opened weren't listed in - Coverage-File mode - - Fixed a bug that tag entries including tab characters weren't parsed - correctly in Coverage-File mode - -4.2: - - L9 library (vimscript #3252) version 1.1 is required. - - Added Buffer-Tag mode, inspired by taglist.vim (vimscript #273). - - Added :FufMruFileInCwd command. - -4.1.1: - - Fixed a bug causing a error in MRU-File mode. - -4.1: - - Added Bookmark-Dir mode. - - Added Bookmark-File mode and removed Bookmark mode. - - Changed the filename to store data of Coverage-File mode, from - '~/.vim-fuf-data/coveragefile/items' to - '~/.vim-fuf-data/coveragefile/coverages' . - - Fixed a bug that floating point numbers weren't evaluated correctly and - caused errors on some non-English locales. - - Removed Around-MRU-File mode and integrated its feature to MRU-File mode. - -4.0: - - From this version, L9 library (vimscript #3252) is required. - - Added Coverage-File mode for users wanting something like TextMate's - command-t. (But I've never used it.) - - Added Around-MRU-File mode. (Too slow. There is room for improvement.) - - Added new feature which deletes selected buffer with FuzzyFinder and - g:fuf_buffer_keyDelete option. - - Added new feature which allows to set one-time options/variables with - fuf#setOneTimeVariables() function. - - Added g:fuf_dataDir option and removed g:fuf_infoFile, - g:g:fuf_tag_cache_dir, g:fuf_taggedfile_cache_dir, and - g:fuf_help_cache_dir options. - - Added :FufEditDataFile command and removed :FufEditInfo command. - - Added g:fuf_fuzzyRefining option. - - Added new feature which is auto-preview and g:fuf_autoPreview option. - - Changed the default value of g:fuf_previewHeight to 0 in order to disable - preview feature. There is an unfixable problem which is caused by a Vim's - bug. - - Changed the default value of g:fuf_modesDisable option. - - Changed the default value of g:fuf_*_switchOrder options. - - Improved speed of changing buffers. - - Improved the way to add user-defined mode. - - Fixed a bug that FuzzyFinder caused reseting window layout. - - Removed g:fuf_smartBs option. Use instead. - -3.5: - - Added Line mode. - - Added Help mode. - - Added key mapping to switch between fuzzy matching and partial matching. - - Changed the default values of g:fuf_file_exclude for ignoring "*.dll". - - Changed Tag mode and Tagged-File mode to cache parsed data to files in - "~/.vim-fuf-cache/". - - Fixed a bug that repeating preview key produced no effect. - - Fixed a bug that File mode and Directory mode didn't list items in a - directory whose name includes uppercase characters. (Thanks, ryo7000) - -3.4: - - Added new feature which makes it possible to preview selected completion - item. - - Changed matching rules and added g:fuf_splitPathMatching. - - Changed sorting rules. - - Changed the default values of g:fuf_file_exclude and g:fuf_dir_exclude in - order to ignore ".hg", ".git", and ".bzr" directories. - - Changed the default value of g:fuf_mrufile_exclude in order to ignore - network files (\\*) on Windows and ignore /mnt/* and /media/* on Unix like - systems. - - Fixed a bug that an exclude pattern of File, Dir, and Callback-File mode - can't be changed. - -3.3: - - Added Jump-List mode, Change-List mode, and Quickfix mode which enable - jumps with jump list, change list, and quickfix list. - - Added new feature which deletes selected bookmark with FuzzyFinder and - g:fuf_bookmark_keyDelete option. - - Changed default values of g:fuf_keyPrevPattern. - - Changed to show error message when incompatible with a installed vim. - -3.2: - - Added g:fuf_promptHighlight option to integrate such options for each - mode. - - Changed APIs of Given-File, Given-Directory, Given-Command, Callback-File, - and Callback-Item modes to be able to set a prompt string. - - Changed default values of g:fuf_keyPrevPattern and g:fuf_keyNextPattern. - - Fixed a bug that MRU-File data was not updated When a file was opened with - FuzzyFinder. - - Fixed a bug with scoring matchings for sorting. Thanks to Vincent. - - Brought back the removed feature which is switching to an other mode in - FuzzyFinder. - -3.1: - - Added new feature to recall patterns which have been entered before from - history. - -3.0: - - Redesigned the whole plugin for improvements of maintainability and - performance. "fuzzyfinder" is abbreviated to "fuf" in the sorce code and - filenames. All commands and options are renamed. - - Added new feature which is refining pattern. - - Improved the rules for sorting completion items. Thanks to the suggestion - by Nathan, the rule for boundary matching was implemented. - - Changed to open one line buffer of FuzzyFinder with :topleft command - instead of :leftabove. The window will alway appear at the top and occupy - the full with of the vim window. Thanks to Jan Christoph. - - Changed default filename of information file. - - Changed MRU-File mode and MRU-Command mode to be disabled by default - due to performance and side effect issues. - - Removed the feature which is switching to an other mode in FuzzyFinder. - - Removed the feature which is temporarily switching 'ignorecase' in - FuzzyFinder. - -2.22.3: - - Fixed a bug that Fuzzyfinder could not open files with '$' in the name on - Windows. - -2.22.2: - - Changed to consider a length of a date/time string when abbreviates long - completion items. - - Fixed a bug that '**/' pattern did not search for files directly under the - current working directory in File mode. Thanks to Martin for reporting. - -2.22.1: - - Fixed a bug that Fuzzyfinder could not expand abbreviations to patterns - including '\' correctly. - - Fixed to show item number in Given-File, Given-Directory, and - Given-Command mode. - -2.22.0: - - More improved the abbreviation method for long completion items. - - Added Given-File mode for third-party script to select a file from a given - list and open. - - Added Given-Directory mode for third-party script to select a directory - from a given list and change current working directory to it. - - Added Given-Command mode for third-party script to select a command from a - given list and execute. - - Changed ways to launch Callback-File mode and Callback-item mode. - -2.21.0: - - Improved a method of trimming long completion items. Thanks to Andy, - pyrhockz, and Nathan. - - Changed not to map command-line for MRU-Command mode if - g:FuzzyFinderOptions.MruCmd.mode_available is set 0 before loading - fuzzyfinder.vim. - - Added Callback-File mode and Callback-Item mode for third-party script to - find a file/directory or an item from a given list using Fuzzyfinder. - - Changed not to append ".." to a completion menu in File/Directory mode. - Use dot sequence feature. - - Changed default value of g:FuzzyFinderOptions.File.excluded_path option. - - Changed default value of g:FuzzyFinderOptions.Dir.excluded_path option. - - Fixed a bug that couldn't jump to a tag. Thanks to Thinca. - -2.20: - - Added help files which are doc/fuzzyfinder.txt and doc/fuzzyfinder.jax. - - Fixed a bug that an error occurs if current directory included spaces. - Thanks id:cho45 and id:secondlife. - - Implemented a feature to reuse a window containing target buffer. - - Added g:FuzzyFinderOptions.Buffer.reuse_window option. - - Added g:FuzzyFinderOptions.File.reuse_window option. - - Added g:FuzzyFinderOptions.MruFile.reuse_window option. - - Added g:FuzzyFinderOptions.Bookmark.reuse_window option. - - Added g:FuzzyFinderOptions.TaggedFile.reuse_window option. - - Changed to use 'omnifunc' instead of 'completefunc'. Now you can use - to delete all entered characters. - - Changed default value of g:FuzzyFinderOptions.Base.key_open_tab option. - - Changed default value of g:FuzzyFinderOptions.Base.key_next_mode option. - - Changed default value of g:FuzzyFinderOptions.Base.key_prev_mode option. - - Changed default value of g:FuzzyFinderOptions.Base.key_ignore_case option. - - Changed to truncate long completion items from the head instead of tail. - - Added g:FuzzyFinderOptions.Base.max_menu_width option instead of - g:FuzzyFinderOptions.Base.trim_length option. - - Added :FuzzyFinderFileWithFullCwd command. - - Added :FuzzyFinderFileWithCurrentBufferDir command. - - Added :FuzzyFinderDirWithFullCwd command. - - Added :FuzzyFinderDirWithCurrentBufferDir command. - - Added :FuzzyFinderTagWithCursorWord command. - - Renamed :FuzzyFinderRemoveCache command to :FuzzyFinderRenewCache. - -2.19: - - Changed MRU-File mode that always formats completion items to be relative - to the home directory. - - Fixed a bug that a file was opened in an unintended window with Tag List - plugin. Thanks Alexey. - - Fixed a bug that garbage characters were entered when switched current - mode. Thanks id:lugecy. - -2.18: - - Improved rules for the sorting of completion items. - - Changed not to learn a completion if an entered pattern is empty. - - Fixed a bug that Buffer mode did not work. Thanks ryo7000. - -2.17: - - Introduced a learning system for the sorting of completion items. - - Added g:FuzzyFinderOptions.Base.learning_limit option. - - Changed the specification of the information file. Please remove your - information file for Fuzzyfinder. - -2.16: - - Improved response time by caching in MRU-File mode. - - Fixed a bug in Bookmark mode that Fuzzyfinder did not jump to the - Bookmarked line number when Bookmarked pattern was not found. - -2.15: - - Added Bookmark mode. - - Removed Favorite-file mode. Use Bookmark mode instead. - - Fixed not to record a entry of input() in MRU-Command mode. - -2.14: - - Changed to show buffer status in Buffer mode. - - Fixed a bug that an error occurs when nonexistent buffer-name was entered - in Buffer mode. Thanks Maxim Kim. - - Added 'enumerating_limit' option. Thanks id:secondlife. - - Removed 'matching_limit' option. Use 'enumerating_limit' instead. - -2.13: - - Fixed a bug that a directory disappeared when a file in that directory 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 - directories 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 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" 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 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 directory 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 option. - - 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 - or . - -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 to - because 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. - - -============================================================================== -ABOUT *fuf-about* *fuf-contact* *fuf-author* - -Author: Takeshi NISHIDA -Licence: MIT Licence -URL: http://www.vim.org/scripts/script.php?script_id=1984 - http://bitbucket.org/ns9tks/vim-fuzzyfinder/ - -Bugs/Issues/Suggestions/Improvements ~ - -Please submit to http://bitbucket.org/ns9tks/vim-fuzzyfinder/issues/ . - -============================================================================== - vim:tw=78:ts=8:ft=help:norl: diff --git a/bundle/fuzzyfinder/plugin/fuf.vim b/bundle/fuzzyfinder/plugin/fuf.vim deleted file mode 100644 index 9826dab..0000000 --- a/bundle/fuzzyfinder/plugin/fuf.vim +++ /dev/null @@ -1,158 +0,0 @@ -"============================================================================= -" Copyright (c) 2007-2010 Takeshi NISHIDA -" -" GetLatestVimScripts: 1984 1 :AutoInstall: FuzzyFinder -"============================================================================= -" LOAD GUARD {{{1 - -try - if !l9#guardScriptLoading(expand(':p'), 702, 101, []) - finish - endif -catch /E117/ - echoerr '***** L9 library must be installed! *****' - finish -endtry - -" }}}1 -"============================================================================= -" LOCAL FUNCTIONS {{{1 - -" -function s:initialize() - "--------------------------------------------------------------------------- - call l9#defineVariableDefault('g:fuf_modesDisable' , [ 'mrufile', 'mrucmd', ]) - call l9#defineVariableDefault('g:fuf_keyOpen' , '') - call l9#defineVariableDefault('g:fuf_keyOpenSplit' , '') - call l9#defineVariableDefault('g:fuf_keyOpenVsplit' , '') - call l9#defineVariableDefault('g:fuf_keyOpenTabpage' , '') - call l9#defineVariableDefault('g:fuf_keyPreview' , '') - call l9#defineVariableDefault('g:fuf_keyNextMode' , '') - call l9#defineVariableDefault('g:fuf_keyPrevMode' , '') - call l9#defineVariableDefault('g:fuf_keyPrevPattern' , '') - call l9#defineVariableDefault('g:fuf_keyNextPattern' , '') - call l9#defineVariableDefault('g:fuf_keySwitchMatching', '') - call l9#defineVariableDefault('g:fuf_dataDir' , '~/.vim-fuf-data') - call l9#defineVariableDefault('g:fuf_abbrevMap' , {}) - call l9#defineVariableDefault('g:fuf_patternSeparator' , ';') - call l9#defineVariableDefault('g:fuf_promptHighlight' , 'Question') - call l9#defineVariableDefault('g:fuf_ignoreCase' , 1) - call l9#defineVariableDefault('g:fuf_splitPathMatching', 1) - call l9#defineVariableDefault('g:fuf_fuzzyRefining' , 0) - call l9#defineVariableDefault('g:fuf_smartBs' , 1) - call l9#defineVariableDefault('g:fuf_reuseWindow' , 1) - call l9#defineVariableDefault('g:fuf_timeFormat' , '(%Y-%m-%d %H:%M:%S)') - call l9#defineVariableDefault('g:fuf_learningLimit' , 100) - call l9#defineVariableDefault('g:fuf_enumeratingLimit' , 50) - call l9#defineVariableDefault('g:fuf_maxMenuWidth' , 78) - call l9#defineVariableDefault('g:fuf_previewHeight' , 0) - call l9#defineVariableDefault('g:fuf_autoPreview' , 0) - call l9#defineVariableDefault('g:fuf_useMigemo' , 0) - "--------------------------------------------------------------------------- - call l9#defineVariableDefault('g:fuf_buffer_prompt' , '>Buffer[]>') - call l9#defineVariableDefault('g:fuf_buffer_switchOrder', 10) - call l9#defineVariableDefault('g:fuf_buffer_mruOrder' , 1) - call l9#defineVariableDefault('g:fuf_buffer_keyDelete' , '') - "--------------------------------------------------------------------------- - call l9#defineVariableDefault('g:fuf_file_prompt' , '>File[]>') - call l9#defineVariableDefault('g:fuf_file_switchOrder', 20) - call l9#defineVariableDefault('g:fuf_file_exclude' , '\v\~$|\.(o|exe|dll|bak|orig|sw[po])$|(^|[/\\])\.(hg|git|bzr)($|[/\\])') - "--------------------------------------------------------------------------- - call l9#defineVariableDefault('g:fuf_coveragefile_prompt' , '>CoverageFile[]>') - call l9#defineVariableDefault('g:fuf_coveragefile_switchOrder', 30) - call l9#defineVariableDefault('g:fuf_coveragefile_exclude' , '\v\~$|\.(o|exe|dll|bak|orig|sw[po])$|(^|[/\\])\.(hg|git|bzr)($|[/\\])') - call l9#defineVariableDefault('g:fuf_coveragefile_globPatterns', ['**/.*', '**/*']) - "--------------------------------------------------------------------------- - call l9#defineVariableDefault('g:fuf_dir_prompt' , '>Dir[]>') - call l9#defineVariableDefault('g:fuf_dir_switchOrder', 40) - call l9#defineVariableDefault('g:fuf_dir_exclude' , '\v(^|[/\\])\.(hg|git|bzr)($|[/\\])') - "--------------------------------------------------------------------------- - call l9#defineVariableDefault('g:fuf_mrufile_prompt' , '>MRU-File[]>') - call l9#defineVariableDefault('g:fuf_mrufile_switchOrder', 50) - call l9#defineVariableDefault('g:fuf_mrufile_exclude' , '\v\~$|\.(o|exe|dll|bak|orig|sw[po])$|^(\/\/|\\\\|\/mnt\/|\/media\/)') - call l9#defineVariableDefault('g:fuf_mrufile_maxItem' , 200) - call l9#defineVariableDefault('g:fuf_mrufile_maxItemDir' , 50) - call l9#defineVariableDefault('g:fuf_mrufile_keyExpand' , '') - "--------------------------------------------------------------------------- - call l9#defineVariableDefault('g:fuf_mrucmd_prompt' , '>MRU-Cmd[]>') - call l9#defineVariableDefault('g:fuf_mrucmd_switchOrder', 60) - call l9#defineVariableDefault('g:fuf_mrucmd_exclude' , '^$') - call l9#defineVariableDefault('g:fuf_mrucmd_maxItem' , 200) - "--------------------------------------------------------------------------- - call l9#defineVariableDefault('g:fuf_bookmarkfile_prompt' , '>Bookmark-File[]>') - call l9#defineVariableDefault('g:fuf_bookmarkfile_switchOrder', 70) - call l9#defineVariableDefault('g:fuf_bookmarkfile_searchRange', 400) - call l9#defineVariableDefault('g:fuf_bookmarkfile_keyDelete' , '') - "--------------------------------------------------------------------------- - call l9#defineVariableDefault('g:fuf_bookmarkdir_prompt' , '>Bookmark-Dir[]>') - call l9#defineVariableDefault('g:fuf_bookmarkdir_switchOrder', 80) - call l9#defineVariableDefault('g:fuf_bookmarkdir_keyDelete' , '') - "--------------------------------------------------------------------------- - call l9#defineVariableDefault('g:fuf_tag_prompt' , '>Tag[]>') - call l9#defineVariableDefault('g:fuf_tag_switchOrder', 90) - "--------------------------------------------------------------------------- - call l9#defineVariableDefault('g:fuf_buffertag_prompt' , '>Buffer-Tag[]>') - call l9#defineVariableDefault('g:fuf_buffertag_switchOrder', 100) - call l9#defineVariableDefault('g:fuf_buffertag_ctagsPath' , 'ctags') - "--------------------------------------------------------------------------- - call l9#defineVariableDefault('g:fuf_taggedfile_prompt' , '>Tagged-File[]>') - call l9#defineVariableDefault('g:fuf_taggedfile_switchOrder', 110) - "--------------------------------------------------------------------------- - call l9#defineVariableDefault('g:fuf_jumplist_prompt' , '>Jump-List[]>') - call l9#defineVariableDefault('g:fuf_jumplist_switchOrder', 120) - "--------------------------------------------------------------------------- - call l9#defineVariableDefault('g:fuf_changelist_prompt' , '>Change-List[]>') - call l9#defineVariableDefault('g:fuf_changelist_switchOrder', 130) - "--------------------------------------------------------------------------- - call l9#defineVariableDefault('g:fuf_quickfix_prompt' , '>Quickfix[]>') - call l9#defineVariableDefault('g:fuf_quickfix_switchOrder', 140) - "--------------------------------------------------------------------------- - call l9#defineVariableDefault('g:fuf_line_prompt' , '>Line[]>') - call l9#defineVariableDefault('g:fuf_line_switchOrder', 150) - "--------------------------------------------------------------------------- - call l9#defineVariableDefault('g:fuf_help_prompt' , '>Help[]>') - call l9#defineVariableDefault('g:fuf_help_switchOrder', 160) - "--------------------------------------------------------------------------- - command! -bang -narg=0 FufEditDataFile call fuf#editDataFile() - command! -bang -narg=0 FufRenewCache call s:renewCachesOfAllModes() - "--------------------------------------------------------------------------- - call fuf#addMode('buffer') - call fuf#addMode('file') - call fuf#addMode('coveragefile') - call fuf#addMode('dir') - call fuf#addMode('mrufile') - call fuf#addMode('mrucmd') - call fuf#addMode('bookmarkfile') - call fuf#addMode('bookmarkdir') - call fuf#addMode('tag') - call fuf#addMode('buffertag') - call fuf#addMode('taggedfile') - call fuf#addMode('jumplist') - call fuf#addMode('changelist') - call fuf#addMode('quickfix') - call fuf#addMode('line') - call fuf#addMode('help') - call fuf#addMode('givenfile') - call fuf#addMode('givendir') - call fuf#addMode('givencmd') - call fuf#addMode('callbackfile') - call fuf#addMode('callbackitem') - "--------------------------------------------------------------------------- -endfunction - -" -function s:renewCachesOfAllModes() - for m in fuf#getModeNames() - call fuf#{m}#renewCache() - endfor -endfunction - -" }}}1 -"============================================================================= -" INITIALIZATION {{{1 - -call s:initialize() - -" }}}1 -"============================================================================= -" vim: set fdm=marker: diff --git a/bundle/git_ctrlp/.gitignore b/bundle/git_ctrlp/.gitignore new file mode 100644 index 0000000..299a816 --- /dev/null +++ b/bundle/git_ctrlp/.gitignore @@ -0,0 +1,8 @@ +.hgignore +*.markdown +*.zip +wiki.md +note.txt +tags +.hg/* +tmp/* diff --git a/bundle_consider/ctrlp/autoload/ctrlp.vim b/bundle/git_ctrlp/autoload/ctrlp.vim similarity index 84% rename from bundle_consider/ctrlp/autoload/ctrlp.vim rename to bundle/git_ctrlp/autoload/ctrlp.vim index 9b5f04a..a4390a5 100644 --- a/bundle_consider/ctrlp/autoload/ctrlp.vim +++ b/bundle/git_ctrlp/autoload/ctrlp.vim @@ -2,7 +2,7 @@ " File: autoload/ctrlp.vim " Description: Fuzzy file, buffer, mru and tag finder. " Author: Kien Nguyen -" Version: 1.6.9 +" Version: 1.7.1 " ============================================================================= " Static variables {{{1 @@ -18,13 +18,13 @@ fu! s:opts() \ 'g:ctrlp_dotfiles': ['s:dotfiles', 1], \ 'g:ctrlp_extensions': ['s:extensions', []], \ 'g:ctrlp_follow_symlinks': ['s:folsym', 0], - \ 'g:ctrlp_highlight_match': ['s:mathi', [1, 'Identifier']], + \ 'g:ctrlp_highlight_match': ['s:mathi', [1, 'CtrlPMatch']], \ 'g:ctrlp_jump_to_buffer': ['s:jmptobuf', 2], \ 'g:ctrlp_lazy_update': ['s:lazy', 0], \ 'g:ctrlp_match_window_bottom': ['s:mwbottom', 1], \ 'g:ctrlp_match_window_reversed': ['s:mwreverse', 1], \ 'g:ctrlp_max_depth': ['s:maxdepth', 40], - \ 'g:ctrlp_max_files': ['s:maxfiles', 20000], + \ 'g:ctrlp_max_files': ['s:maxfiles', 10000], \ 'g:ctrlp_max_height': ['s:mxheight', 10], \ 'g:ctrlp_max_history': ['s:maxhst', hst], \ 'g:ctrlp_open_multi': ['s:opmul', '1v'], @@ -62,9 +62,11 @@ fu! s:opts() \ 'PrtSelectMove("k")': ['', ''], \ 'PrtSelectMove("t")': [''], \ 'PrtSelectMove("b")': [''], + \ 'PrtSelectMove("u")': [''], + \ 'PrtSelectMove("d")': [''], \ 'PrtHistory(-1)': [''], \ 'PrtHistory(1)': [''], - \ 'AcceptSelection("e")': ['', '', '<2-LeftMouse>'], + \ 'AcceptSelection("e")': ['', '<2-LeftMouse>'], \ 'AcceptSelection("h")': ['', '', ''], \ 'AcceptSelection("t")': ['', ''], \ 'AcceptSelection("v")': ['', ''], @@ -73,7 +75,7 @@ fu! s:opts() \ 'ToggleByFname()': [''], \ 'ToggleType(1)': ['', ''], \ 'ToggleType(-1)': ['', ''], - \ 'PrtExpandDir()': ['', ''], + \ 'PrtExpandDir()': [''], \ 'PrtInsert("w")': ['', ''], \ 'PrtInsert("s")': [''], \ 'PrtInsert("v")': [''], @@ -114,7 +116,7 @@ fu! s:opts() " 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, 'scs': 1 } + \ 'gcr': 'a:blinkon0', 'ic': 1, 'scs': 1, 'lmap': '' } if s:lazy cal extend(s:glbs, { 'ut': ( s:lazy > 1 ? s:lazy : 250 ) }) en @@ -124,7 +126,7 @@ cal s:opts() let s:lash = ctrlp#utils#lash() " Limiters -let [s:compare_lim, s:nocache_lim, s:mltipats_lim] = [3000, 4000, 2000] +let [s:compare_lim, s:nocache_lim] = [3000, 4000] " Regexp let s:fpats = { @@ -133,6 +135,18 @@ let s:fpats = { \ '^\S\*$': '\*', \ '^\S\\?$': '\\?', \ } + +" Highlight groups +let s:hlgrps = { + \ 'NoEntries': 'Error', + \ 'Mode1': 'Character', + \ 'Mode2': 'LineNr', + \ 'Stats': 'Function', + \ 'Match': 'Identifier', + \ 'PrtBase': 'Comment', + \ 'PrtText': 'Normal', + \ 'PrtCursor': 'Constant', + \ } " * Open & Close {{{1 fu! s:Open() if exists('g:ctrlp_log') && g:ctrlp_log @@ -157,7 +171,8 @@ fu! s:Open() endf fu! s:Close() - try | noa bun! | cat | noa clo! | endt + try | noa bun! + cat | noa clo! | endt cal s:unmarksigns() for key in keys(s:glbs) sil! exe 'let &'.key.' = s:glb_'.key @@ -168,7 +183,7 @@ fu! s:Close() exe s:winres[0] en unl! s:focus s:hisidx s:hstgot s:marked s:statypes s:cline s:init s:savestr - \ g:ctrlp_nolimit + \ s:winh g:ctrlp_nolimit cal ctrlp#recordhist() cal s:onexit() if exists('g:ctrlp_log') && g:ctrlp_log @@ -178,12 +193,10 @@ fu! s:Close() endf " * Clear caches {{{1 fu! ctrlp#clr(...) - exe 'let g:ctrlp_new'.( exists('a:1') ? a:1 : 'cache' ).' = 1' + exe 'let g:ctrlp_new'.( a:0 ? a:1 : 'cache' ).' = 1' endf -fu! ctrlp#clra(...) - if !exists('a:1') && ( has('dialog_gui') || has('dialog_con') ) && - \ confirm("Delete all cache files?", "&OK\n&Cancel") != 1 | retu | en +fu! ctrlp#clra() let cache_dir = ctrlp#utils#cachedir() if isdirectory(cache_dir) let cache_files = split(s:glbpath(cache_dir, '**', 1), "\n") @@ -194,8 +207,6 @@ fu! ctrlp#clra(...) endf fu! ctrlp#reset() - if ( has('dialog_gui') || has('dialog_con') ) && - \ confirm("Reset and apply new options?", "&OK\n&Cancel") != 1 | retu | en cal s:opts() cal ctrlp#utils#opts() cal ctrlp#mrufiles#opts() @@ -211,18 +222,19 @@ fu! s:Files() cal s:GlobPath(cwd, 0) el sil! cal ctrlp#progress('Indexing...') - try | cal s:UserCmd(cwd, lscmd) | cat | retu [] | endt + try | cal s:UserCmd(cwd, lscmd) + cat | retu [] | endt en " Remove base directory cal ctrlp#rmbasedir(g:ctrlp_allfiles) let read_cache = 0 + if len(g:ctrlp_allfiles) <= s:compare_lim + cal sort(g:ctrlp_allfiles, 'ctrlp#complen') + en el let g:ctrlp_allfiles = ctrlp#utils#readfile(cafile) let read_cache = 1 en - if len(g:ctrlp_allfiles) <= s:compare_lim - cal sort(g:ctrlp_allfiles, 'ctrlp#complen') - en cal s:writecache(read_cache, cafile) retu g:ctrlp_allfiles endf @@ -264,9 +276,20 @@ fu! s:lsCmd() " Try the secondary_command retu len(cmd) == 3 ? cmd[2] : '' en - unl! s:vcsroot + unl s:vcsroot let s:vcscmd = s:lash == '\' ? 1 : 0 retu cmd[1] + elsei type(cmd) == 4 && has_key(cmd, 'types') + for key in sort(keys(cmd['types']), 's:compval') + cal s:findroot(getcwd(), cmd['types'][key][0], 0, 1) + if exists('s:vcsroot') | brea | en + endfo + if !exists('s:vcsroot') + retu has_key(cmd, 'fallback') ? cmd['fallback'] : '' + en + unl s:vcsroot + let s:vcscmd = s:lash == '\' ? 1 : 0 + retu cmd['types'][key][1] en endf fu! s:Buffers() "{{{1 @@ -285,79 +308,60 @@ endf fu! s:MatchIt(items, pat, limit, mfunc) let newitems = [] for item in a:items - if call(a:mfunc, [item, a:pat]) >= 0 | cal add(newitems, item) | en + try | if call(a:mfunc, [item, a:pat]) >= 0 + cal add(newitems, item) + en | cat | brea | endt if a:limit > 0 && len(newitems) >= a:limit | brea | en endfo retu newitems endf -fu! s:MatchedItems(items, pats, limit, bfn) - let [items, pats, limit] = [a:items, a:pats, a:limit] - " If items is longer than s:mltipats_lim, use only the last pattern - if len(items) >= s:mltipats_lim || ( exists('s:height') && s:height > 20 ) - let pats = [pats[-1]] - en - cal map(pats, 'substitute(v:val, "\\\~", "\\\\\\~", "g")') - if !s:regexp | cal map(pats, 'escape(v:val, ".")') | en +fu! s:MatchedItems(items, pat, limit) + let [items, pat, limit] = [a:items, a:pat, a:limit] let [type, ipt, mfunc] = [s:type(1), s:ispathitem(), 'match'] - if s:byfname && ipt && a:bfn + if s:byfname && ipt let mfunc = 's:matchfname' elsei s:itemtype > 2 let types = { 'tabs': 's:matchtabs', 'tabe': 's:matchtabe' } if has_key(types, type) | let mfunc = types[type] | en en - " Loop through the patterns - for pat in pats - " If newitems is small, set it as items to search in - if exists('newitems') && len(newitems) < limit - let items = copy(newitems) - en - if empty(items) " End here - retu exists('newitems') ? newitems : [] - el " Start here, go back up if have 2 or more in pats - " Loop through the items - let newitems = s:MatchIt(items, pat, limit, mfunc) - en - endfo + let newitems = s:MatchIt(items, pat, limit, mfunc) let s:matches = len(newitems) retu newitems endf -fu! s:SplitPattern(str, ...) "{{{1 - let str = s:sanstail(a:str) +fu! s:SplitPattern(str) "{{{1 + 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 || match(str, '\\\(zs\|ze\|<\|>\)\|[*|]') >= 0 - let array = [s:regexfilter(str)] + if s:regexp || match(str, '\\\(<\|>\)\|[*|]') >= 0 + let pat = s:regexfilter(str) el - let array = split(str, '\zs') + let lst = split(str, '\zs') if exists('+ssl') && !&ssl - cal map(array, 'substitute(v:val, "\\", "\\\\\\", "g")') + cal map(lst, 'escape(v:val, ''\'')') en - " Literal ^ and $ - for each in ['^', '$'] - cal map(array, 'substitute(v:val, "\\\'.each.'", "\\\\\\'.each.'", "g")') + for each in ['^', '$', '.'] + cal map(lst, 'escape(v:val, each)') endfo en - " Build the new pattern - let nitem = !empty(array) ? array[0] : '' - let newpats = [nitem] - if len(array) > 1 - for item in range(1, len(array) - 1) - " Separator - let sep = a:0 ? a:1 : '[^'.array[item-1].']\{-}' - let nitem .= sep.array[item] - cal add(newpats, nitem) - endfo + if exists('lst') + let pat = '' + if !empty(lst) + let pat = lst[0] + for item in range(1, len(lst) - 1) + let pat .= '[^'.lst[item - 1].']\{-}'.lst[item] + endfo + en en - retu newpats + retu escape(pat, '~') endf " * BuildPrompt() {{{1 -fu! s:Render(lines, pat, bfn) +fu! s:Render(lines, pat) let lines = a:lines " Setup the match window - let s:height = min([len(lines), s:mxheight]) + let s:height = min([len(lines), s:winh]) sil! exe '%d _ | res' s:height " Print the new items if empty(lines) @@ -379,8 +383,7 @@ fu! s:Render(lines, pat, bfn) let s:matched = copy(lines) cal map(lines, '"> ".v:val') cal setline(1, lines) - exe 'keepj norm!' s:mwreverse ? 'G' : 'gg' - keepj norm! 1| + exe 'keepj norm!' ( s:mwreverse ? 'G' : 'gg' ).'1|' cal s:unmarksigns() cal s:remarksigns() if exists('s:cline') && !exists('g:ctrlp_nolimit') @@ -388,35 +391,29 @@ fu! s:Render(lines, pat, bfn) en " Highlighting if s:dohighlight() - cal s:highlight(a:pat, s:mathi[1] == '' ? 'Identifier' : s:mathi[1], a:bfn) + cal s:highlight(a:pat, s:mathi[1] == '' ? 'Identifier' : s:mathi[1]) en endf fu! s:Update(str) " Get the previous string if existed let oldstr = exists('s:savestr') ? s:savestr : '' - let pats = s:SplitPattern(a:str) " Get the new string sans tail - let notail = substitute(a:str, '\\\\', '\', 'g') - let notail = substitute(notail, '\\\@= 0 - let bfn = s:byfname - en - let lines = exists('g:ctrlp_nolimit') && empty(notail) ? copy(g:ctrlp_lines) - \ : s:MatchedItems(g:ctrlp_lines, copy(pats), s:mxheight, bfn) - cal s:Render(lines, pats[-1], bfn) + let pat = s:SplitPattern(str) + let lines = exists('g:ctrlp_nolimit') && empty(str) ? copy(g:ctrlp_lines) + \ : s:MatchedItems(g:ctrlp_lines, pat, s:winh) + cal s:Render(lines, pat) endf fu! s:ForceUpdate() let [estr, prt] = ['"\', copy(s:prompt)] cal map(prt, 'escape(v:val, estr)') - cal s:Update(join(prt, '')) + sil! cal s:Update(join(prt, '')) endf fu! s:BuildPrompt(upd, ...) @@ -426,15 +423,15 @@ fu! s:BuildPrompt(upd, ...) let str = join(prt, '') let lazy = empty(str) || exists('s:force') || !has('autocmd') ? 0 : s:lazy if a:upd && !lazy && ( s:matches || s:regexp - \ || match(str, '[*|]') >= 0 || match(str, '\\\:\([^:]\|\\:\)*$') >= 0 ) + \ || match(str, '\(\\\(<\|>\)\|[*|]\)\|\(\\\:\([^:]\|\\:\)*$\)') >= 0 ) sil! cal s:Update(str) en sil! cal ctrlp#statusline() " Toggling - let [hiactive, hicursor, base] = exists('a:1') && !a:1 - \ ? ['Comment', 'Comment', tr(base, '>', '-')] - \ : ['Normal', 'Constant', base] - let hibase = 'Comment' + let [hiactive, hicursor, base] = a:0 && !a:1 + \ ? ['CtrlPPrtBase', 'CtrlPPrtBase', tr(base, '>', '-')] + \ : ['CtrlPPrtText', 'CtrlPPrtCursor', base] + let hibase = 'CtrlPPrtBase' " Build it redr exe 'echoh' hibase '| echon "'.base.'" @@ -442,7 +439,7 @@ fu! s:BuildPrompt(upd, ...) \ | echoh' hicursor '| echon "'.prt[1].'" \ | echoh' hiactive '| echon "'.prt[2].'" | echoh None' " Append the cursor at the end - if empty(prt[1]) && ( !exists('a:1') || ( exists('a:1') && a:1 ) ) + if empty(prt[1]) && !( a:0 && !a:1 ) exe 'echoh' hibase '| echon "_" | echoh None' en endf @@ -456,22 +453,22 @@ endf fu! s:PrtAdd(char) unl! s:hstgot - let s:prompt[0] = s:prompt[0] . a:char + let s:prompt[0] .= a:char cal s:BuildPrompt(1) endf fu! s:PrtBS() unl! s:hstgot let [prt, s:matches] = [s:prompt, 1] - let prt[0] = strpart(prt[0], -1, strlen(prt[0])) + let prt[0] = substitute(prt[0], '.$', '', '') cal s:BuildPrompt(1) endf fu! s:PrtDelete() unl! s:hstgot let [prt, s:matches] = [s:prompt, 1] - let prt[1] = strpart(prt[2], 0, 1) - let prt[2] = strpart(prt[2], 1) + let prt[1] = matchstr(prt[2], '^.') + let prt[2] = substitute(prt[2], '^.', '', '') cal s:BuildPrompt(1) endf @@ -513,43 +510,42 @@ fu! s:PrtCurLeft() if !empty(s:prompt[0]) let prt = s:prompt let prt[2] = prt[1] . prt[2] - let prt[1] = strpart(prt[0], strlen(prt[0]) - 1) - let prt[0] = strpart(prt[0], -1, strlen(prt[0])) + let prt[1] = matchstr(prt[0], '.$') + let prt[0] = substitute(prt[0], '.$', '', '') en cal s:BuildPrompt(0) endf fu! s:PrtCurRight() let prt = s:prompt - let prt[0] = prt[0] . prt[1] - let prt[1] = strpart(prt[2], 0, 1) - let prt[2] = strpart(prt[2], 1) + let prt[0] .= prt[1] + let prt[1] = matchstr(prt[2], '^.') + let prt[2] = substitute(prt[2], '^.', '', '') cal s:BuildPrompt(0) endf fu! s:PrtCurStart() - let prt = s:prompt - let str = join(prt, '') - let [prt[0], prt[1], prt[2]] = ['', strpart(str, 0, 1), strpart(str, 1)] + let str = join(s:prompt, '') + let s:prompt = ['', matchstr(str, '^.'), substitute(str, '^.', '', '')] cal s:BuildPrompt(0) endf fu! s:PrtCurEnd() - let prt = s:prompt - let [prt[0], prt[1], prt[2]] = [join(prt, ''), '', ''] + let s:prompt = [join(s:prompt, ''), '', ''] cal s:BuildPrompt(0) endf fu! s:PrtSelectMove(dir) - let torb = { 't': 'gg', 'b': 'G' } - exe 'keepj norm!' ( a:dir =~ '^[tb]$' ? torb[a:dir] : a: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 !exists('g:ctrlp_nolimit') | let s:cline = line('.') | en if line('$') > winheight(0) | cal s:BuildPrompt(0, s:Focus()) | en endf fu! s:PrtSelectJump(char, ...) let lines = copy(s:matched) - if exists('a:1') + if a:0 cal map(lines, 'split(v:val, ''[\/]\ze[^\/]\+$'')[-1]') en " Cycle through matches, use s:jmpchr to store last jump @@ -619,15 +615,16 @@ endf " * MapKeys() {{{1 fu! s:MapKeys(...) " Normal keys - let pfunc = exists('a:1') && !a:1 ? 'PrtSelectJump' : 'PrtAdd' + let pfunc = a:0 && !a:1 ? 'PrtSelectJump' : 'PrtAdd' let dojmp = s:byfname && pfunc == 'PrtSelectJump' ? ', 1' : '' for each in range(32, 126) let cmd = "nn \ \ \ :\cal \%s(\"%s\"%s)\" exe printf(cmd, each, pfunc, escape(nr2char(each), '"|\'), dojmp) endfo - if exists('a:2') | retu | en " Special keys - cal call('s:MapSpecs', exists('a:1') && !a:1 ? [1] : []) + if a:0 < 2 + cal call('s:MapSpecs', a:0 && !a:1 ? [1] : []) + en endf fu! s:MapSpecs(...) @@ -638,7 +635,7 @@ fu! s:MapSpecs(...) exe s:lcmap.' ['.each endfo en - if exists('a:1') + if a:0 for ke in s:prtunmaps | for kp in s:prtmaps[ke] exe s:lcmap kp '' endfo | endfo @@ -677,11 +674,11 @@ fu! s:ToggleType(dir) let s:itemtype = s:walker(g:ctrlp_builtins + ext, s:itemtype, a:dir) if s:byfname && !s:ispathitem() | let s:byfname = 0 | en unl! g:ctrlp_nolimit - cal s:SetLines(s:itemtype) - cal s:PrtSwitcher() if has('syntax') && exists('g:syntax_on') cal s:syntax() en + cal s:SetLines(s:itemtype) + cal s:PrtSwitcher() endf fu! s:PrtSwitcher() @@ -691,12 +688,12 @@ fu! s:PrtSwitcher() endf fu! s:SetWD(...) "{{{1 let pathmode = s:pathmode - if exists('a:1') && len(a:1) | if type(a:1) + if a:0 && strlen(a:1) | if type(a:1) cal ctrlp#setdir(a:1) | retu el let pathmode = a:1 en | en - if !exists('a:2') + if a:0 < 2 if match(s:crfile, '^\<.\+\>://.*') >= 0 || !pathmode | retu | en if exists('+acd') | let [s:glb_acd, &acd] = [&acd, 0] | en cal ctrlp#setdir(s:crfpath) @@ -716,11 +713,11 @@ endf fu! ctrlp#acceptfile(mode, matchstr, ...) let [md, filpath] = [a:mode, fnamemodify(a:matchstr, ':p')] cal s:PrtExit() - let [bufnr, tail] = [bufnr(filpath), s:tail()] + let [bufnr, tail] = [bufnr('^'.filpath.'$'), s:tail()] + let j2l = a:0 ? a:1 : str2nr(matchstr(tail, '^ +\D*\zs\d\+\ze\D*')) if s:jmptobuf && bufnr > 0 && md =~ 'e\|t' let [jmpb, bufwinnr] = [1, bufwinnr(bufnr)] let buftab = s:jmptobuf > 1 ? s:buftab(bufnr, md) : [0, 0] - let j2l = a:0 ? a:1 : str2nr(matchstr(tail, '^ +\D*\zs\d\+\ze\D*')) en " Switch to existing buffer or open new one if exists('jmpb') && bufwinnr > 0 && md != 't' @@ -739,11 +736,15 @@ fu! ctrlp#acceptfile(mode, matchstr, ...) \ 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, ''] + if useb + let [swb, &swb] = [&swb, ''] + en " Open new window/buffer - let fid = useb ? bufnr : filpath - cal call('s:openfile', a:0 ? [cmd, fid, ' +'.a:1] : [cmd, fid]) - let &swb = swb + let args = [cmd, useb ? bufnr : filpath, a:0 ? ' +'.a:1 : tail, useb, j2l] + cal call('s:openfile', args) + if useb + let &swb = swb + en en endf @@ -805,7 +806,7 @@ fu! s:CreateNewFile(...) "{{{1 let optyp = str | en | el | let optyp = fname en if !exists('optyp') | retu | en - let filpath = fnamemodify(optyp, ':p') + let [filpath, tail] = [fnamemodify(optyp, ':p'), s:tail()] cal s:insertcache(str) cal s:PrtExit() let cmd = md == 'r' ? ctrlp#normcmd('e') : @@ -813,7 +814,7 @@ fu! s:CreateNewFile(...) "{{{1 \ 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) + cal s:openfile(cmd, filpath, tail) endf " * OpenMulti() {{{1 fu! s:MarkToOpen() @@ -860,8 +861,9 @@ fu! s:OpenMulti() cal s:sanstail(join(s:prompt, '')) cal s:PrtExit() " Move the cursor to a reusable window - let emptytail = empty(s:tail()) - let useb = bufnr(mkd[0]) > 0 && emptytail + let tail = s:tail() + let emptytail = empty(tail) + let useb = bufnr('^'.mkd[0].'$') > 0 && emptytail let fst = call('ctrlp#normcmd', useb ? ['b', 'bo vert sb'] : ['e']) " Check if it's a replaceable buffer let repabl = ( empty(bufname('%')) && empty(&l:ft) ) || s:nosplit() @@ -871,12 +873,12 @@ fu! s:OpenMulti() let [swb, &swb] = [&swb, ''] " Open the files for va in mkd - let bufnr = bufnr(va) + let bufnr = bufnr('^'.va.'$') let useb = bufnr > 0 && emptytail let snd = md != '' && has_key(cmds, md) \ ? ( useb ? cmds[md][0] : cmds[md][1] ) : ( useb ? 'vert sb' : 'vne' ) let fid = useb ? bufnr : va - cal s:openfile(ic == 1 && ( ucr == 'r' || repabl ) ? fst : snd, fid) + cal s:openfile(ic == 1 && ( ucr == 'r' || repabl ) ? fst : snd, fid, tail) if ( nr != '' && nr > 1 && nr < ic ) || ( nr == '' && ic > 1 ) sil! hid clo! | el | let ic += 1 en @@ -906,8 +908,9 @@ endf fu! s:comparent(s1, s2) " By same parent dir - if match(s:crfpath, escape(getcwd(), '.^$*\')) >= 0 - let [as1, as2] = [fnamemodify(a:s1, ':p'), fnamemodify(a:s2, ':p')] + let cwd = getcwd() + if match(s:crfpath, escape(cwd, '.^$*\')) >= 0 + let [as1, as2] = [cwd.s:lash().a:s1, cwd.s:lash().a:s2] 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 @@ -917,13 +920,14 @@ fu! s:comparent(s1, s2) endf fu! s:matchlens(str, pat, ...) - if empty(a:pat) || index(['^','$'], a:pat) >= 0 | retu {} | en - let st = exists('a:1') ? a:1 : 0 - let lens = exists('a:2') ? a:2 : {} - let nr = exists('a:3') ? a:3 : 0 - if match(a:str, a:pat, st) != -1 + 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 : [len(mst), mst] }) + let lens = extend(lens, { nr : [strlen(mst), mst] }) let lens = s:matchlens(a:str, a:pat, mnd, lens, nr + 1) en retu lens @@ -944,6 +948,10 @@ fu! s:mixedsort(s1, s2) en retu 2 * cml + cln endf + +fu! s:compval(...) + retu a:1 - a:2 +endf " Statusline {{{2 fu! ctrlp#statusline() if !exists('s:statypes') @@ -970,12 +978,12 @@ fu! ctrlp#statusline() let args = [focus, byfname, s:regexp, prv, item, nxt, marked] let &l:stl = call(s:status['main'], args) el - let item = '%#Character# '.item.' %*' - let focus = '%#LineNr# '.focus.' %*' - let byfname = '%#Character# '.byfname.' %*' - let regex = s:regexp ? '%#LineNr# regex %*' : '' + let item = '%#CtrlPMode1# '.item.' %*' + let focus = '%#CtrlPMode2# '.focus.' %*' + let byfname = '%#CtrlPMode1# '.byfname.' %*' + let regex = s:regexp ? '%#CtrlPMode2# regex %*' : '' let slider = ' <'.prv.'>={'.item.'}=<'.nxt.'>' - let dir = ' %=%<%#LineNr# '.getcwd().' %*' + let dir = ' %=%<%#CtrlPMode2# '.getcwd().' %*' let &l:stl = focus.byfname.regex.slider.marked.dir en endf @@ -988,7 +996,7 @@ endf fu! ctrlp#progress(enum) if has('macunix') || has('mac') | sl 1m | en let &l:stl = has_key(s:status, 'prog') ? call(s:status['prog'], [a:enum]) - \ : '%#Function# '.a:enum.' %* %=%<%#LineNr# '.getcwd().' %*' + \ : '%#CtrlPStats# '.a:enum.' %* %=%<%#CtrlPMode2# '.getcwd().' %*' redr endf " Paths {{{2 @@ -1114,37 +1122,37 @@ fu! ctrlp#fnesc(path) endf fu! ctrlp#setdir(path, ...) - let cmd = exists('a:1') ? a:1 : 'lc!' - try - exe cmd.' '.ctrlp#fnesc(a:path) - cat - cal ctrlp#msg("Can't change working directory.") - endt + let cmd = a:0 ? a:1 : 'lc!' + sil! exe cmd ctrlp#fnesc(a:path) endf " Highlighting {{{2 fu! s:syntax() + for [ke, va] in items(s:hlgrps) | if !hlexists('CtrlP'.ke) + exe 'hi link CtrlP'.ke va + en | endfo + if !hlexists('CtrlPLinePre') + \ && synIDattr(synIDtrans(hlID('Normal')), 'bg') !~ '^-1$\|^$' + sil! exe 'hi CtrlPLinePre '.( has("gui_running") ? 'gui' : 'cterm' ).'fg=bg' + en sy match CtrlPNoEntries '^ == NO ENTRIES ==$' - sy match CtrlPLinePre '^>' - hi link CtrlPNoEntries Error - if exists('g:colors_name') - exe 'hi CtrlPLinePre '.( has("gui_running") ? 'gui' : 'cterm' ).'fg=bg' + if hlexists('CtrlPLinePre') + sy match CtrlPLinePre '^>' en endf -fu! s:highlight(pat, grp, bfn) +fu! s:highlight(pat, grp) cal clearmatches() if !empty(a:pat) && s:ispathitem() - let pat = substitute(a:pat, '\~', '\\~', 'g') - let pat = s:regexp - \ ? substitute(pat, '\\\@ \\zs', 'g') - \ : escape(pat, '.') - " Match only filename - if s:byfname && a:bfn + let pat = s:regexp ? substitute(a:pat, '\\\@ \\zs', 'g') : a:pat + if s:byfname + " Match only filename let pat = substitute(pat, '\[\^\(.\{-}\)\]\\{-}', '[^\\/\1]\\{-}', 'g') - let pat = substitute(pat, '$', '\\ze[^\\/]*$', 'g') + let pat = substitute(pat, '\$\@') + if hlexists('CtrlPLinePre') + cal matchadd('CtrlPLinePre', '^>') + en en endf @@ -1268,7 +1276,7 @@ endf fu! s:leavepre() if s:clrex && ( !has('clientserver') || \ ( has('clientserver') && len(split(serverlist(), "\n")) == 1 ) ) - cal ctrlp#clra(1) + cal ctrlp#clra() en endf @@ -1313,6 +1321,7 @@ fu! s:argmaps(md, ...) endf " Misc {{{2 fu! s:getenv() + let s:winh = min([s:mxheight, &lines]) let [s:cwd, s:winres] = [getcwd(), [winrestcmd(), &lines, winnr('$')]] let [s:crfile, s:crfpath] = [expand('%:p', 1), expand('%:p:h', 1)] let [s:crword, s:crline] = [expand(''), getline('.')] @@ -1347,31 +1356,26 @@ fu! s:migemo(str) let [tokens, str, cmd] = [split(str, '\s'), '', 'cmigemo -v -w %s -d %s'] for token in tokens let rtn = system(printf(cmd, shellescape(token), shellescape(dict))) - let str .= !v:shell_error && len(rtn) > 0 ? '.*'.rtn : token + let str .= !v:shell_error && strlen(rtn) > 0 ? '.*'.rtn : token endfo en retu str endf -fu! ctrlp#msg(msg) - redr | echoh Identifier | echon "CtrlP: ".a:msg | echoh None -endf - -fu! s:openfile(cmd, filpath, ...) +fu! s:openfile(cmd, fid, tail, ...) let cmd = a:cmd =~ '^[eb]$' && &modified ? 'hid '.a:cmd : a:cmd let cmd = cmd =~ '^tab' ? tabpagenr('$').cmd : cmd - let tail = a:0 ? a:1 : s:tail() - try - exe cmd.tail.' '.ctrlp#fnesc(a:filpath) - cat - fina - if !empty(tail) - sil! norm! zvzz - en - if exists('*haslocaldir') - cal ctrlp#setdir(getcwd(), haslocaldir() ? 'lc!' : 'cd!') - en - endt + let j2l = a:0 && a:1 ? a:2 : 0 + exe cmd.( a:0 && a:1 ? '' : a:tail ) ctrlp#fnesc(a:fid) + if j2l + exe j2l + en + if !empty(a:tail) || j2l + sil! norm! zvzz + en + if exists('*haslocaldir') + cal ctrlp#setdir(getcwd(), haslocaldir() ? 'lc!' : 'cd!') + en endf fu! s:writecache(read_cache, cache_file) @@ -1494,9 +1498,11 @@ fu! ctrlp#init(type, ...) cal s:Open() cal s:SetWD(a:0 ? a:1 : '') cal s:MapKeys() + if has('syntax') && exists('g:syntax_on') + cal s:syntax() + en cal s:SetLines(a:type) cal s:BuildPrompt(1) - if has('syntax') && exists('g:syntax_on') | cal s:syntax() | en endf if has('autocmd') "{{{1 aug CtrlPAug diff --git a/bundle_consider/ctrlp/autoload/ctrlp/buffertag.vim b/bundle/git_ctrlp/autoload/ctrlp/buffertag.vim similarity index 97% rename from bundle_consider/ctrlp/autoload/ctrlp/buffertag.vim rename to bundle/git_ctrlp/autoload/ctrlp/buffertag.vim index e16308e..a45d507 100644 --- a/bundle_consider/ctrlp/autoload/ctrlp/buffertag.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/buffertag.vim @@ -165,9 +165,6 @@ fu! s:esctagscmd(bin, args, ...) let last = s:enc != &enc ? s:enc : !empty($LANG) ? $LANG : &enc let cmd = iconv(cmd, &enc, last) en - if empty(cmd) - cal ctrlp#msg("Encoding conversion failed!") - en retu cmd endf @@ -196,7 +193,7 @@ fu! s:parseline(line) let eval = '\v^([^\t]+)\t(.+)\t\/\^(.+)\$\/\;\"\t(.+)\tline(no)?\:(\d+)' let vals = matchlist(a:line, eval) if empty(vals) | retu '' | en - let [bufnr, bufname] = [bufnr(vals[2]), fnamemodify(vals[2], ':p:t')] + let [bufnr, bufname] = [bufnr('^'.vals[2].'$'), fnamemodify(vals[2], ':p:t')] retu vals[1].' '.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'| '.vals[3] endf " Public {{{1 @@ -208,8 +205,10 @@ fu! ctrlp#buffertag#init(fname) let tftype = get(split(getbufvar(each, '&ft'), '\.'), 0, '') cal extend(lines, s:process(each, tftype)) endfo + if !hlexists('CtrlPTabExtra') + hi link CtrlPTabExtra Comment + en sy match CtrlPTabExtra '\zs\t.*\ze$' - hi link CtrlPTabExtra Comment retu lines endf diff --git a/bundle_consider/ctrlp/autoload/ctrlp/dir.vim b/bundle/git_ctrlp/autoload/ctrlp/dir.vim similarity index 96% rename from bundle_consider/ctrlp/autoload/ctrlp/dir.vim rename to bundle/git_ctrlp/autoload/ctrlp/dir.vim index 76b2dfc..982f298 100644 --- a/bundle_consider/ctrlp/autoload/ctrlp/dir.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/dir.vim @@ -57,13 +57,13 @@ fu! ctrlp#dir#init(...) cal s:globdirs(s:cwd, 0) cal ctrlp#rmbasedir(g:ctrlp_alldirs) let read_cache = 0 + if len(g:ctrlp_alldirs) <= s:compare_lim + cal sort(g:ctrlp_alldirs, 'ctrlp#complen') + en el let g:ctrlp_alldirs = ctrlp#utils#readfile(cafile) let read_cache = 1 en - if len(g:ctrlp_alldirs) <= s:compare_lim - cal sort(g:ctrlp_alldirs, 'ctrlp#complen') - en if !read_cache cal ctrlp#utils#writecache(g:ctrlp_alldirs, cadir, cafile) let g:ctrlp_newdir = 0 diff --git a/bundle_consider/ctrlp/autoload/ctrlp/line.vim b/bundle/git_ctrlp/autoload/ctrlp/line.vim similarity index 92% rename from bundle_consider/ctrlp/autoload/ctrlp/line.vim rename to bundle/git_ctrlp/autoload/ctrlp/line.vim index 606b65a..903bbf9 100644 --- a/bundle_consider/ctrlp/autoload/ctrlp/line.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/line.vim @@ -35,7 +35,7 @@ fu! ctrlp#line#init() for each in bufs let from_file = readfile(each) cal map(from_file, 'tr(v:val, '' '', '' '')') - let [id, len_ff, bufnr] = [1, len(from_file), bufnr(each)] + let [id, len_ff, bufnr] = [1, len(from_file), bufnr('^'.each.'$')] wh id <= len_ff let from_file[id-1] .= ' #:'.bufnr.':'.id let id += 1 @@ -43,8 +43,10 @@ fu! ctrlp#line#init() cal filter(from_file, 'v:val !~ ''^\s*\t#:\d\+:\d\+$''') cal extend(lines, from_file) endfo + if !hlexists('CtrlPTabExtra') + hi link CtrlPTabExtra Comment + en sy match CtrlPTabExtra '\zs\t.*\ze$' - hi link CtrlPTabExtra Comment retu lines endf diff --git a/bundle_consider/ctrlp/autoload/ctrlp/mrufiles.vim b/bundle/git_ctrlp/autoload/ctrlp/mrufiles.vim similarity index 74% rename from bundle_consider/ctrlp/autoload/ctrlp/mrufiles.vim rename to bundle/git_ctrlp/autoload/ctrlp/mrufiles.vim index e3d6d0c..12b4a17 100644 --- a/bundle_consider/ctrlp/autoload/ctrlp/mrufiles.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/mrufiles.vim @@ -8,10 +8,10 @@ fu! ctrlp#mrufiles#opts() let opts = { \ 'g:ctrlp_mruf_max': ['s:max', 250], - \ 'g:ctrlp_mruf_include': ['s:include', ''], - \ 'g:ctrlp_mruf_exclude': ['s:exclude', ''], + \ 'g:ctrlp_mruf_include': ['s:in', ''], + \ 'g:ctrlp_mruf_exclude': ['s:ex', ''], \ 'g:ctrlp_mruf_case_sensitive': ['s:csen', 1], - \ 'g:ctrlp_mruf_relative': ['s:relate', 0], + \ 'g:ctrlp_mruf_relative': ['s:re', 0], \ 'g:ctrlp_mruf_last_entered': ['s:mre', 0], \ } for [ke, va] in items(opts) @@ -24,11 +24,10 @@ fu! ctrlp#mrufiles#list(bufnr, ...) "{{{1 if s:locked | retu | en let bufnr = a:bufnr + 0 if bufnr > 0 - let filename = fnamemodify(bufname(bufnr), ':p') - if empty(filename) || !empty(&bt) - \ || ( !empty(s:include) && filename !~# s:include ) - \ || ( !empty(s:exclude) && filename =~# s:exclude ) - \ || !filereadable(filename) + let fn = fnamemodify(bufname(bufnr), ':p') + let fn = exists('+ssl') ? tr(fn, '/', '\') : fn + if empty(fn) || !empty(&bt) || ( !empty(s:in) && fn !~# s:in ) + \ || ( !empty(s:ex) && fn =~# s:ex ) || !filereadable(fn) retu en en @@ -45,31 +44,34 @@ fu! ctrlp#mrufiles#list(bufnr, ...) "{{{1 " Remove non-existent files if a:0 && a:1 == 1 cal filter(mrufs, '!empty(ctrlp#utils#glob(v:val, 1)) && !s:excl(v:val)') + if exists('+ssl') + cal map(mrufs, 'tr(v:val, ''/'', ''\'')') + cal filter(mrufs, 'count(mrufs, v:val) == 1') + en cal ctrlp#utils#writecache(mrufs, s:cadir, s:cafile) en " Return the list with the active buffer removed if bufnr == -1 let crf = fnamemodify(bufname(winbufnr(winnr('#'))), ':p') + let crf = exists('+ssl') ? tr(crf, '/', '\') : crf let mrufs = empty(crf) ? mrufs : filter(mrufs, 'v:val !='.s:csen.' crf') - if s:relate - let cwd = getcwd() + if s:re + let cwd = exists('+ssl') ? tr(getcwd(), '/', '\') : getcwd() cal filter(mrufs, '!stridx(v:val, cwd)') - cal ctrlp#rmbasedir(mrufs) - el - cal map(mrufs, 'fnamemodify(v:val, '':.'')') en + cal map(mrufs, 'fnamemodify(v:val, '':.'')') retu mrufs en " Remove old entry - cal filter(mrufs, 'v:val !='.s:csen.' filename') + cal filter(mrufs, 'v:val !='.s:csen.' fn') " Insert new one - cal insert(mrufs, filename) + cal insert(mrufs, fn) " Remove oldest entry or entries if len(mrufs) > s:max | cal remove(mrufs, s:max, -1) | en cal ctrlp#utils#writecache(mrufs, s:cadir, s:cafile) endf "}}} -fu! s:excl(fname) "{{{ - retu !empty(s:exclude) && a:fname =~# s:exclude +fu! s:excl(fn) "{{{ + retu !empty(s:ex) && a:fn =~# s:ex endf "}}} fu! ctrlp#mrufiles#init() "{{{1 let s:locked = 0 diff --git a/bundle_consider/ctrlp/autoload/ctrlp/quickfix.vim b/bundle/git_ctrlp/autoload/ctrlp/quickfix.vim similarity index 88% rename from bundle_consider/ctrlp/autoload/ctrlp/quickfix.vim rename to bundle/git_ctrlp/autoload/ctrlp/quickfix.vim index 606eb53..3238762 100644 --- a/bundle_consider/ctrlp/autoload/ctrlp/quickfix.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/quickfix.vim @@ -30,8 +30,10 @@ endf " Public {{{1 fu! ctrlp#quickfix#init() let g:ctrlp_nolimit = 1 + if !hlexists('CtrlPqfLineCol') + hi link CtrlPqfLineCol Search + en sy match CtrlPqfLineCol '|\zs\d\+:\d\+\ze|' - hi def link CtrlPqfLineCol Search retu map(getqflist(), 's:lineout(v:val)') endf @@ -43,13 +45,9 @@ fu! ctrlp#quickfix#accept(mode, str) let cmd = md == 't' ? 'tabe' : md == 'h' ? 'new' : md == 'v' ? 'vne' \ : ctrlp#normcmd('e') let cmd = cmd == 'e' && &modified ? 'hid e' : cmd - try - exe cmd.' '.ctrlp#fnesc(filpath) - cat - cal ctrlp#msg("Invalid command or argument.") - fina - cal cursor(items[2], items[3]) | sil! norm! zvzz - endt + exe cmd ctrlp#fnesc(filpath) + cal cursor(items[2], items[3]) + sil! norm! zvzz endf fu! ctrlp#quickfix#id() diff --git a/bundle_consider/ctrlp/autoload/ctrlp/rtscript.vim b/bundle/git_ctrlp/autoload/ctrlp/rtscript.vim similarity index 61% rename from bundle_consider/ctrlp/autoload/ctrlp/rtscript.vim rename to bundle/git_ctrlp/autoload/ctrlp/rtscript.vim index a8cec52..dda9dd0 100644 --- a/bundle_consider/ctrlp/autoload/ctrlp/rtscript.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/rtscript.vim @@ -12,7 +12,7 @@ let [g:loaded_ctrlp_rtscript, g:ctrlp_newrts] = [1, 0] let s:rtscript_var = { \ 'init': 'ctrlp#rtscript#init()', - \ 'accept': 'ctrlp#rtscript#accept', + \ 'accept': 'ctrlp#acceptfile', \ 'lname': 'runtime scripts', \ 'sname': 'rts', \ 'type': 'path', @@ -24,18 +24,23 @@ let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars) let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) " Public {{{1 fu! ctrlp#rtscript#init() - if g:ctrlp_newrts || !exists('g:ctrlp_rtscache') + if g:ctrlp_newrts + \ || !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[0] == &rtp ) sil! cal ctrlp#progress('Indexing...') let entries = split(globpath(&rtp, '**/*.*'), "\n") - cal filter(entries, 'index(entries, v:val, v:key + 1) < 0') - cal map(entries, 'fnamemodify(v:val, '':.'')') - let [g:ctrlp_rtscache, g:ctrlp_newrts] = [ctrlp#dirnfile(entries)[1], 0] + cal filter(entries, 'count(entries, v:val) == 1') + let [entries, echoed] = [ctrlp#dirnfile(entries)[1], 1] + el + let [entries, results] = g:ctrlp_rtscache[2:3] en - retu g:ctrlp_rtscache -endf - -fu! ctrlp#rtscript#accept(mode, str) - cal ctrlp#acceptfile(a:mode, a:str) + let cwd = getcwd() + if g:ctrlp_newrts + \ || !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[:1] == [&rtp, cwd] ) + if !exists('echoed') | sil! cal ctrlp#progress('Processing...') | en + let results = map(copy(entries), 'fnamemodify(v:val, '':.'')') + en + let [g:ctrlp_rtscache, g:ctrlp_newrts] = [[&rtp, cwd, entries, results], 0] + retu results endf fu! ctrlp#rtscript#id() diff --git a/bundle_consider/ctrlp/autoload/ctrlp/tag.vim b/bundle/git_ctrlp/autoload/ctrlp/tag.vim similarity index 91% rename from bundle_consider/ctrlp/autoload/ctrlp/tag.vim rename to bundle/git_ctrlp/autoload/ctrlp/tag.vim index c4728f2..b43e4cd 100644 --- a/bundle_consider/ctrlp/autoload/ctrlp/tag.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/tag.vim @@ -72,8 +72,10 @@ fu! ctrlp#tag#init(tagfiles) let alltags = s:filter(ctrlp#utils#readfile(each)) cal extend(g:ctrlp_alltags, alltags) endfo + if !hlexists('CtrlPTabExtra') + hi link CtrlPTabExtra Comment + en sy match CtrlPTabExtra '\zs\t.*\ze$' - hi link CtrlPTabExtra Comment retu g:ctrlp_alltags endf @@ -90,19 +92,15 @@ fu! ctrlp#tag#accept(mode, str) \ } let cmd = fnd[0] == 1 ? cmds[md][0] : cmds[md][1] let cmd = cmd == 'tj' && &modified ? 'hid '.cmd : cmd - try - let cmd = cmd =~ '^tab' ? tabpagenr('$').cmd : cmd - if fnd[0] == 1 - if cmd != '' - exe cmd - en - exe fnd[1].'ta' tg - el - exe cmd.' '.tg + let cmd = cmd =~ '^tab' ? tabpagenr('$').cmd : cmd + if fnd[0] == 1 + if cmd != '' + exe cmd en - cat - cal ctrlp#msg("Tag not found.") - endt + exe fnd[1].'ta' tg + el + exe cmd tg + en endf fu! ctrlp#tag#id() diff --git a/bundle_consider/ctrlp/autoload/ctrlp/undo.vim b/bundle/git_ctrlp/autoload/ctrlp/undo.vim similarity index 94% rename from bundle_consider/ctrlp/autoload/ctrlp/undo.vim rename to bundle/git_ctrlp/autoload/ctrlp/undo.vim index 718c1ba..f4d4625 100644 --- a/bundle_consider/ctrlp/autoload/ctrlp/undo.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/undo.vim @@ -80,12 +80,14 @@ fu! s:humantime(nr) endf fu! s:syntax() + for [ke, va] in items({'T': 'Directory', 'Br': 'Comment', 'Nr': 'String'}) + if !hlexists('CtrlPUndo'.ke) + exe 'hi link CtrlPUndo'.ke va + en + endfo sy match CtrlPUndoT '\d\+ \zs[^ ]\+\ze' sy match CtrlPUndoBr '\[\|\]' sy match CtrlPUndoNr '\[\d\+\]$' contains=CtrlPUndoBr - hi link CtrlPUndoT Directory - hi link CtrlPUndoBr Comment - hi link CtrlPUndoNr String endf fu! s:dict2list(dict) diff --git a/bundle_consider/ctrlp/autoload/ctrlp/utils.vim b/bundle/git_ctrlp/autoload/ctrlp/utils.vim similarity index 86% rename from bundle_consider/ctrlp/autoload/ctrlp/utils.vim rename to bundle/git_ctrlp/autoload/ctrlp/utils.vim index c086c0c..b4af577 100644 --- a/bundle_consider/ctrlp/autoload/ctrlp/utils.vim +++ b/bundle/git_ctrlp/autoload/ctrlp/utils.vim @@ -33,9 +33,9 @@ fu! ctrlp#utils#cachedir() endf fu! ctrlp#utils#cachefile(...) - let tail = exists('a:1') ? '.'.a:1 : '' + let tail = a:0 ? '.'.a:1 : '' let cache_file = substitute(getcwd(), '\([\/]\|^\a\zs:\)', '%', 'g').tail.'.txt' - retu exists('a:1') ? cache_file : s:cache_dir.s:lash(s:cache_dir).cache_file + retu a:0 ? cache_file : s:cache_dir.s:lash(s:cache_dir).cache_file endf fu! ctrlp#utils#readfile(file) @@ -58,9 +58,9 @@ fu! ctrlp#utils#mkdir(dir) endf fu! ctrlp#utils#writecache(lines, ...) - if isdirectory(ctrlp#utils#mkdir(exists('a:1') ? a:1 : s:cache_dir)) - sil! cal writefile(a:lines, exists('a:2') ? a:2 : ctrlp#utils#cachefile()) - if !exists('a:1') + if isdirectory(ctrlp#utils#mkdir(a:0 ? a:1 : s:cache_dir)) + sil! cal writefile(a:lines, a:0 >= 2 ? a:2 : ctrlp#utils#cachefile()) + if !a:0 let g:ctrlp_newcache = 0 en en diff --git a/bundle_consider/ctrlp/doc/ctrlp.txt b/bundle/git_ctrlp/doc/ctrlp.txt similarity index 89% rename from bundle_consider/ctrlp/doc/ctrlp.txt rename to bundle/git_ctrlp/doc/ctrlp.txt index 98989c8..0a202cc 100644 --- a/bundle_consider/ctrlp/doc/ctrlp.txt +++ b/bundle/git_ctrlp/doc/ctrlp.txt @@ -1,4 +1,4 @@ -*ctrlp.txt* Fuzzy file, buffer, mru and tag finder. v1.6.9 +*ctrlp.txt* Fuzzy file, buffer, mru and tag finder. v1.7.1 *CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'* =============================================================================== # # @@ -28,7 +28,7 @@ Written in pure Vimscript for MacVim and Vim version 7.0+. Has full support for Vim’s |regexp| as search pattern, built-in MRU files monitoring, project’s root finder, and more. -To enable optional extensions (tag, quickfix, dir...), see |ctrlp-extensions|. +To enable optional extensions (tag, dir, rtscript...), see |ctrlp-extensions|. =============================================================================== 2. Options *ctrlp-options* @@ -77,8 +77,8 @@ Set the maximum height of the match window: > < *'g:ctrlp_jump_to_buffer'* -When opening a file, if it's already opened somewhere |CtrlP| will try to jump -to it instead of opening a new window or new tab: > +When opening a file with or , if the file's already opened somewhere +|CtrlP| will try to jump to it instead of opening a new instance: > let g:ctrlp_jump_to_buffer = 2 < 1 - only jump to the buffer if it’s opened in the current tab. @@ -86,8 +86,10 @@ to it instead of opening a new window or new tab: > 0 - disable this feature. *'g:ctrlp_working_path_mode'* -When starting up the prompt, temporarily set the working directory (i.e. the -|current-directory|) to: +When starting up, |CtrlP| sets its local working directory according to this +variable: > + let g:ctrlp_working_path_mode = 2 +< 1 - the parent directory of the current file. 2 - the nearest ancestor that contains one of these directories/files: .git/ @@ -96,9 +98,6 @@ When starting up the prompt, temporarily set the working directory (i.e. the _darcs/ root.dir 0 - don’t manage working directory. -> - let g:ctrlp_working_path_mode = 2 -< *'g:ctrlp_root_markers'* Use this to set your own root markers in addition to the default ones. Your @@ -106,7 +105,7 @@ markers will take precedence: > let g:ctrlp_root_markers = [''] < These markers (builtins and yours) will serve as identifiers for the '/' and -'\' special inputs (section 5.e) +'\' special inputs (section 5.e). *'g:ctrlp_use_caching'* Set this to 0 to disable per-session caching. When disabled, caching will still @@ -116,7 +115,7 @@ be enabled for directories that have more than 4000 files: > Note: you can quickly purge the cache by pressing while inside |CtrlP|. *'g:ctrlp_clear_cache_on_exit'* -Set this to 0 to enable cross-sessions caching by not clearing the cache files +Set this to 0 to enable cross-session caching by not deleting the cache files upon exiting Vim: > let g:ctrlp_clear_cache_on_exit = 1 < @@ -138,7 +137,7 @@ only need to keep the lines that you’ve changed the values (inside []): > \ 'PrtSelectMove("k")': ['', ''], \ 'PrtHistory(-1)': [''], \ 'PrtHistory(1)': [''], - \ 'AcceptSelection("e")': ['', '', '<2-LeftMouse>'], + \ 'AcceptSelection("e")': ['', '<2-LeftMouse>'], \ 'AcceptSelection("h")': ['', '', ''], \ 'AcceptSelection("t")': ['', ''], \ 'AcceptSelection("v")': ['', ''], @@ -147,8 +146,8 @@ only need to keep the lines that you’ve changed the values (inside []): > \ 'ToggleByFname()': [''], \ 'ToggleType(1)': ['', ''], \ 'ToggleType(-1)': ['', ''], - \ 'PrtExpandDir()': ['', ''], - \ 'PrtInsert("w")': [''], + \ 'PrtExpandDir()': [''], + \ 'PrtInsert("w")': ['', ''], \ 'PrtInsert("s")': [''], \ 'PrtInsert("v")': [''], \ 'PrtInsert("+")': [''], @@ -165,8 +164,9 @@ only need to keep the lines that you’ve changed the values (inside []): > \ } < Note: In some terminals, it’s not possible to remap without also changing -. So if pressing moves the cursor to the left instead of deleting a -char for you, add this to your |vimrc| to change the default mapping: > + (|key-codes|). So if pressing moves the cursor to the left instead of +deleting a char for you, add this to your |vimrc| to change the default +mapping: > let g:ctrlp_prompt_mappings = { \ 'PrtBS()': ['', '', ''], \ 'PrtCurLeft()': ['', ''], @@ -217,7 +217,8 @@ Set this to 0 if you don’t want |CtrlP| to search for dotfiles and dotdirs: > let g:ctrlp_dotfiles = 1 < You can use |'wildignore'| to exclude anything from the search. -e.g. exclude version control directories: > +Examples: > + " Excluding version control directories set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " Linux/MacOSX set wildignore+=.git\*,.hg\*,.svn\* " Windows < @@ -225,7 +226,7 @@ Note #1: the `*/` in front of each directory glob is required. Note #2: |wildignore| influences the result of |expand()|, |globpath()| and |glob()| which many plugins use to find stuff on the system (e.g. fugitive.vim -looks for .git/, some other plugins look for external exe tools on Windows). +looks for .git/, some other plugins look for external .exe tools on Windows). So be a little mindful of what you put in your |wildignore|. *'g:ctrlp_custom_ignore'* @@ -238,7 +239,7 @@ Examples: > let g:ctrlp_custom_ignore = { \ 'dir': '\.git$\|\.hg$\|\.svn$', \ 'file': '\.exe$\|\.so$\|\.dll$', - \ 'link': 'some$\|bad$\|symbolic$\|links$', + \ 'link': 'SOME_BAD_SYMBOLIC_LINKS', \ } < @@ -250,7 +251,7 @@ the highlight group that’ll be used: > *'g:ctrlp_max_files'* The maximum number of files to scan, set to 0 for no limit: > - let g:ctrlp_max_files = 20000 + let g:ctrlp_max_files = 10000 < *'g:ctrlp_max_depth'* @@ -260,8 +261,8 @@ The maximum depth of a directory tree to recurse into: > Note: the larger these values, the more memory Vim uses. *'g:ctrlp_user_command'* -Specify an external tool to use for listing files instead of Vim’s globpath(). -Use %s in place of the target directory: > +Specify an external tool to use for listing files instead of using Vim’s +|globpath()|. Use %s in place of the target directory: > let g:ctrlp_user_command = '' < Examples: > @@ -275,14 +276,28 @@ Examples: > < Use a version control listing command when inside a repository, this is faster when scanning large projects: > - let g:ctrlp_user_command = [repo_marker, vcs_ls_command, fallback_command] + let g:ctrlp_user_command = [root_marker, listing_command, fallback_command] + let g:ctrlp_user_command = { + \ 'types': { + \ 1: [root_marker_1, listing_command_1], + \ n: [root_marker_n, listing_command_n], + \ }, + \ 'fallback': fallback_command + \ } < -If the fallback_command is empty or not defined, |globpath()| will then be used -when searching outside a repo. Examples: > let g:ctrlp_user_command = ['.git/', 'cd %s && git ls-files'] let g:ctrlp_user_command = ['.hg/', 'hg --cwd %s locate -I .'] + let g:ctrlp_user_command = { + \ 'types': { + \ 1: ['.git/', 'cd %s && git ls-files'], + \ 2: ['.hg/', 'hg --cwd %s locate -I .'], + \ }, + \ 'fallback': 'find %s -type f' + \ } < +If the fallback_command is empty or not defined, |globpath()| will then be used +when searching outside a repo. *'g:ctrlp_max_history'* The maximum number of input strings you want |CtrlP| to remember. The default @@ -332,7 +347,7 @@ Pressing or will then prompt for a keypress. The key can be: h - open in horizontal split(s) v - open in vertical split(s) r - open in current window (for only) - , - cancel and go back to |CtrlP| + , - cancel and go back to the prompt. Any other key - use the behavior specified with |g:ctrlp_open_new_file| and |g:ctrlp_open_multi|. @@ -401,10 +416,11 @@ See https://gist.github.com/1610859 for a working example. :ClearCtrlPCache Flush the cache for the current working directory. The same as pressing inside |CtrlP|. + You can also enable/disable caching with the option |g:ctrlp_use_caching|. *:ClearAllCtrlPCaches* :ClearAllCtrlPCaches - Delete all the cache files saved in |ctrlp_cache_dir|. + Delete all the cache files saved in |g:ctrlp_cache_dir|. *:ResetCtrlP* :ResetCtrlP @@ -438,7 +454,7 @@ Once inside the prompt:~ See also |input-formats| (guide) and |g:ctrlp_regexp_search| (option). - Toggle between full path search and filename only search. + Toggle between full-path search and filename only search. (note: in filename mode, the prompt’s base is '>d>' instead of '>>>') , 'forward' @@ -529,14 +545,18 @@ Once inside the prompt:~ Clear MRU list. + + Insert the word under the cursor (in the active buffer) into the prompt. + , , - Exit |CtrlP|. can also be used to stop the scan. + Exit |CtrlP|. + can also be used to stop the scan if it’s taking too long. Choose your own mappings with |g:ctrlp_prompt_mappings|. -When inside the match window (press to switch):~ +When inside the match window (press to switch):~ a-z 0-9 @@ -643,7 +663,7 @@ Available extensions:~ * Runtime script mode:~ - Name: 'rtscript' - Command: ':CtrlPRTS' - - Search for files (vimscripts, docs...) in runtimepath. + - Search for files (vimscripts, docs, snippets...) in runtimepath. ------------------------------------------------------------------------------- Buffer Tag mode options:~ @@ -674,49 +694,42 @@ Examples: > < =============================================================================== -EXTENDING *ctrlp-extending* +CUSTOMIZATION *ctrlp-customization* -Extending |CtrlP| is very simple. Simply create a vim file following a short -guidelines, place it in autoload/ctrlp/ and add its name to your .vimrc. +Highlighting:~ + * For the |CtrlP| buffer: + CtrlPNoEntries : the message when no match is found (Error) + CtrlPMatch : the matched pattern (Identifier) + CtrlPLinePre : the line prefix '>' in the match window + CtrlPPrtBase : the prompt’s base (Comment) + CtrlPPrtText : the prompt’s text (|hl-Normal|) + CtrlPPrtCursor : the prompt’s cursor when moving over the text (Constant) -To see how it works, get the sample.vim from the extensions branch on the main -git repository (https://github.com/kien/ctrlp.vim/tree/extensions), and place -it along with the parent directories somewhere in your runtimepath. Then put -this into your .vimrc: > - let g:ctrlp_extensions = ['sample'] -< -A new search type will show up the next time you open |CtrlP|. + * In extensions: + CtrlPTabExtra : the part of each line that’s not matched against (Comment) + CtrlPqfLineCol : the line and column numbers in quickfix mode (|hl-Search|) + CtrlPUndoT : the elapsed time in undo mode (|hl-Directory|) + CtrlPUndoBr : the square brackets [] in undo mode (Comment) + CtrlPUndoNr : the undo number inside [] in undo mode (String) -For more details, check out the comments inside sample.vim.~ +Statuslines:~ + * Highlight groups: + CtrlPMode1 : 'prt' or 'win', also for 'regex' (Character) + CtrlPMode2 : 'file' or 'path', also for the local working dir (|hl-LineNr|) + CtrlPStats : the scanning status (Function) -=============================================================================== -USER-CONFIGURATION *ctrlp-user-config* - -Some miscellaneous configurations:~ - -+) |g:ctrlp_user_command| config that makes use of your |wildignore| setting: - https://github.com/kien/ctrlp.vim/issues/70 by Rich Alesi + For rebuilding the statuslines, see |g:ctrlp_status_func|. =============================================================================== CREDITS *ctrlp-credits* -Developed by Kien Nguyen , initially based on the Command-T -and the LustyExplorer plugins. No code was taken from these plugins, but I did -clone the majority of their (awesome) interfaces and the way they work. +Developed by Kien Nguyen . -This was originally written as a module for a would-be larger plugin called -AutoDoc.vim which I’ve stopped developing because of lost of interest. I really -liked the way Command-T and LustyExplorer deal with user’s input, so I wrote a -pure Vimscript version of their prompt window, intended to use it for the -aforementioned plugin. - -Homepage: http://kien.github.com/ctrlp.vim +Project’s homepage: http://kien.github.com/ctrlp.vim Git repository: https://github.com/kien/ctrlp.vim Mercurial repository: https://bitbucket.org/kien/ctrlp.vim -=============================================================================== -THANKS *ctrlp-thanks* - +------------------------------------------------------------------------------- Thanks to everyone that has submitted ideas, bug reports or helped debugging on gibhub, bitbucket, and through email. @@ -742,6 +755,7 @@ Special thanks:~ * Zak Johnson * Diego Viola * Thibault Duplessis + * Tacahiroy Bugfixes/Corrections. =============================================================================== diff --git a/bundle_consider/ctrlp/plugin/ctrlp.vim b/bundle/git_ctrlp/plugin/ctrlp.vim similarity index 100% rename from bundle_consider/ctrlp/plugin/ctrlp.vim rename to bundle/git_ctrlp/plugin/ctrlp.vim diff --git a/bundle/git_ctrlp/readme.md b/bundle/git_ctrlp/readme.md new file mode 100644 index 0000000..8d106fe --- /dev/null +++ b/bundle/git_ctrlp/readme.md @@ -0,0 +1,79 @@ +# ctrlp.vim +Full path fuzzy __file__, __buffer__, __mru__ and __tag__ finder for Vim. + +* Written in pure Vimscript for MacVim and Vim 7.0+. +* Full support for Vim’s regexp as search pattern. +* Built-in Most Recently Used (MRU) files monitoring. +* Built-in project’s root finder. +* Open Multiple Files. +* [Extensible][3]. + +![ctrlp][1] + +## Basic Usage +* Press `` or run `:CtrlP` to invoke CtrlP in find file mode. +* Or run `:CtrlPBuffer` or `:CtrlPMRU` to invoke CtrlP in buffer or MRU mode. + +Once CtrlP is open: + +* Press `` and `` to switch between find file, buffer, and MRU file modes. +* Press `` to switch to filename only search instead of full path. +* Press `` to purge the cache for the current directory and get new files. +* Use `*` or `|` in the prompt to submit the string as a Vim’s regexp pattern. +* Or press `` to switch to regexp mode. +* End the input string with a colon `:` followed by a command to execute after opening the file. +e.g. `abc:45` will open the file matched the pattern and jump to line 45. +* Submit two dots `..` as the input string to go backward the directory tree by 1 level. +* Use `` to create a new file and its parent dirs. +* Use `` to mark/unmark files and `` to open them. + +## Basic Options +* Change the mapping to invoke CtrlP: + + ```vim + let g:ctrlp_map = '' + ``` + +* When CtrlP is invoked, it automatically sets the working directory according to this variable: + + ```vim + let g:ctrlp_working_path_mode = 2 + ``` + + 0 - don’t manage working directory. + 1 - the parent directory of the current file. + 2 - the nearest ancestor that contains one of these directories or files: + + .git/ + .hg/ + .bzr/ + _darcs/ + root.dir + +* If you want to exclude directories or files from the search, you can use the Vim’s option `wildignore` +and/or the option `g:ctrlp_custom_ignore`. Examples: + + ```vim + set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " for Linux/MacOSX + set wildignore+=.git\*,.hg\*,.svn\* " for Windows + + let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$' + let g:ctrlp_custom_ignore = { + \ 'dir': '\.git$\|\.hg$\|\.svn$', + \ 'file': '\.exe$\|\.so$\|\.dll$', + \ 'link': 'some_bad_symbolic_links', + \ } + ``` + +* Use a custom file listing command with: + + ```vim + let g:ctrlp_user_command = 'find %s -type f' " MacOSX/Linux + let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' " Windows + ``` + +_Check [the docs][2] for more mappings, commands and options._ + +[1]: http://i.imgur.com/yIynr.png +[2]: https://github.com/kien/ctrlp.vim/blob/master/doc/ctrlp.txt +[3]: https://github.com/kien/ctrlp.vim/tree/extensions diff --git a/bundle/indent_python/indent/python.vim b/bundle/indent_python/indent/python.vim index 579cdc4..2278de0 100644 --- a/bundle/indent_python/indent/python.vim +++ b/bundle/indent_python/indent/python.vim @@ -1,8 +1,8 @@ let current_file = expand('%:p') if match(current_file, '\cicard') < 0 - source $HOME/.vim/indent/python_pep8.vim + ru! indent/python_pep8.vim else let g:pep8_exclude=['W191'] - source $VIMRUNTIME/indent/python.vim + ru! indent/python.vim endif diff --git a/bundle/l9/autoload/l9.vim b/bundle/l9/autoload/l9.vim deleted file mode 100644 index b6a0ae7..0000000 --- a/bundle/l9/autoload/l9.vim +++ /dev/null @@ -1,570 +0,0 @@ -"============================================================================= -" Copyright (c) 2009-2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if exists('g:loaded_autoload_l9') - finish -endif -let g:loaded_autoload_l9 = 1 - -" }}}1 -"============================================================================= -" COMPATIBILITY TEST {{{1 - -" -let s:L9_VERSION_CURRENT = 101 -let s:L9_VERSION_PASSABLE = 101 - -" returns true if given version is compatible. -function l9#isCompatible(ver) - return -endfunction - -let s:VERSION_FACTOR = str2float('0.01') - -" returns false if the caller script should finish. -" a:vimVersion: if 0, don't check vim version -" a:l9Version: same rule as v:version -function l9#guardScriptLoading(path, vimVersion, l9Version, exprs) - let loadedVarName = 'g:loaded_' . substitute(a:path, '\W', '_', 'g') - if exists(loadedVarName) - return 0 - elseif a:vimVersion > 0 && a:vimVersion > v:version - echoerr a:path . ' requires Vim version ' . string(a:vimVersion * s:VERSION_FACTOR) - return 0 - elseif a:l9Version > 0 && (a:l9Version > s:L9_VERSION_CURRENT || - \ a:l9Version < s:L9_VERSION_PASSABLE) - echoerr a:path . ' requires L9 library version ' . string(a:l9Version * s:VERSION_FACTOR) - return 0 - endif - for expr in a:exprs - if !eval(expr) - echoerr a:path . ' requires: ' . expr - return 0 - endif - endfor - let {loadedVarName} = 1 - return 1 -endfunction - -" -function l9#getVersion() - return s:L9_VERSION_CURRENT -endfunction - -" }}}1 -"============================================================================= -" LIST {{{1 - -" Removes duplicates (unstable) -" This function doesn't change the list of argument. -function l9#unique(items) - let sorted = sort(a:items) - 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 - -" Removes duplicates (stable) -" This function doesn't change the list of argument. -function l9#uniqueStably(items) - let result = [] - for item in a:items - if count(result, item, &ignorecase) == 0 - call add(result, item) - endif - endfor - return result -endfunction - -" [ [0], [1,2], [3] ] -> [ 0, 1, 2, 3 ] -" This function doesn't change the list of argument. -function l9#concat(items) - let result = [] - for l in a:items - let result += l - endfor - return result -endfunction - -" [ [0,1,2], [3,4], [5,6,7,8] ] -> [ [0,3,5],[1,4,6] ] -" This function doesn't change the list of argument. -function l9#zip(items) - let result = [] - for i in range(min(map(copy(a:items), 'len(v:val)'))) - call add(result, map(copy(a:items), 'v:val[i]')) - endfor - return result -endfunction - -" filter() with the maximum number of items -" This function doesn't change the list of argument. -function l9#filterWithLimit(items, expr, limit) - if a:limit <= 0 - return filter(copy(a:items), a:expr) - endif - let result = [] - let stride = a:limit * 3 / 2 " x1.5 - for i in range(0, len(a:items) - 1, stride) - let result += filter(a:items[i : i + stride - 1], a:expr) - if len(result) >= a:limit - return remove(result, 0, a:limit - 1) - endif - endfor - return result -endfunction - -" Removes if a:expr is evaluated as non-zero and returns removed items. -" This function change the list of argument. -function l9#removeIf(items, expr) - let removed = filter(copy(a:items), a:expr) - call filter(a:items, '!( ' . a:expr . ')') - return removed -endfunction - -" }}}1 -"============================================================================= -" NUMERIC {{{1 - -" }}}1 -"============================================================================= -" STRING {{{1 - -" Snips a:str and add a:mask if the length of a:str is more than a:len -function l9#snipHead(str, len, mask) - if a:len >= len(a:str) - return a:str - elseif a:len <= len(a:mask) - return a:mask - endif - return a:mask . a:str[-a:len + len(a:mask):] -endfunction - -" Snips a:str and add a:mask if the length of a:str is more than a:len -function l9#snipTail(str, len, mask) - if a:len >= len(a:str) - return a:str - elseif a:len <= len(a:mask) - return a:mask - endif - return a:str[:a:len - 1 - len(a:mask)] . a:mask -endfunction - -" Snips a:str and add a:mask if the length of a:str is more than a:len -function l9#snipMid(str, len, mask) - if a:len >= len(a:str) - return a:str - elseif a:len <= len(a:mask) - return a:mask - endif - let len_head = (a:len - len(a:mask)) / 2 - let len_tail = a:len - len(a:mask) - len_head - return (len_head > 0 ? a:str[: len_head - 1] : '') . a:mask . - \ (len_tail > 0 ? a:str[-len_tail :] : '') -endfunction - -" -function l9#hash224(str) - let a = 0x00000800 " shift 11 bit (if unsigned) - let b = 0x001fffff " extract 11 bit (if unsigned) - let nHash = 7 - let hashes = repeat([0], nHash) - for i in range(len(a:str)) - let iHash = i % nHash - let hashes[iHash] = hashes[iHash] * a + hashes[iHash] / b - let hashes[iHash] += char2nr(a:str[i]) - endfor - return join(map(hashes, 'printf("%08x", v:val)'), '') -endfunction - -" wildcard -> regexp -function l9#convertWildcardToRegexp(expr) - let re = escape(a:expr, '\') - for [pat, sub] in [ [ '*', '\\.\\*' ], [ '?', '\\.' ], [ '[', '\\[' ], ] - let re = substitute(re, pat, sub, 'g') - endfor - return '\V' . re -endfunction - -" }}}1 -"============================================================================= -" LINES {{{1 - -" Removes from the line matching with a:begin first to the line matching with -" a:end next and returns removed lines. -" If matching range is not found, returns [] -function l9#removeLinesBetween(lines, begin, end) - for i in range(len(a:lines) - 1) - if a:lines[i] =~ a:begin - break - endif - endfor - for j in range(i + 1, len(a:lines) - 1) - if a:lines[j] =~ a:end - let g:l0 += [a:lines[i : j]] - return remove(a:lines, i, j) - endif - endfor - return [] -endfunction - -" }}}1 -"============================================================================= -" PATH {{{1 - -" returns the path separator charactor. -function l9#getPathSeparator() - return (!&shellslash && (has('win32') || has('win64')) ? '\' : '/') -endfunction - -" [ 'a', 'b/', '/c' ] -> 'a/b/c' -function l9#concatPaths(paths) - let result = '' - for p in a:paths - if empty(p) - continue - elseif empty(result) - let result = p - else - let result = substitute(result, '[/\\]$', '', '') . l9#getPathSeparator() - \ . substitute(p, '^[/\\]', '', '') - endif - endfor - return result -endfunction - -" path: '/a/b/c/d', dir: '/a/b' => 'c/d' -function l9#modifyPathRelativeToDir(path, dir) - let pathFull = fnamemodify(a:path, ':p') - let dirFull = fnamemodify(a:dir, ':p') - if len(pathFull) < len(dirFull) || pathFull[:len(dirFull) - 1] !=# dirFull - return pathFull - endif - return pathFull[len(dirFull):] -endfunction - -" }}}1 -"============================================================================= -" FILE {{{1 - -" Almost same as readfile(). -function l9#readFile(...) - let args = copy(a:000) - let args[0] = expand(args[0]) - try - return call('readfile', args) - catch - endtry - return [] -endfunction - -" Almost same as writefile(). -function l9#writeFile(...) - let args = copy(a:000) - let args[1] = expand(args[1]) - let dir = fnamemodify(args[1], ':h') - try - if !isdirectory(dir) - call mkdir(dir, 'p') - endif - return call('writefile', args) - catch - endtry - return -1 " -1 is error code. -endfunction - -" }}}1 -"============================================================================= -" BUFFER {{{1 - -" :wall/:wall! wrapper. Useful for writing readonly buffers. -function l9#writeAll() - try - silent update " NOTE: avoiding a problem with a buftype=acwrite buffer. - silent wall - catch /^Vim/ " E45, E505 - if l9#inputHl('Question', v:exception . "\nWrite readonly files? (Y/N) : ", 'Y') ==? 'y' - redraw - :wall! - endif - endtry -endfunction - -" Loads given files with :edit command -function l9#loadFilesToBuffers(files) - for file in filter(copy(a:files), '!bufloaded(v:val)') - execute 'edit ' . fnameescape(file) - if !exists('bufNrFirst') - let bufNrFirst = bufnr('%') - endif - endfor - if exists('bufNrFirst') - execute bufNrFirst . 'buffer' - endif -endfunction - -" Deletes all buffers except given files with :bdelete command -function l9#deleteAllBuffersExcept(files) - let bufNrExcepts = map(copy(a:files), 'bufnr("^" . v:val . "$")') - for bufNr in filter(range(1, bufnr('$')), 'bufloaded(v:val)') - if count(bufNrExcepts, bufNr) == 0 - execute bufNr . 'bdelete' - endif - endfor -endfunction - -" }}}1 -"============================================================================= -" WINDOW {{{1 - -" move current window to next tabpage. -function l9#shiftWinNextTabpage() - if tabpagenr('$') < 2 - return - endif - let bufnr = bufnr('%') - tabnext - execute bufnr . 'sbuffer' - tabprevious - if winnr('$') > 1 - close - tabnext - else - close " if tabpage is closed, next tabpage will become current - endif -endfunction - -" move current window to previous tabpage. -function l9#shiftWinPrevTabpage() - if tabpagenr('$') < 2 - return - endif - let bufnr = bufnr('%') - tabprevious - execute bufnr . 'sbuffer' - tabnext - close - tabprevious -endfunction - -" move to a window containing specified buffer. -" returns 0 if the buffer is not found. -function l9#moveToBufferWindowInCurrentTabpage(bufNr) - if bufnr('%') == a:bufNr - return 1 - elseif count(tabpagebuflist(), a:bufNr) == 0 - return 0 - endif - execute bufwinnr(a:bufNr) . 'wincmd w' - return 1 -endfunction - -" returns 0 if the buffer is not found. -function s:moveToOtherTabpageOpeningBuffer(bufNr) - for tabNr in range(1, tabpagenr('$')) - if tabNr != tabpagenr() && count(tabpagebuflist(tabNr), a:bufNr) > 0 - execute 'tabnext ' . tabNr - return 1 - endif - endfor - return 0 -endfunction - -" move to a window containing specified buffer. -" returns 0 if the buffer is not found. -function l9#moveToBufferWindowInOtherTabpage(bufNr) - if !s:moveToOtherTabpageOpeningBuffer(a:bufNr) - return 0 - endif - return l9#moveToBufferWindowInCurrentTabpage(a:bufNr) -endfunction - -" }}}1 -"============================================================================= -" COMMAND LINE {{{1 - -" echo/echomsg with highlighting. -function l9#echoHl(hl, msg, prefix, addingHistory) - let echoCmd = (a:addingHistory ? 'echomsg' : 'echo') - execute "echohl " . a:hl - try - for l in (type(a:msg) == type([]) ? a:msg : split(a:msg, "\n")) - execute echoCmd . ' a:prefix . l' - endfor - finally - echohl None - endtry -endfunction - -" input() with highlighting. -" This function can take list as {completion} argument. -function l9#inputHl(hl, ...) - execute "echohl " . a:hl - try - let args = copy(a:000) - if len(args) > 2 && type(args[2]) == type([]) - let s:candidatesForInputHl = args[2] - let args[2] = 'custom,l9#completeForInputHl' - endif - let s = call('input', args) - unlet! s:candidatesForInputHl - finally - echohl None - endtry - redraw " needed to show following echo to next line. - return s -endfunction - -" only called by l9#inputHl() for completion. -function l9#completeForInputHl(lead, line, pos) - return join(s:candidatesForInputHl, "\n") -endfunction - -" }}}1 -"============================================================================= -" VISUAL MODE {{{1 - -" returns last selected text in Visual mode. -function l9#getSelectedText() - let reg_ = [@", getregtype('"')] - let regA = [@a, getregtype('a')] - if mode() =~# "[vV\]" - silent normal! "aygv - else - let pos = getpos('.') - silent normal! gv"ay - call setpos('.', pos) - endif - let text = @a - call setreg('"', reg_[0], reg_[1]) - call setreg('a', regA[0], regA[1]) - return text -endfunction - - -" }}}1 -"============================================================================= -" EVAL {{{1 - -" loads given text as Vim script with :source command -function l9#loadScript(text) - let lines = (type(a:text) == type([]) ? a:text : split(a:text, "\n")) - let fname = tempname() - call writefile(lines, fname) - source `=fname` - call delete(fname) -endfunction - - -" }}}1 -"============================================================================= -" VARIABLES {{{1 - -" -function l9#defineVariableDefault(name, default) - if !exists(a:name) - let {a:name} = a:default - endif -endfunction - -" }}}1 -"============================================================================= -" GREP {{{1 - -" Execute :vimgrep and opens the quickfix window if matches are found. -" -" a:pattern: search pattern. If ommitted, last search pattern (@/) is used. -" a:files: List of files -function l9#grepFiles(pattern, files) - let target = join(map(a:files, 'escape(v:val, " ")'), ' ') - let pattern = (a:pattern[0] ==# '/' ? a:pattern[1:] : a:pattern) - let pattern = (empty(pattern) ? @/ : pattern) - try - execute printf('vimgrep/%s/j %s', pattern, target) - catch /^Vim/ - call setqflist([]) - endtry - call l9#quickfix#sort() - call l9#quickfix#openIfNotEmpty(1, 0) -endfunction - -" Execute :vimgrep for buffers using l9#grepFiles() -" See also: :L9GrepBuffer :L9GrepBufferAll -function l9#grepBuffers(pattern, bufNrs) - let files = map(filter(a:bufNrs, 'bufloaded(v:val)'), 'bufname(v:val)') - call l9#grepFiles(a:pattern, files) -endfunction - -" }}}1 -"============================================================================= -" SIGN {{{1 - -" Highlights lines using :sign define and :sign place. -" -" a:linehl, a:text, a:texthl: See |signs|. Ignored if empty string. -" a:locations: List of [{buffer number}, {line number}] for highlighting -function l9#placeSign(linehl, text, texthl, locations) - let argLinehl = (empty(a:linehl) ? '' : 'linehl=' . a:linehl) - let argText = (empty(a:text) ? '' : 'text=' . a:text) - let argTexthl = (empty(a:texthl) ? '' : 'texthl=' . a:texthl) - let name = 'l9--' . a:linehl . '--' . a:text . '--' . a:texthl - execute printf('sign define %s linehl=%s text=%s texthl=%s', - \ name, a:linehl, a:text, a:texthl) - for [bufNr, lnum] in a:locations - execute printf('sign place 1 line=%d name=%s buffer=%d', lnum, name, bufNr) - endfor -endfunction - -" }}}1 -"============================================================================= -" NOTIFY EXTERNALLY {{{1 - -" Notify a message using an external program. -" Currently supports Balloonly, Screen, and Tmux. -function l9#notifyExternally(msg) - return l9#notifyBalloonly(a:msg) - \ || l9#notifyScreen(a:msg) - \ || l9#notifyTmux(a:msg) -endfunction - -" -function l9#notifyBalloonly(msg) - if !(has('win32') || has('win64')) || !executable(g:l9_balloonly) - return 0 - endif - execute 'silent !start ' . shellescape(g:l9_balloonly) . ' 4000 "l9" ' . shellescape(a:msg) - return 1 -endfunction - -" -function l9#notifyScreen(msg) - if !has('unix') || has('gui_running') || $WINDOW !~ '\d' || !executable('screen') - return 0 - endif - call system('screen -X wall ' . shellescape('l9: ' . a:msg)) - return 1 -endfunction - -" -function l9#notifyTmux(msg) - if !has('unix') || has('gui_running') || empty($TMUX) || !executable('tmux') - return 0 - endif - call system('tmux display-message ' . shellescape('l9: ' . a:msg)) - return 1 -endfunction - -" }}}1 -"============================================================================= -" vim: set fdm=marker: diff --git a/bundle/l9/autoload/l9/async.py b/bundle/l9/autoload/l9/async.py deleted file mode 100644 index eeb0cc3..0000000 --- a/bundle/l9/autoload/l9/async.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env python - -from __future__ import with_statement -import vim -import os -import subprocess -import threading -import Queue - - -class Asyncer: - - def __init__(self): - self._workers = {} - - def execute(self, var_key, var_command, var_cwd, var_input, var_appends): - key = vim.eval(var_key) - command = vim.eval(var_command) - cwd = vim.eval(var_cwd) - input = vim.eval(var_input) - appends = vim.eval(var_appends) - if key not in self._workers: - self._workers[key] = Worker() - self._workers[key].start() - self._workers[key].put(Executor(command, cwd, input, appends)) - - def print_output(self, var_key): - key = vim.eval(var_key) - if key not in self._workers: - return - for l in self._workers[key].copy_outputs(): - print l, - - def print_worker_keys(self): - for k in self._workers.keys(): - print k - - def print_active_worker_keys(self): - for k in self._workers.keys(): - print k - - -class Worker(threading.Thread): - - def __init__(self): - threading.Thread.__init__(self) - self._queue = Queue.Queue() - self._lines = [] - self._lock = threading.Lock() - - def run(self): - while True: - self._queue.get().execute(self) - self._queue.task_done() - - def put(self, executor): - self._queue.put(executor) - - def clear_outputs(self): - with self._lock: - self._lines = [] - - def record_output(self, line): - with self._lock: - self._lines.append(line) - - def copy_outputs(self): - with self._lock: - return self._lines[:] - - -class Executor: - - def __init__(self, command, cwd, input, appends): - self._command = command - self._cwd = cwd - self._input = input - self._appends = appends - - def execute(self, worker): - if not self._appends: - worker.clear_outputs() - os.chdir(self._cwd) - p = subprocess.Popen(self._command, shell=True, stdin=subprocess.PIPE, - stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - p.stdin.write(self._input) - line = p.stdout.readline() - while line: - worker.record_output(line) - line = p.stdout.readline() - - diff --git a/bundle/l9/autoload/l9/async.vim b/bundle/l9/autoload/l9/async.vim deleted file mode 100644 index fa66e9f..0000000 --- a/bundle/l9/autoload/l9/async.vim +++ /dev/null @@ -1,67 +0,0 @@ -"============================================================================= -" Copyright (C) 2009-2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, ['has("python")']) - finish -endif - -" }}}1 -"============================================================================= -" ASYNC EXECUTE {{{1 - -" -function s:checkKey(key) - if a:key =~ '\n' || a:key !~ '\S' - throw "Asyncer: Invalid key: " . a:key - endif -endfunction - -" -function l9#async#execute(key, cmd, cwd, input, appends) - call s:checkKey(a:key) - python asyncer.execute('a:key', 'a:cmd', 'a:cwd', 'a:input', 'a:appends') -endfunction - -" -function l9#async#read(key) - call s:checkKey(a:key) - redir => result - silent python asyncer.print_output('a:key') - redir END - " NOTE: "\n" is somehow inserted by redir. - return (result[0] ==# "\n" ? result[1:] : result) -endfunction - -" -function l9#async#listWorkers() - redir => result - silent python asyncer.print_worker_keys() - redir END - return split(result, "\n") -endfunction - -" -function l9#async#listActiveWorkers() - redir => result - silent python asyncer.print_active_worker_keys() - redir END - return split(result, "\n") -endfunction - -" }}}1 -"============================================================================= -" INITIALIZATION {{{1 - -let s:ASYNC_PY_PATH = fnamemodify(expand(':p:h'), ':p') . 'async.py' - -pyfile `=s:ASYNC_PY_PATH` -python asyncer = Asyncer() - -" }}}1 -"============================================================================= -" vim: set fdm=marker: - - diff --git a/bundle/l9/autoload/l9/quickfix.vim b/bundle/l9/autoload/l9/quickfix.vim deleted file mode 100644 index 1758b39..0000000 --- a/bundle/l9/autoload/l9/quickfix.vim +++ /dev/null @@ -1,107 +0,0 @@ -"============================================================================= -" Copyright (C) 2009-2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" QUICKFIX {{{1 - -" Returns non-zero if quickfix window is opened. -function l9#quickfix#isWindowOpened() - return count(map(range(1, winnr('$')), 'getwinvar(v:val, "&buftype")'), 'quickfix') > 0 -endfunction - -" Opens quickfix window if quickfix is not empty, and echo the number of errors. -" -" a:onlyRecognized: if non-zero, opens only if quickfix has recognized errors. -" a:holdCursor: if non-zero, the cursor won't move to quickfix window. -function l9#quickfix#openIfNotEmpty(onlyRecognized, holdCursor) - let numErrors = len(filter(getqflist(), 'v:val.valid')) - let numOthers = len(getqflist()) - numErrors - if numErrors > 0 || (!a:onlyRecognized && numOthers > 0) - copen - if a:holdCursor - wincmd p - endif - else - cclose - endif - redraw - if numOthers > 0 - echo printf('Quickfix: %d(+%d)', numErrors, numOthers) - else - echo printf('Quickfix: %d', numErrors) - endif -endfunction - -" Toggles Quickfix window -function l9#quickfix#toggleWindow() - if l9#quickfix#isWindowOpened() - cclose - else - call l9#quickfix#openIfNotEmpty(0, 0) - endif -endfunction - -" Creates quickfix list form given lines and opens the quickfix window if -" errors exists. -" -" a:lines: -" a:jump: if non-zero, jump to the first error. -function l9#quickfix#setMakeResult(lines) - cexpr a:lines - call l9#quickfix#openIfNotEmpty(0, 1) -endfunction - -" Compares quickfix entries for sorting. -function l9#quickfix#compareEntries(e0, e1) - if a:e0.bufnr != a:e1.bufnr - let i0 = bufname(a:e0.bufnr) - let i1 = bufname(a:e1.bufnr) - elseif a:e0.lnum != a:e1.lnum - let i0 = a:e0.lnum - let i1 = a:e1.lnum - elseif a:e0.col != a:e1.col - let i0 = a:e0.col - let i1 = a:e1.col - else - return 0 - endif - return (i0 > i1 ? +1 : -1) -endfunction - -" Sorts quickfix -function l9#quickfix#sort() - call setqflist(sort(getqflist(), 'l9#quickfix#compareEntries'), 'r') -endfunction - -" Highlights Quickfix lines by :sign. -" Inspired by errormarker plugin. -" -" You can customize the highlighting via L9ErrorLine and L9WarningLine -" highlight groups. -function l9#quickfix#placeSign() - let warnings = [] - let errors = [] - for e in filter(getqflist(), 'v:val.valid') - let warning = (e.type ==? 'w' || e.text =~? '^\s*warning:') - call add((warning ? warnings : errors), [e.bufnr, e.lnum]) - endfor - sign unplace * - call l9#placeSign('L9WarningLine', '>>', '', warnings) - call l9#placeSign('L9ErrorLine', '>>', '', errors) -endfunction - -highlight default L9ErrorLine ctermfg=white ctermbg=52 guibg=#5F0000 -highlight default L9WarningLine ctermfg=white ctermbg=17 guibg=#00005F - -" }}}1 -"============================================================================= -" vim: set fdm=marker: - diff --git a/bundle/l9/autoload/l9/tempbuffer.vim b/bundle/l9/autoload/l9/tempbuffer.vim deleted file mode 100644 index 6f11a78..0000000 --- a/bundle/l9/autoload/l9/tempbuffer.vim +++ /dev/null @@ -1,112 +0,0 @@ -"============================================================================= -" Copyright (C) 2009-2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" TEMPORARY BUFFER {{{1 - -" each key is a buffer name. -let s:dataMap = {} - -" -function s:onBufDelete(bufname) - if exists('s:dataMap[a:bufname].listener.onClose') - call s:dataMap[a:bufname].listener.onClose(s:dataMap[a:bufname].written) - endif - if bufnr('%') == s:dataMap[a:bufname].bufNr && winnr('#') != 0 - " if winnr('#') returns 0, "wincmd p" causes ringing the bell. - wincmd p - endif -endfunction - -" -function s:onBufWriteCmd(bufname) - if !exists('s:dataMap[a:bufname].listener.onWrite') || - \ s:dataMap[a:bufname].listener.onWrite(getline(1, '$')) - setlocal nomodified - let s:dataMap[a:bufname].written = 1 - call l9#tempbuffer#close(a:bufname) - else - endif -endfunction - -" a:bufname: -" a:height: Window height. If 0, default height is used. -" If less than 0, the window becomes full-screen. -" a:listener: -" a:listener.onClose(written) -function l9#tempbuffer#openScratch(bufname, filetype, lines, topleft, vertical, height, listener) - let openCmdPrefix = (a:topleft ? 'topleft ' : '') - \ . (a:vertical ? 'vertical ' : '') - \ . (a:height > 0 ? a:height : '') - if !exists('s:dataMap[a:bufname]') || !bufexists(s:dataMap[a:bufname].bufNr) - execute openCmdPrefix . 'new' - else - call l9#tempbuffer#close(a:bufname) - execute openCmdPrefix . 'split' - execute 'silent ' . s:dataMap[a:bufname].bufNr . 'buffer' - endif - if a:height < 0 - only - endif - setlocal buflisted noswapfile bufhidden=delete modifiable noreadonly buftype=nofile - let &l:filetype = a:filetype - silent file `=a:bufname` - call setline(1, a:lines) - setlocal nomodified - augroup L9TempBuffer - autocmd! * - execute printf('autocmd BufDelete call s:onBufDelete (%s)', string(a:bufname)) - execute printf('autocmd BufWriteCmd nested call s:onBufWriteCmd(%s)', string(a:bufname)) - augroup END - let s:dataMap[a:bufname] = { - \ 'bufNr': bufnr('%'), - \ 'written': 0, - \ 'listener': a:listener, - \ } -endfunction - -" -function l9#tempbuffer#openReadOnly(bufname, filetype, lines, topleft, vertical, height, listener) - call l9#tempbuffer#openScratch(a:bufname, a:filetype, a:lines, a:topleft, a:vertical, a:height, a:listener) - setlocal nomodifiable readonly -endfunction - -" a:listener: -" a:listener.onClose(written) -" a:listener.onWrite(lines) -function l9#tempbuffer#openWritable(bufname, filetype, lines, topleft, vertical, height, listener) - call l9#tempbuffer#openScratch(a:bufname, a:filetype, a:lines, a:topleft, a:vertical, a:height, a:listener) - setlocal buftype=acwrite -endfunction - -" makes specified temp buffer current. -function l9#tempbuffer#moveTo(bufname) - return l9#moveToBufferWindowInCurrentTabpage(s:dataMap[a:bufname].bufNr) || - \ l9#moveToBufferWindowInOtherTabpage(s:dataMap[a:bufname].bufNr) -endfunction - -" -function l9#tempbuffer#close(bufname) - if !l9#tempbuffer#isOpen(a:bufname) - return - endif - execute printf('%dbdelete!', s:dataMap[a:bufname].bufNr) -endfunction - -" -function l9#tempbuffer#isOpen(bufname) - return exists('s:dataMap[a:bufname]') && bufloaded(s:dataMap[a:bufname].bufNr) -endfunction - -" }}}1 -"============================================================================= -" vim: set fdm=marker: - diff --git a/bundle/l9/autoload/l9/tempvariables.vim b/bundle/l9/autoload/l9/tempvariables.vim deleted file mode 100644 index ee847ee..0000000 --- a/bundle/l9/autoload/l9/tempvariables.vim +++ /dev/null @@ -1,60 +0,0 @@ -"============================================================================= -" Copyright (C) 2010 Takeshi NISHIDA -" -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 0, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" TEMPORARY VARIABLES {{{1 - -" -let s:origMap = {} - -" set temporary variables -function l9#tempvariables#set(group, name, value) - if !exists('s:origMap[a:group]') - let s:origMap[a:group] = {} - endif - if !exists('s:origMap[a:group][a:name]') - let s:origMap[a:group][a:name] = eval(a:name) - endif - execute 'let ' . a:name . ' = a:value' -endfunction - -" set temporary variables -function l9#tempvariables#setList(group, variables) - for [name, value] in a:variables - call l9#tempvariables#set(a:group, name, value) - unlet value " to avoid E706 - endfor -endfunction - -" get temporary variables -function l9#tempvariables#getList(group) - if !exists('s:origMap[a:group]') - return [] - endif - return map(keys(s:origMap[a:group]), '[v:val, eval(v:val)]') -endfunction - -" restore original variables and clean up. -function l9#tempvariables#end(group) - if !exists('s:origMap[a:group]') - return - endif - for [name, value] in items(s:origMap[a:group]) - execute 'let ' . name . ' = value' - unlet value " to avoid E706 - endfor - unlet s:origMap[a:group] -endfunction - -" }}}1 -"============================================================================= -" vim: set fdm=marker: - diff --git a/bundle/l9/doc/l9.txt b/bundle/l9/doc/l9.txt deleted file mode 100644 index 8664ad4..0000000 --- a/bundle/l9/doc/l9.txt +++ /dev/null @@ -1,73 +0,0 @@ -*l9.txt* Vim-script library - - Copyright (c) 2009-2010 Takeshi NISHIDA - -l9 *l9* - -INTRODUCTION |l9-introduction| -INSTALLATION |l9-installation| -USAGE |l9-usage| -CHANGELOG |l9-changelog| -ABOUT |l9-about| - -============================================================================== -INTRODUCTION *l9-introduction* - -l9 is a Vim-script library, which provides some utility functions and commands -for programming in Vim. - -============================================================================== - INSTALLATION *l9-installation* - -Put all files into your runtime directory. If you have the zip file, extract -it to your runtime directory. - -You should place the files as follows: -> - /plugin/l9.vim - /doc/l9.txt - ... -< -If you are disgusted to make your runtime directory confused with a lot of -plugins, put each of the plugins into a directory individually and just add -the directory path to 'runtimepath'. It's easy to uninstall the plugin. - -Then update your help tags files to enable fuzzyfinder help. See -|add-local-help| for details. - -============================================================================== -USAGE *l9-usage* - -See source code. - -============================================================================== -CHANGELOG *l9-changelog* - -1.1: - - Added l9#zip() - - Added l9#tempvariables#getList() - - Changed l9#guardScriptLoading() - - Removed l9#tempvariables#swap() - -1.0.1: - - Fixed a bug that floating point numbers weren't evaluated correctly and - caused errors on some non-English locales. - -1.0: - - First release. - - -============================================================================== -ABOUT *l9-about* *l9-contact* *l9-author* - -Author: Takeshi NISHIDA -Licence: MIT Licence -URL: http://www.vim.org/scripts/script.php?script_id=3252 - http://bitbucket.org/ns9tks/vim-l9/ - -Bugs/Issues/Suggestions/Improvements ~ - -Please submit to http://bitbucket.org/ns9tks/vim-l9/issues/ . - -============================================================================== - vim:tw=78:ts=8:ft=help:norl: diff --git a/bundle/l9/plugin/l9.vim b/bundle/l9/plugin/l9.vim deleted file mode 100644 index 03613e4..0000000 --- a/bundle/l9/plugin/l9.vim +++ /dev/null @@ -1,108 +0,0 @@ -"============================================================================= -" Copyright (C) 2009-2010 Takeshi NISHIDA -" -" GetLatestVimScripts: 3252 1 :AutoInstall: L9 -"============================================================================= -" LOAD GUARD {{{1 - -if !l9#guardScriptLoading(expand(':p'), 702, 0, []) - finish -endif - -" }}}1 -"============================================================================= -" OPTIONS: {{{1 - -call l9#defineVariableDefault('g:l9_balloonly', 'balloonly.exe') - -" }}}1 -"============================================================================= -" ASSERTION: {{{1 - -" This command has effect only if $L9_DEBUG is non-zero. -" Used as follows: -" L9Assert a:i > 0 -" This command can't interpret script-local variables directly. -" NG: L9Assert s:a == 1 -" OK: execute 'L9Assert ' . s:a . ' == 1' -" -if $L9_DEBUG - command -nargs=* L9Assert call eval(() ? 0 : s:handleFailedAssersion()) - - function s:handleFailedAssersion(expr) - echoerr '[L9Assert] Assersion failure: ' . a:expr - if input('[L9Assert] Continue? (Y/N) ', 'Y') !=? 'Y' - throw 'L9Assert ' . a:expr - endif - endfunction - -else - command -nargs=* L9Assert : -endif - -" }}}1 -"============================================================================= -" TIMER: {{{1 - -" These commands have effect only if $L9_TIMER is non-zero. -" Used as follows: -" L9Timer foo -" ... (1) -" L9Timer bar -" ... (2) -" L9TimerStop -" ... -" L9TimerDump <- shows each elapsed time of (1) and (2) -" -if $L9_TIMER - command -nargs=1 L9Timer call s:timerBegin() - command -nargs=0 L9TimerStop call s:timerStop() - command -nargs=0 L9TimerDump call s:timerDump() - - let s:timerData = [] - let s:timerTagMaxLen = 0 - - function s:timerBegin(tag) - L9TimerStop - let s:timerCurrent = {'tag': strftime('%c ') . a:tag . ' ', 'time': reltime()} - let s:timerTagMaxLen = max([len(s:timerCurrent.tag), s:timerTagMaxLen]) - endfunction - - function s:timerStop() - if !exists('s:timerCurrent') - return - endif - let s:timerCurrent.time = reltimestr(reltime(s:timerCurrent.time)) - call add(s:timerData, s:timerCurrent) - unlet s:timerCurrent - endfunction - - function s:timerDump() - L9TimerStop - let lines = map(s:timerData, 'v:val.tag . repeat(" ", s:timerTagMaxLen - len(v:val.tag)) . v:val.time') - call l9#tempbuffer#openReadOnly('[l9-timer]', '', lines, 0, 0, 0, {}) - let s:timerData = [] - let s:timerTagMaxLen = 0 - endfunction - -else - command -nargs=1 L9Timer : - command -nargs=0 L9TimerStop : - command -nargs=0 L9TimerDump : -endif - -" }}}1 -"============================================================================= -" GREP BUFFER: {{{1 - -" Grep for current buffer by l9#grepBuffers() -" Used as :L9GrepBuffer/pattern -command -nargs=? L9GrepBuffer call l9#grepBuffers(, [bufnr('%')]) - -" Grep for all buffers by l9#grepBuffers() -" Used as :L9GrepBufferAll/pattern -command -nargs=? L9GrepBufferAll call l9#grepBuffers(, range(1, bufnr('$'))) - -" }}}1 -"============================================================================= -" vim: set fdm=marker: diff --git a/bundle_consider/ctrlp/readme.md b/bundle_consider/ctrlp/readme.md deleted file mode 100644 index bf84bb2..0000000 --- a/bundle_consider/ctrlp/readme.md +++ /dev/null @@ -1,8 +0,0 @@ -# ctrlp.vim -Fuzzy __file__, __buffer__, __mru__ and __tag__ finder for Vim. - -* [**Project's homepage**][1] -* [**Main git repository**][2] - -[1]: http://kien.github.com/ctrlp.vim -[2]: https://github.com/kien/ctrlp.vim diff --git a/bundle_consider/fontzoom/doc/fontzoom.txt b/bundle_consider/fontzoom/doc/fontzoom.txt deleted file mode 100644 index f3d1749..0000000 --- a/bundle_consider/fontzoom/doc/fontzoom.txt +++ /dev/null @@ -1,105 +0,0 @@ -*fontzoom.txt* The fontsize controller in gVim. - -Version: 0.1.1 -Modified: thinca -License: Creative Commons Attribution 2.1 Japan License - - -============================================================================== -CONTENTS *fontzoom-contents* - -INTRODUCTION |fontzoom-introduction| -INTERFACE |fontzoom-interface| - KEY MAPPINGS |fontzoom-key-mappings| - COMMANDS |fontzoom-commands| -SETTINGS |fontzoom-settings| -LIMITATION |fontzoom-limitation| -CHANGELOG |fontzoom-changelog| - - -============================================================================== -INTRODUCTION *fontzoom-introduction* - -*fontzoom* is a Vim plugin to control gui fontsize. You can change fontsize -with + and - keys(when default setting). You can also use the [count]. -This plugin remember 'guifont', 'lines', and 'columns' when you change -fontsize first. And tries to keep the size of the window as much as possible. - - - -============================================================================== -INTERFACE *fontzoom-interface* - ------------------------------------------------------------------------------- -KEY MAPPINGS *fontzoom-key-mappings* - -(fontzoom-learger) *(fontzoom-learger)* - Fontsize is made large [count] point. - -(fontzoom-smaller) *(fontzoom-smaller)* - Fontsize is made small [count] point. - - - *g:fontzoom_no_default_key_mappings* -The following key mappings will be also available unless -g:fontzoom_no_default_key_mappings is defined: - -{lhs} {rhs} --------- ----------------------------- -+ (fontzoom-larger) -- (fontzoom-smaller) - (fontzoom-larger) - (fontzoom-smaller) - ------------------------------------------------------------------------------- -COMMANDS *fontzoom-commands* - -:Fontzoom *:Fontzoom* - Show fontsize in current. - -:Fontzoom +[N] - Fontsize is made large [N] point. - -:Fontzoom -[N] - Fontsize is made small [N] point. - -:Fontzoom [N] - Fontsize is changed into [N] points. - -:Fontzoom! - Fontsize is changed into initial size. All arguments - are ignored. - - - -============================================================================== -SETTINGS *fontzoom-settings* - -g:fontzoom_pattern *g:fontzoom_pattern* - Pick out the Fontsize from font name. The pattern - must match to the Fontsize. |/\zs| and |/\ze| are - convenient. - - - -============================================================================== -LIMITATION *fontzoom-limitation* - -- 'guifont' should contain fontsize that matches to |g:fontzoom_pattern|. - - - -============================================================================== -CHANGELOG *fontzoom-changelog* - -0.1.1 2011-02-24 - - Added default key mappings. - - and . - -0.1.0 2009-12-25 - - Initial version. - - - -============================================================================== -vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl diff --git a/bundle_consider/fontzoom/plugin/fontzoom.vim b/bundle_consider/fontzoom/plugin/fontzoom.vim deleted file mode 100644 index 844cfce..0000000 --- a/bundle_consider/fontzoom/plugin/fontzoom.vim +++ /dev/null @@ -1,69 +0,0 @@ -" The fontsize controller in gVim. -" Version: 0.1.1 -" Author : thinca -" License: Creative Commons Attribution 2.1 Japan License -" - -if exists('g:loaded_fontzoom') || !has('gui_running') - finish -endif -let g:loaded_fontzoom = 1 - -let s:save_cpo = &cpo -set cpo&vim - - -function! s:fontzoom(size, reset) - if a:reset - if exists('s:keep') " Reset font size. - let [&guifont, &lines, &columns] = s:keep - unlet! s:keep - endif - elseif a:size == '' - echo matchstr(&guifont, g:fontzoom_pattern) - else - let size = (a:size =~ '^[+-]' ? 'submatch(0)' : '') . a:size - if !exists('s:keep') - let s:keep = [&guifont, &lines, &columns] - endif - let &guifont = join(map(split(&guifont, '\\\@, 0) - -" Key mappings. -nnoremap (fontzoom-larger) -\ :Fontzoom +=v:count1 -nnoremap (fontzoom-smaller) -\ :Fontzoom -=v:count1 - -if !exists('g:fontzoom_no_default_key_mappings') -\ || !g:fontzoom_no_default_key_mappings - silent! nmap + (fontzoom-larger) - silent! nmap - (fontzoom-smaller) - silent! nmap (fontzoom-larger) - silent! nmap (fontzoom-smaller) -endif - -let &cpo = s:save_cpo -unlet s:save_cpo