parent
92b8c399dd
commit
f0d2ce1be7
@ -60,10 +60,10 @@ fu! s:opts()
|
||||
\ 'PrtClear()': ['<c-u>'],
|
||||
\ 'PrtSelectMove("j")': ['<c-j>', '<down>'],
|
||||
\ 'PrtSelectMove("k")': ['<c-k>', '<up>'],
|
||||
\ 'PrtSelectMove("t")': ['<home>'],
|
||||
\ 'PrtSelectMove("b")': ['<end>'],
|
||||
\ 'PrtSelectMove("u")': ['<PageUp>'],
|
||||
\ 'PrtSelectMove("d")': ['<PageDown>'],
|
||||
\ 'PrtSelectMove("t")': ['<Home>', '<kHome>'],
|
||||
\ 'PrtSelectMove("b")': ['<End>', '<kEnd>'],
|
||||
\ 'PrtSelectMove("u")': ['<PageUp>', '<kPageUp>'],
|
||||
\ 'PrtSelectMove("d")': ['<PageDown>', '<kPageDown>'],
|
||||
\ 'PrtHistory(-1)': ['<c-n>'],
|
||||
\ 'PrtHistory(1)': ['<c-p>'],
|
||||
\ 'AcceptSelection("e")': ['<cr>', '<2-LeftMouse>'],
|
||||
@ -97,22 +97,6 @@ fu! s:opts()
|
||||
if type(s:urprtmaps) == 4
|
||||
cal extend(s:prtmaps, s:urprtmaps)
|
||||
en
|
||||
let s:prtunmaps = [
|
||||
\ 'PrtBS()',
|
||||
\ 'PrtDelete()',
|
||||
\ 'PrtDeleteWord()',
|
||||
\ 'PrtClear()',
|
||||
\ 'PrtCurStart()',
|
||||
\ 'PrtCurEnd()',
|
||||
\ 'PrtCurLeft()',
|
||||
\ 'PrtCurRight()',
|
||||
\ 'PrtHistory(-1)',
|
||||
\ 'PrtHistory(1)',
|
||||
\ 'PrtInsert("w")',
|
||||
\ 'PrtInsert("s")',
|
||||
\ 'PrtInsert("v")',
|
||||
\ 'PrtInsert("+")',
|
||||
\ ]
|
||||
" 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',
|
||||
@ -136,6 +120,31 @@ let s:fpats = {
|
||||
\ '^\S\\?$': '\\?',
|
||||
\ }
|
||||
|
||||
" Mappings
|
||||
let s:prtunmaps = [
|
||||
\ 'PrtBS()',
|
||||
\ 'PrtDelete()',
|
||||
\ 'PrtDeleteWord()',
|
||||
\ 'PrtClear()',
|
||||
\ 'PrtCurStart()',
|
||||
\ 'PrtCurEnd()',
|
||||
\ 'PrtCurLeft()',
|
||||
\ 'PrtCurRight()',
|
||||
\ 'PrtHistory(-1)',
|
||||
\ 'PrtHistory(1)',
|
||||
\ 'PrtInsert("w")',
|
||||
\ 'PrtInsert("s")',
|
||||
\ 'PrtInsert("v")',
|
||||
\ 'PrtInsert("+")',
|
||||
\ ]
|
||||
let s:kprange = {
|
||||
\ 'Plus': '+',
|
||||
\ 'Minus': '-',
|
||||
\ 'Divide': '/',
|
||||
\ 'Multiply': '*',
|
||||
\ 'Point': '.',
|
||||
\ }
|
||||
|
||||
" Highlight groups
|
||||
let s:hlgrps = {
|
||||
\ 'NoEntries': 'Error',
|
||||
@ -361,18 +370,17 @@ endf
|
||||
fu! s:Render(lines, pat, ipt)
|
||||
let lines = a:lines
|
||||
" Setup the match window
|
||||
let s:height = min([len(lines), s:winh])
|
||||
let [&ma, s:height] = [1, min([len(lines), s:winh])]
|
||||
sil! exe '%d _ | res' s:height
|
||||
" Print the new items
|
||||
if empty(lines)
|
||||
setl nocul
|
||||
let s:matched = []
|
||||
cal setline(1, ' == NO ENTRIES ==')
|
||||
setl noma nocul
|
||||
cal s:unmarksigns()
|
||||
if s:dohighlight() | cal clearmatches() | en
|
||||
retu
|
||||
en
|
||||
setl cul
|
||||
" Sort if not MRU
|
||||
if ( s:itemtype != 2 && !exists('g:ctrlp_nolimit') )
|
||||
\ || !empty(join(s:prompt, ''))
|
||||
@ -384,6 +392,7 @@ fu! s:Render(lines, pat, ipt)
|
||||
let s:matched = copy(lines)
|
||||
cal map(lines, 's:formatline(v:val, a:ipt)')
|
||||
cal setline(1, lines)
|
||||
setl noma cul
|
||||
exe 'keepj norm!' ( s:mwreverse ? 'G' : 'gg' ).'1|'
|
||||
cal s:unmarksigns()
|
||||
cal s:remarksigns()
|
||||
@ -623,6 +632,13 @@ fu! s:MapKeys(...)
|
||||
for each in range(32, 126)
|
||||
exe printf(cmd, each, pfunc, escape(nr2char(each), '"|\'), dojmp)
|
||||
endfo
|
||||
let kpcmd = substitute(cmd, 'char-%d', 'k%s', '')
|
||||
for each in range(0, 9)
|
||||
exe printf(kpcmd, each, pfunc, each, dojmp)
|
||||
endfo
|
||||
for [ke, va] in items(s:kprange)
|
||||
exe printf(kpcmd, ke, pfunc, va, dojmp)
|
||||
endfo
|
||||
" Special keys
|
||||
if a:0 < 2
|
||||
cal call('s:MapSpecs', a:0 && !a:1 ? [1] : [])
|
||||
@ -712,8 +728,8 @@ fu! s:SetWD(...) "{{{1
|
||||
unl! s:foundroot
|
||||
endf
|
||||
" * AcceptSelection() {{{1
|
||||
fu! ctrlp#acceptfile(mode, matchstr, ...)
|
||||
let [md, filpath] = [a:mode, fnamemodify(a:matchstr, ':p')]
|
||||
fu! ctrlp#acceptfile(mode, line, ...)
|
||||
let [md, filpath] = [a:mode, fnamemodify(a:line, ':p')]
|
||||
cal s:PrtExit()
|
||||
let [bufnr, tail] = [bufnr('^'.filpath.'$'), s:tail()]
|
||||
let j2l = a:0 ? a:1 : str2nr(matchstr(tail, '^ +\D*\zs\d\+\ze\D*'))
|
||||
@ -976,7 +992,7 @@ fu! ctrlp#statusline()
|
||||
let focus = s:Focus() ? 'prt' : 'win'
|
||||
let byfname = s:byfname ? 'file' : 'path'
|
||||
let marked = s:opmul != '0' ?
|
||||
\ exists('s:marked') ? ' <'.s:dismrk().'>' : ' <>' : ''
|
||||
\ exists('s:marked') ? ' <'.s:dismrk().'>' : ' <->' : ''
|
||||
if has_key(s:status, 'main')
|
||||
let args = [focus, byfname, s:regexp, prv, item, nxt, marked]
|
||||
let &l:stl = call(s:status['main'], args)
|
||||
@ -1004,8 +1020,8 @@ fu! ctrlp#progress(enum)
|
||||
endf
|
||||
" Paths {{{2
|
||||
fu! s:formatline(str, ipt)
|
||||
retu '> '.( a:ipt && ( s:winw - ( s:dosigns() ? 2 : 0 ) - 2 )
|
||||
\ < s:strwidth(a:str) ? pathshorten(a:str) : a:str )
|
||||
let cond = a:ipt && ( s:winw - 4 ) < s:strwidth(a:str)
|
||||
retu '> '.( cond ? pathshorten(a:str) : a:str )
|
||||
endf
|
||||
|
||||
fu! s:dircompl(be, sd)
|
||||
|
@ -165,10 +165,9 @@ only need to keep the lines that you’ve changed the values (inside []): >
|
||||
<
|
||||
Note: In some terminals, it’s not possible to remap <c-h> without also changing
|
||||
<bs> (|key-codes|). So if pressing <bs> moves the cursor to the left instead of
|
||||
deleting a char for you, add this to your |vimrc| to change the default <c-h>
|
||||
deleting a char for you, add this to your |vimrc| to disable the default <c-h>
|
||||
mapping: >
|
||||
let g:ctrlp_prompt_mappings = {
|
||||
\ 'PrtBS()': ['<bs>', '<c-]>', '<c-h>'],
|
||||
\ 'PrtCurLeft()': ['<left>', '<c-^>'],
|
||||
\ }
|
||||
<
|
||||
@ -213,7 +212,7 @@ Set to 1 to sort the MRU file list to most-recently-entered-buffer order: >
|
||||
<
|
||||
|
||||
*'g:ctrlp_dotfiles'*
|
||||
Set this to 0 if you don’t want |CtrlP| to search for dotfiles and dotdirs: >
|
||||
Set this to 0 if you don’t want |CtrlP| to scan for dotfiles and dotdirs: >
|
||||
let g:ctrlp_dotfiles = 1
|
||||
<
|
||||
You can use |'wildignore'| to exclude anything from the search.
|
||||
@ -762,6 +761,8 @@ Special thanks:~
|
||||
===============================================================================
|
||||
CHANGELOG *ctrlp-changelog*
|
||||
|
||||
Before 2012/03/01~
|
||||
|
||||
+ New option: |g:ctrlp_mruf_last_entered| change MRU to recently-entered.
|
||||
+ Extend |g:ctrlp_user_command| to support multiple commands.
|
||||
|
||||
@ -854,7 +855,7 @@ Before 2011/09/12~
|
||||
|g:ctrlp_mruf_max|,
|
||||
|g:ctrlp_mruf_exclude|,
|
||||
|g:ctrlp_mruf_include|
|
||||
+ New command: |:CtrlPMRUFiles|
|
||||
+ New command: |:CtrlPMRU|
|
||||
|
||||
First public release: 2011/09/06~
|
||||
|
||||
|
@ -26,7 +26,7 @@ com! CtrlPCurWD cal ctrlp#init(0, 0)
|
||||
com! CtrlPCurFile cal ctrlp#init(0, 1)
|
||||
com! CtrlPRoot cal ctrlp#init(0, 2)
|
||||
|
||||
if g:ctrlp_map != ''
|
||||
if g:ctrlp_map != '' && !hasmapto(':<c-u>'.g:ctrlp_cmd.'<cr>', 'n')
|
||||
exe 'nn <silent>' g:ctrlp_map ':<c-u>'.g:ctrlp_cmd.'<cr>'
|
||||
en
|
||||
|
||||
|
17
readme.md
17
readme.md
@ -16,14 +16,17 @@ Full path fuzzy __file__, __buffer__, __mru__ and __tag__ finder for Vim.
|
||||
|
||||
Once CtrlP is open:
|
||||
|
||||
* Press `<c-f>` and `<c-b>` to switch between find file, buffer, and MRU file modes.
|
||||
* Press `<c-f>` and `<c-b>` to switch between find file, buffer, and MRU file
|
||||
modes.
|
||||
* Press `<c-d>` to switch to filename only search instead of full path.
|
||||
* Press `<F5>` 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 `<c-r>` to switch to regexp mode.
|
||||
* End the input string with a colon `:` followed by a command to execute after opening the file.
|
||||
* 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.
|
||||
* Submit two dots `..` as the input string to go backward the directory tree by
|
||||
1 level.
|
||||
* Use `<c-y>` to create a new file and its parent dirs.
|
||||
* Use `<c-z>` to mark/unmark files and `<c-o>` to open them.
|
||||
|
||||
@ -34,7 +37,8 @@ e.g. `abc:45` will open the file matched the pattern and jump to line 45.
|
||||
let g:ctrlp_map = '<c-p>'
|
||||
```
|
||||
|
||||
* When CtrlP is invoked, it automatically sets the working directory according to this variable:
|
||||
* When CtrlP is invoked, it automatically sets its local working directory
|
||||
according to this variable:
|
||||
|
||||
```vim
|
||||
let g:ctrlp_working_path_mode = 2
|
||||
@ -48,10 +52,9 @@ e.g. `abc:45` will open the file matched the pattern and jump to line 45.
|
||||
.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:
|
||||
* 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user