Navigation Menu

Skip to content

Commit

Permalink
Let's see how 'we' like this numbers.vim business.
Browse files Browse the repository at this point in the history
  • Loading branch information
theIV committed Jun 29, 2012
1 parent 991193e commit f30e2a0
Show file tree
Hide file tree
Showing 53 changed files with 971 additions and 423 deletions.
154 changes: 94 additions & 60 deletions vim/bundle/ctrlp.vim/autoload/ctrlp.vim

Large diffs are not rendered by default.

16 changes: 9 additions & 7 deletions vim/bundle/ctrlp.vim/autoload/ctrlp/dir.vim
Expand Up @@ -10,12 +10,7 @@ if exists('g:loaded_ctrlp_dir') && g:loaded_ctrlp_dir
en en
let [g:loaded_ctrlp_dir, g:ctrlp_newdir] = [1, 0] let [g:loaded_ctrlp_dir, g:ctrlp_newdir] = [1, 0]


let s:ars = [ let s:ars = ['s:maxdepth', 's:maxfiles', 's:compare_lim', 's:glob', 's:caching']
\ 's:maxdepth',
\ 's:maxfiles',
\ 's:compare_lim',
\ 's:glob',
\ ]


cal add(g:ctrlp_ext_vars, { cal add(g:ctrlp_ext_vars, {
\ 'init': 'ctrlp#dir#init('.join(s:ars, ', ').')', \ 'init': 'ctrlp#dir#init('.join(s:ars, ', ').')',
Expand All @@ -27,6 +22,8 @@ cal add(g:ctrlp_ext_vars, {
\ }) \ })


let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)

let s:dircounts = {}
" Utilities {{{1 " Utilities {{{1
fu! s:globdirs(dirs, depth) fu! s:globdirs(dirs, depth)
let entries = split(globpath(a:dirs, s:glob), "\n") let entries = split(globpath(a:dirs, s:glob), "\n")
Expand All @@ -42,6 +39,10 @@ endf
fu! s:max(len, max) fu! s:max(len, max)
retu a:max && a:len > a:max ? 1 : 0 retu a:max && a:len > a:max ? 1 : 0
endf endf

fu! s:nocache()
retu !s:caching || ( s:caching > 1 && get(s:dircounts, s:cwd) < s:caching )
endf
" Public {{{1 " Public {{{1
fu! ctrlp#dir#init(...) fu! ctrlp#dir#init(...)
let s:cwd = getcwd() let s:cwd = getcwd()
Expand All @@ -50,7 +51,7 @@ fu! ctrlp#dir#init(...)
endfo endfo
let cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'dir' let cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'dir'
let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile('dir') let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile('dir')
if g:ctrlp_newdir || !filereadable(cafile) if g:ctrlp_newdir || s:nocache() || !filereadable(cafile)
let [s:initcwd, g:ctrlp_alldirs] = [s:cwd, []] let [s:initcwd, g:ctrlp_alldirs] = [s:cwd, []]
cal s:globdirs(s:cwd, 0) cal s:globdirs(s:cwd, 0)
cal ctrlp#rmbasedir(g:ctrlp_alldirs) cal ctrlp#rmbasedir(g:ctrlp_alldirs)
Expand All @@ -65,6 +66,7 @@ fu! ctrlp#dir#init(...)
let g:ctrlp_alldirs = ctrlp#utils#readfile(cafile) let g:ctrlp_alldirs = ctrlp#utils#readfile(cafile)
en en
en en
cal extend(s:dircounts, { s:cwd : len(g:ctrlp_alldirs) })
retu g:ctrlp_alldirs retu g:ctrlp_alldirs
endf endf


Expand Down
21 changes: 14 additions & 7 deletions vim/bundle/ctrlp.vim/autoload/ctrlp/rtscript.vim
Expand Up @@ -11,7 +11,7 @@ en
let [g:loaded_ctrlp_rtscript, g:ctrlp_newrts] = [1, 0] let [g:loaded_ctrlp_rtscript, g:ctrlp_newrts] = [1, 0]


cal add(g:ctrlp_ext_vars, { cal add(g:ctrlp_ext_vars, {
\ 'init': 'ctrlp#rtscript#init()', \ 'init': 'ctrlp#rtscript#init(s:caching)',
\ 'accept': 'ctrlp#acceptfile', \ 'accept': 'ctrlp#acceptfile',
\ 'lname': 'runtime scripts', \ 'lname': 'runtime scripts',
\ 'sname': 'rts', \ 'sname': 'rts',
Expand All @@ -20,9 +20,16 @@ cal add(g:ctrlp_ext_vars, {
\ }) \ })


let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars) let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)

let s:filecounts = {}
" Utilities {{{1
fu! s:nocache()
retu !s:caching || ( s:caching > 1 && get(s:filecounts, s:cwd) < s:caching )
endf
" Public {{{1 " Public {{{1
fu! ctrlp#rtscript#init() fu! ctrlp#rtscript#init(caching)
if g:ctrlp_newrts let [s:caching, s:cwd] = [a:caching, getcwd()]
if g:ctrlp_newrts || s:nocache()
\ || !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[0] == &rtp ) \ || !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[0] == &rtp )
sil! cal ctrlp#progress('Indexing...') sil! cal ctrlp#progress('Indexing...')
let entries = split(globpath(&rtp, '**/*.*'), "\n") let entries = split(globpath(&rtp, '**/*.*'), "\n")
Expand All @@ -31,13 +38,13 @@ fu! ctrlp#rtscript#init()
el el
let [entries, results] = g:ctrlp_rtscache[2:3] let [entries, results] = g:ctrlp_rtscache[2:3]
en en
let cwd = getcwd() if g:ctrlp_newrts || s:nocache()
if g:ctrlp_newrts \ || !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[:1] == [&rtp, s:cwd] )
\ || !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[:1] == [&rtp, cwd] )
if !exists('echoed') | sil! cal ctrlp#progress('Processing...') | en if !exists('echoed') | sil! cal ctrlp#progress('Processing...') | en
let results = map(copy(entries), 'fnamemodify(v:val, '':.'')') let results = map(copy(entries), 'fnamemodify(v:val, '':.'')')
en en
let [g:ctrlp_rtscache, g:ctrlp_newrts] = [[&rtp, cwd, entries, results], 0] let [g:ctrlp_rtscache, g:ctrlp_newrts] = [[&rtp, s:cwd, entries, results], 0]
cal extend(s:filecounts, { s:cwd : len(results) })
retu results retu results
endf endf


Expand Down
2 changes: 1 addition & 1 deletion vim/bundle/ctrlp.vim/autoload/ctrlp/utils.vim
Expand Up @@ -11,7 +11,7 @@ endf
let s:lash = ctrlp#utils#lash() let s:lash = ctrlp#utils#lash()


fu! s:lash(...) fu! s:lash(...)
retu match(a:0 ? a:1 : getcwd(), '[\/]$') < 0 ? s:lash : '' retu ( a:0 ? a:1 : getcwd() ) !~ '[\/]$' ? s:lash : ''
endf endf


fu! ctrlp#utils#opts() fu! ctrlp#utils#opts()
Expand Down
90 changes: 51 additions & 39 deletions vim/bundle/ctrlp.vim/doc/ctrlp.txt
@@ -1,4 +1,4 @@
*ctrlp.txt* Fuzzy file, buffer, mru and tag finder. v1.7.7 *ctrlp.txt* Fuzzy file, buffer, mru, tag, ... finder. v1.7.7
*CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'* *CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'*
=============================================================================== ===============================================================================
# # # #
Expand All @@ -23,10 +23,10 @@ CONTENTS *ctrlp-contents*
=============================================================================== ===============================================================================
INTRO *ctrlp-intro* INTRO *ctrlp-intro*


Full path fuzzy file, buffer, mru and tag finder with an intuitive interface. Full path fuzzy file, buffer, mru, tag, ... finder with an intuitive interface.
Written in pure Vimscript for MacVim and Vim version 7.0+. Has full support for Written in pure Vimscript for MacVim, gVim and Vim version 7.0+. Has full
Vim's |regexp| as search pattern, built-in MRU files monitoring, project's root support for Vim's |regexp| as search pattern, built-in MRU files monitoring,
finder, and more. project's root finder, and more.


To enable optional extensions (tag, dir, rtscript...), see |ctrlp-extensions|. To enable optional extensions (tag, dir, rtscript...), see |ctrlp-extensions|.


Expand Down Expand Up @@ -152,22 +152,25 @@ variable: >
< <
1 - the directory of the current file. 1 - the directory of the current file.
2 - the nearest ancestor that contains one of these directories or files: 2 - the nearest ancestor that contains one of these directories or files:
.git/ .hg/ .svn/ .bzr/ _darcs/ .git .hg .svn .bzr _darcs
0 - don't manage working directory. 0 - don't manage working directory.
Note: you can use b:ctrlp_working_path_mode (a |b:var|) to set this option on a Note: you can use b:ctrlp_working_path_mode (a |b:var|) to set this option on a
per buffer basis. per buffer basis.


*'g:ctrlp_root_markers'* *'g:ctrlp_root_markers'*
Use this to set your own root markers in addition to the default ones (.git/, Use this to set your own root markers in addition to the default ones (.git,
.hg/, .svn/, .bzr/, and _darcs/). Your markers will take precedence: > .hg, .svn, .bzr, and _darcs). Your markers will take precedence: >
let g:ctrlp_root_markers = [''] let g:ctrlp_root_markers = ['']
< <


*'g:ctrlp_use_caching'* *'g:ctrlp_use_caching'*
Set this to 0 to disable per-session caching. When disabled, caching will still Enable/Disable per-session caching: >
be enabled for directories that have more than 4000 files: >
let g:ctrlp_use_caching = 1 let g:ctrlp_use_caching = 1
< <
0 - Disable caching.
1 - Enable caching.
n - When bigger than 1, disable caching and use the number as the limit to
enable caching again.
Note: you can quickly purge the cache by pressing <F5> while inside CtrlP. Note: you can quickly purge the cache by pressing <F5> while inside CtrlP.


*'g:ctrlp_clear_cache_on_exit'* *'g:ctrlp_clear_cache_on_exit'*
Expand Down Expand Up @@ -250,12 +253,12 @@ when scanning large projects: >
\ } \ }
< <
Examples: > Examples: >
let g:ctrlp_user_command = ['.git/', 'cd %s && git ls-files'] 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 = ['.hg', 'hg --cwd %s locate -I .']
let g:ctrlp_user_command = { let g:ctrlp_user_command = {
\ 'types': { \ 'types': {
\ 1: ['.git/', 'cd %s && git ls-files'], \ 1: ['.git', 'cd %s && git ls-files'],
\ 2: ['.hg/', 'hg --cwd %s locate -I .'], \ 2: ['.hg', 'hg --cwd %s locate -I .'],
\ }, \ },
\ 'fallback': 'find %s -type f' \ 'fallback': 'find %s -type f'
\ } \ }
Expand Down Expand Up @@ -286,7 +289,7 @@ If non-zero, this will enable opening multiple files with <c-z> and <c-o>: >
let g:ctrlp_open_multiple_files = 'v' let g:ctrlp_open_multiple_files = 'v'
< <
Example: > Example: >
let g:ctrlp_open_multiple_files = '2vr' let g:ctrlp_open_multiple_files = '2vjr'
< <
For the number: For the number:
- If given, it'll be used as the maximum number of windows or tabs to create - If given, it'll be used as the maximum number of windows or tabs to create
Expand All @@ -297,6 +300,7 @@ For the letters:
h - each file in a new horizontal split. h - each file in a new horizontal split.
v - each file in a new vertical split. v - each file in a new vertical split.
i - all files as hidden buffers. i - all files as hidden buffers.
j - after opening, jump to the first opened tab or window.
Reuse the current window: Reuse the current window:
tr, tr,
hr, hr,
Expand All @@ -312,16 +316,20 @@ Pressing <c-o> or <c-y> will then prompt for a keypress. The key can be:
t - open in tab(s) t - open in tab(s)
h - open in horizontal split(s) h - open in horizontal split(s)
v - open in vertical split(s) v - open in vertical split(s)
r - open in current window (for <c-y> only) i - open as hidden buffers (for <c-o> only)
<esc>, <c-c>, <c-g> - cancel and go back to the prompt. c - clear the marked files (for <c-o> only)
r - open in the current window (for <c-y> only)
<esc>, <c-c>, <c-u> - cancel and go back to the prompt.
<cr> - use the default behavior specified with |g:ctrlp_open_new_file| and <cr> - use the default behavior specified with |g:ctrlp_open_new_file| and
|g:ctrlp_open_multiple_files|. |g:ctrlp_open_multiple_files|.


*'g:ctrlp_follow_symlinks'* *'g:ctrlp_follow_symlinks'*
Set this to 1 to follow symbolic links when listing files: > If non-zero, CtrlP will follow symbolic links when listing files: >
let g:ctrlp_follow_symlinks = 0 let g:ctrlp_follow_symlinks = 0
< <
When enabled, looped internal symlinks will be ignored to avoid duplicates. 0 - don't follow symbolic links.
1 - follow but ignore looped internal symlinks to avoid duplicates.
2 - follow all symlinks indiscriminately.


*'g:ctrlp_lazy_update'* *'g:ctrlp_lazy_update'*
Set this to 1 to enable the lazy-update feature: only update the match window Set this to 1 to enable the lazy-update feature: only update the match window
Expand Down Expand Up @@ -462,7 +470,7 @@ Structure of the functions: >
" +- a:next : The next search mode. " +- a:next : The next search mode.
" | " |
" +- a:marked : The number of marked files, or a comma separated list of " +- a:marked : The number of marked files, or a comma separated list of
" the filenames. " the marked filenames.
return full_statusline return full_statusline
endfunction endfunction
Expand Down Expand Up @@ -513,8 +521,8 @@ Structure of the function: >
" | + "first-non-tab": match until the first tab char. " | + "first-non-tab": match until the first tab char.
" | + "until-last-tab": match until the last tab char. " | + "until-last-tab": match until the last tab char.
" | " |
" +- a:ispath : Is 1 when searching in file, buffer, mru, dir, and rtscript " +- a:ispath : Is 1 when searching in file, buffer, mru, mixed, dir, and
" | modes. Is 0 otherwise. " | rtscript modes. Is 0 otherwise.
" | " |
" +- a:crfile : The file in the current window. Should be excluded from the " +- a:crfile : The file in the current window. Should be excluded from the
" | results when a:ispath == 1. " | results when a:ispath == 1.
Expand All @@ -534,6 +542,7 @@ COMMANDS *ctrlp-commands*


If no argument is given, the value of |g:ctrlp_working_path_mode| will be If no argument is given, the value of |g:ctrlp_working_path_mode| will be
used to determine the starting directory. used to determine the starting directory.

You can use <tab> to auto-complete the [starting-directory] when typing it. You can use <tab> to auto-complete the [starting-directory] when typing it.


*:CtrlPBuffer* *:CtrlPBuffer*
Expand All @@ -550,8 +559,8 @@ COMMANDS *ctrlp-commands*


*:CtrlPRoot* *:CtrlPRoot*
:CtrlPRoot :CtrlPRoot
This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 2 (ignores its This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 2 (ignores the
current value). variable's current value).


*:CtrlPClearCache* *:CtrlPClearCache*
:CtrlPClearCache :CtrlPClearCache
Expand All @@ -561,7 +570,7 @@ COMMANDS *ctrlp-commands*


*:CtrlPClearAllCaches* *:CtrlPClearAllCaches*
:CtrlPClearAllCaches :CtrlPClearAllCaches
Delete all the cache files saved in |g:ctrlp_cache_dir|. Delete all the cache files saved in |g:ctrlp_cache_dir| location.


------------------------------------------------------------------------------- -------------------------------------------------------------------------------
For commands provided by bundled extensions, see |ctrlp-extensions|. For commands provided by bundled extensions, see |ctrlp-extensions|.
Expand Down Expand Up @@ -605,7 +614,7 @@ Once inside the prompt:~
<c-c> <c-c>
Exit CtrlP. Exit CtrlP.


Movement:~ Moving:~


<c-j>, <c-j>,
<down> <down>
Expand Down Expand Up @@ -645,34 +654,34 @@ Editing:~
<c-u> <c-u>
Clear the input field. Clear the input field.


Input history:~ Browsing input history:~


<c-n> <c-n>
Next string in the prompt's history. Next string in the prompt's history.


<c-p> <c-p>
Previous string in the prompt's history. Previous string in the prompt's history.


Open a file:~ Opening/Creating a file:~


<cr> <cr>
Open selected file in the active window if possible. Open the selected file in the 'current' window if possible.


<c-t> <c-t>
Open selected file in a new 'tab' after the last tabpage. Open the selected file in a new 'tab' after the last tabpage.


<c-v> <c-v>
Open selected file in a 'vertical' split. Open the selected file in a 'vertical' split.


<c-x>, <c-x>,
<c-cr>, <c-cr>,
<c-s> <c-s>
Open selected file in a 'horizontal' split. Open the selected file in a 'horizontal' split.


<c-y> <c-y>
Create a new file and its parent directories. Create a new file and its parent directories.


Open multiple files:~ Opening multiple files:~


<c-z> <c-z>
- Mark/unmark a file to be opened with <c-o>. - Mark/unmark a file to be opened with <c-o>.
Expand Down Expand Up @@ -747,8 +756,8 @@ c) End the string with a colon ':' followed by a Vim command to execute that


See also: Vim's |++opt| and |+cmd|. See also: Vim's |++opt| and |+cmd|.


d) Submit two dots '..' to go backward the directory tree by 1 level. To go d) Submit two dots '..' to go upward the directory tree by 1 level. To go up
backward multiple levels, use one extra dot for each extra level: multiple levels, use one extra dot for each extra level:
> >
Raw input Interpreted as Raw input Interpreted as
.. ../ .. ../
Expand All @@ -766,7 +775,7 @@ e) Similarly, submit '/' or '\' to find and go to the project's root.
might help speeding up the intial scan (see |g:ctrlp_user_command| for more might help speeding up the intial scan (see |g:ctrlp_user_command| for more
details). details).


Note: e) and d) only work in file, directory and mixed modes. Note: d) and e) only work in file, directory and mixed modes.


f) Type the name of a non-existent file and press <c-y> to create it. Mark a f) Type the name of a non-existent file and press <c-y> to create it. Mark a
file with <c-z> to create the new file in the same directory as the marked file with <c-z> to create the new file in the same directory as the marked
Expand Down Expand Up @@ -975,7 +984,7 @@ MISCELLANEOUS CONFIGS *ctrlp-miscellaneous-configs*
> >
function! s:setcwd() function! s:setcwd()
let cph = expand('%:p:h', 1) let cph = expand('%:p:h', 1)
if match(cph, '\v^<.+>://') >= 0 | retu | en if cph =~ '^.\+://' | retu | en
for mkr in ['.git/', '.hg/', '.svn/', '.bzr/', '_darcs/', '.vimprojects'] for mkr in ['.git/', '.hg/', '.svn/', '.bzr/', '_darcs/', '.vimprojects']
let wd = call('find'.(mkr =~ '/$' ? 'dir' : 'file'), [mkr, cph.';']) let wd = call('find'.(mkr =~ '/$' ? 'dir' : 'file'), [mkr, cph.';'])
if wd != '' | let &acd = 0 | brea | en if wd != '' | let &acd = 0 | brea | en
Expand All @@ -989,7 +998,6 @@ MISCELLANEOUS CONFIGS *ctrlp-miscellaneous-configs*


* Using a |count| to invoke different commands using the same mapping: * Using a |count| to invoke different commands using the same mapping:
> >
let g:ctrlp_map = '<leader>f'
let g:ctrlp_cmd = 'exe "CtrlP".get(["", "Buffer", "MRU"], v:count)' let g:ctrlp_cmd = 'exe "CtrlP".get(["", "Buffer", "MRU"], v:count)'
< <


Expand Down Expand Up @@ -1021,12 +1029,16 @@ Special thanks:~
* Tacahiroy <github.com/tacahiroy> * Tacahiroy <github.com/tacahiroy>
* Luca Pette <github.com/lucapette> * Luca Pette <github.com/lucapette>
* Seth Fowler <github.com/sfowler> * Seth Fowler <github.com/sfowler>
* Lowe Thiderman <github.com/daethorian>


=============================================================================== ===============================================================================
CHANGELOG *ctrlp-changelog* CHANGELOG *ctrlp-changelog*


Before 2012/05/15~ Before 2012/06/15~


+ New value for |g:ctrlp_follow_symlinks|: 2.
+ New value for |g:ctrlp_open_multiple_files|: 'j'.
+ Allow using <c-t>, <c-x>, <c-v> to open files marked by <c-z>.
+ Extend '..' (|ctrlp-input-formats| (d)) + Extend '..' (|ctrlp-input-formats| (d))
+ New input format: '@cd' (|ctrlp-input-formats| (d)) + New input format: '@cd' (|ctrlp-input-formats| (d))


Expand Down

0 comments on commit f30e2a0

Please sign in to comment.