diff --git a/autoload/ctrlp.vim b/autoload/ctrlp.vim index 945f6aa..27c904b 100644 --- a/autoload/ctrlp.vim +++ b/autoload/ctrlp.vim @@ -23,11 +23,11 @@ else unl g:ctrlp_match_window_reversed endif -if !exists('g:ctrlp_persistence_input') +if !exists('g:ctrlp_persistent_input') let s:pinput = 1 else - let s:pinput = g:ctrlp_persistence_input - unl g:ctrlp_persistence_input + let s:pinput = g:ctrlp_persistent_input + unl g:ctrlp_persistent_input endif if !exists('g:ctrlp_split_window') @@ -153,9 +153,8 @@ func! s:ListAllFiles(path) "{{{ endfunc "}}} func! s:ListAllBuffers() "{{{ - let nbufs = bufnr('$') let allbufs = [] - for each in range(1, nbufs) + for each in range(1, bufnr('$')) if getbufvar(each, '&bl') let bufname = bufname(each) if strlen(bufname) && getbufvar(each, '&ma') && bufname != 'ControlP' @@ -204,7 +203,7 @@ endfunc "}}} func! s:GetMatchedItems(items, pats, limit) "{{{ let items = a:items - let pats = a:pats + let pats = a:pats let limit = a:limit " if pattern contains line number if match(pats[-1], ':\d*$') >= 0 @@ -367,7 +366,7 @@ func! s:UpdateMatches(pat) "{{{ " Delete the buffer's content sil! %d _ let newpat = s:SplitPattern(a:pat) - let lines = s:GetMatchedItems(s:lines, newpat, s:mxheight) + let lines = s:GetMatchedItems(s:lines, newpat, s:mxheight) cal s:Renderer(lines) "cal s:Highlight(newpat) endfunc "}}} @@ -607,10 +606,12 @@ func! s:Type(type) "{{{ endfunc "}}} "Mightdo: Highlight matched characters/strings. /low -func! s:Highlight(pat) "{{{ +func! s:Highlight(...) "{{{ + hi clear CtrlPKeywords hi link CtrlPKeywords Normal - if !empty(a:pat) - exe 'syn match CtrlPKeywords /\c'.a:pat.'/' + if exists('a:1') && !empty(a:1) + let pat = substitute(a:1[-1], ':\d*$', '', 'g') + exe 'syn match CtrlPKeywords /\c'.pat.'/' hi link CtrlPKeywords Constant endif endfunc "}}} @@ -725,10 +726,8 @@ func! s:statusline(...) cal remove(itemtypes, 2) endif let max = len(itemtypes) - 1 - let next = s:walker(max, s:itemtype, 1, 1) - let prev = s:walker(max, s:itemtype, -1, 1) - let next = itemtypes[next][1] - let prev = itemtypes[prev][1] + let next = itemtypes[s:walker(max, s:itemtype, 1, 1)][1] + let prev = itemtypes[s:walker(max, s:itemtype, -1, 1)][1] let regex = s:regexp ? '[regex]' : '' let byfname = s:byfname ? '[file]' : '[path]' let focus = s:Focus() ? '[prt]' : '[win]' diff --git a/autoload/ctrlp/utils.vim b/autoload/ctrlp/utils.vim index 3abd830..0cf6419 100644 --- a/autoload/ctrlp/utils.vim +++ b/autoload/ctrlp/utils.vim @@ -30,8 +30,7 @@ func! ctrlp#utils#readfile(file) if filereadable(a:file) let data = readfile(a:file) if empty(data) || type(data) != 3 - unl data - let data = [] + unl data | let data = [] endif retu data else diff --git a/doc/ctrlp.txt b/doc/ctrlp.txt index f86241b..da84d20 100644 --- a/doc/ctrlp.txt +++ b/doc/ctrlp.txt @@ -50,10 +50,10 @@ setting is from bottom to top: > let g:ctrlp_match_window_reversed = 1 < - *'g:ctrlp_persistence_input'* + *'g:ctrlp_persistent_input'* Remember the last input string and position of the selection in the match window: > - let g:ctrlp_persistence_input = 1 + let g:ctrlp_persistent_input = 1 < *'g:ctrlp_split_window'* @@ -67,7 +67,7 @@ Use this option to specify how the file is to be opened when pressing : < *'g:ctrlp_ignore_space'* -if you want the search to include whitespaces, change this to 0: > +If you want the search to include whitespaces, change this to 0: > let g:ctrlp_ignore_space = 1 < @@ -176,7 +176,7 @@ And if you want |CtrlP| to only remember some files, specify them here: > let g:ctrlp_mruf_include = '' < Example: > - let g:ctrlp_mruf_exclude = '\.py$\|\.rb$' + let g:ctrlp_mruf_include = '\.py$\|\.rb$' < =============================================================================== diff --git a/readme.md b/readme.md index a178c75..2e6cf1d 100644 --- a/readme.md +++ b/readme.md @@ -9,11 +9,11 @@ Full path fuzzy file, buffer and MRU file finder for Vim. ## Basic Usage * Press `` or run `:CtrlP` to invoke CtrlP. -* Press `` ` while CtrlP is open to switch between find file, find buffer, and find MRU file modes. +* Press `` and `` while CtrlP is open to switch between find file, find buffer, and find MRU file modes. * Ever remember only a file’s name but not where it is? Press `` while CtrlP is open to switch to filename only search. * Use `*` `?` `^` `+` or `|` in the prompt to submit the string as a Vim’s regexp pattern. * Or press `` while CtrlP is open to switch to full regexp search mode. -* End the input string with a colon `:` followed by a number to jump to that line in the selected file. +* End the input string with a colon `:` followed with a number to jump to that line in the selected file. e.g. `abc:45` to open the file matched the pattern and jump to line 45. _Screenshot: filename only mode with the match window focused._ @@ -26,7 +26,7 @@ _Screenshot: filename only mode with the match window focused._ let g:ctrlp_map = '' ``` -* When CtrlP is invoke, it automatically sets the working directory according to this variable: +* When CtrlP is invoked, it automatically sets the working directory according to this variable: ```vim let g:ctrlp_working_path_mode = 1