Misc
This commit is contained in:
parent
80bc9cea8c
commit
5042a5d0de
@ -30,11 +30,19 @@ fu! s:ignore() "{{{2
|
||||
\ '_build$',
|
||||
\ ]
|
||||
let igfiles = [
|
||||
\ '[.]bak$',
|
||||
\ '\~$',
|
||||
\ '#.+#$',
|
||||
\ '[._].*\.swp$',
|
||||
\ 'core\.\d+$',
|
||||
\ '\.exe$',
|
||||
\ '\.so$',
|
||||
\ '\.bak$',
|
||||
\ '\.png$',
|
||||
\ '\.jpg$',
|
||||
\ '\.gif$',
|
||||
\ '\.zip$',
|
||||
\ '\.rar$',
|
||||
\ '\.tar\.gz$',
|
||||
\ ]
|
||||
retu {
|
||||
\ 'dir': '\v'.join(igdirs, '|'),
|
||||
@ -46,7 +54,6 @@ let [s:pref, s:opts, s:new_opts] = ['g:ctrlp_', {
|
||||
\ 'arg_map': ['s:argmap', 0],
|
||||
\ 'buffer_func': ['s:buffunc', {}],
|
||||
\ 'by_filename': ['s:byfname', 0],
|
||||
\ 'clear_cache_on_exit': ['s:clrex', 1],
|
||||
\ 'custom_ignore': ['s:usrign', s:ignore()],
|
||||
\ 'default_input': ['s:deftxt', 0],
|
||||
\ 'dont_split': ['s:nosplit', 'netrw'],
|
||||
@ -262,7 +269,7 @@ fu! s:Close()
|
||||
endf
|
||||
" * Clear caches {{{1
|
||||
fu! ctrlp#clr(...)
|
||||
let g:ctrlp_new{ a:0 ? a:1 : 'cache' } = 1
|
||||
let [s:matches, g:ctrlp_new{ a:0 ? a:1 : 'cache' }] = [1, 1]
|
||||
endf
|
||||
|
||||
fu! ctrlp#clra()
|
||||
@ -321,12 +328,15 @@ fu! s:GlobPath(dirs, depth)
|
||||
endf
|
||||
|
||||
fu! s:UserCmd(lscmd)
|
||||
let path = s:dyncwd
|
||||
let [path, lscmd] = [s:dyncwd, a:lscmd]
|
||||
if exists('+ssl') && &ssl
|
||||
let [ssl, &ssl, path] = [&ssl, 0, tr(path, '/', '\')]
|
||||
en
|
||||
if has('win32') || has('win64')
|
||||
let lscmd = substitute(lscmd, '\v(^|&&\s*)\zscd (/d)@!', 'cd /d ', '')
|
||||
en
|
||||
let path = exists('*shellescape') ? shellescape(path) : path
|
||||
let g:ctrlp_allfiles = split(system(printf(a:lscmd, path)), "\n")
|
||||
let g:ctrlp_allfiles = split(system(printf(lscmd, path)), "\n")
|
||||
if exists('+ssl') && exists('ssl')
|
||||
let &ssl = ssl
|
||||
cal map(g:ctrlp_allfiles, 'tr(v:val, "\\", "/")')
|
||||
@ -1420,7 +1430,8 @@ endf
|
||||
|
||||
fu! s:leavepre()
|
||||
if exists('s:bufnr') && s:bufnr == bufnr('%') | bw! | en
|
||||
if s:clrex && !( has('clientserver') && len(split(serverlist(), "\n")) > 1 )
|
||||
if exists('g:ctrlp_clear_cache_on_exit') && g:ctrlp_clear_cache_on_exit
|
||||
\ && !( has('clientserver') && len(split(serverlist(), "\n")) > 1 )
|
||||
cal ctrlp#clra()
|
||||
en
|
||||
endf
|
||||
@ -1627,7 +1638,7 @@ fu! s:settype(type)
|
||||
endf
|
||||
" Matching {{{2
|
||||
fu! s:matchfname(item, pat)
|
||||
retu match(split(a:item, s:lash)[-1], a:pat)
|
||||
retu match(split(a:item, '[\/]')[-1], a:pat)
|
||||
endf
|
||||
|
||||
fu! s:matchtabs(item, pat)
|
||||
|
@ -49,7 +49,8 @@ fu! s:getbookmarks()
|
||||
endf
|
||||
|
||||
fu! s:savebookmark(name, cwd)
|
||||
let entries = filter(s:getbookmarks(), 's:parts(v:val)[1] != a:cwd')
|
||||
let cwds = exists('+ssl') ? [tr(a:cwd, '\', '/'), tr(a:cwd, '/', '\')] : [a:cwd]
|
||||
let entries = filter(s:getbookmarks(), 'index(cwds, s:parts(v:val)[1]) < 0')
|
||||
cal s:writecache(insert(entries, a:name.' '.a:cwd))
|
||||
endf
|
||||
|
||||
|
@ -572,6 +572,7 @@ MAPPINGS *ctrlp-mappings*
|
||||
<c-p>
|
||||
Default |Normal| mode mapping to open the CtrlP prompt in find file mode.
|
||||
|
||||
----------------------------------------
|
||||
Once inside the prompt:~
|
||||
|
||||
<c-d>
|
||||
@ -592,13 +593,19 @@ Once inside the prompt:~
|
||||
<c-down>
|
||||
Scroll to the 'previous' search mode in the sequence.
|
||||
|
||||
<tab>
|
||||
<tab> *'ctrlp-autocompletion'*
|
||||
Auto-complete directory names under the current working directory inside
|
||||
the prompt.
|
||||
|
||||
<s-tab>
|
||||
Toggle the focus between the match window and the prompt.
|
||||
|
||||
<esc>,
|
||||
<c-c>
|
||||
Exit CtrlP.
|
||||
|
||||
Movement:~
|
||||
|
||||
<c-j>,
|
||||
<down>
|
||||
Move selection down.
|
||||
@ -622,6 +629,8 @@ Once inside the prompt:~
|
||||
<right>
|
||||
Move the cursor one character to the 'right'.
|
||||
|
||||
Editing:~
|
||||
|
||||
<c-]>,
|
||||
<bs>
|
||||
Delete the preceding character.
|
||||
@ -635,6 +644,16 @@ Once inside the prompt:~
|
||||
<c-u>
|
||||
Clear the input field.
|
||||
|
||||
Input history:~
|
||||
|
||||
<c-n>
|
||||
Next string in the prompt’s history.
|
||||
|
||||
<c-p>
|
||||
Previous string in the prompt’s history.
|
||||
|
||||
Open a file:~
|
||||
|
||||
<cr>
|
||||
Open selected file in the active window if possible.
|
||||
|
||||
@ -652,42 +671,38 @@ Once inside the prompt:~
|
||||
<c-y>
|
||||
Create a new file and its parent directories.
|
||||
|
||||
<c-n>
|
||||
Next string in the prompt’s history.
|
||||
|
||||
<c-p>
|
||||
Previous string in the prompt’s history.
|
||||
Open multiple files:~
|
||||
|
||||
<c-z>
|
||||
- Mark/unmark a file to be opened with <c-o>.
|
||||
- Or mark/unmark a file to create a new file in its directory using <c-y>.
|
||||
- Mark/unmark a file to create a new file in its directory using <c-y>.
|
||||
|
||||
<c-o>
|
||||
Open files marked by <c-z>.
|
||||
|
||||
Function keys:~
|
||||
|
||||
<F5>
|
||||
- Refresh the match window and purge the cache for the current directory.
|
||||
- Or remove deleted files from the MRU list.
|
||||
- Remove deleted files from the MRU list.
|
||||
|
||||
<F7>
|
||||
- Wipe the MRU list.
|
||||
- Or delete MRU entries marked by <c-z>.
|
||||
- Delete MRU entries marked by <c-z>.
|
||||
|
||||
<Insert>,
|
||||
Pasting:~
|
||||
|
||||
<Insert>, *'ctrlp-pasting'*
|
||||
<MiddleMouse>
|
||||
Insert clipboard content into the prompt.
|
||||
Paste the clipboard content into the prompt.
|
||||
|
||||
<c-\>
|
||||
Open a dialog to insert <cword>, <cfile>, content of the search register,
|
||||
the last visual selection or the clipboard into the prompt.
|
||||
|
||||
<esc>,
|
||||
<c-c>
|
||||
Exit CtrlP.
|
||||
Note: <c-c> can also be used to stop the scan if it’s taking too long.
|
||||
Open a text dialog to paste <cword>, <cfile>, the content of the search
|
||||
register, the last visual selection or the clipboard into the prompt.
|
||||
|
||||
Choose your own mappings with |g:ctrlp_prompt_mappings|.
|
||||
|
||||
----------------------------------------
|
||||
When inside the match window (press <s-tab> to switch):~
|
||||
|
||||
a-z
|
||||
@ -988,6 +1003,8 @@ Special thanks:~
|
||||
===============================================================================
|
||||
CHANGELOG *ctrlp-changelog*
|
||||
|
||||
Before 2012/04/30~
|
||||
|
||||
+ New option: |g:ctrlp_mruf_default_order|
|
||||
+ New feature: Bookmarked directories extension.
|
||||
+ New commands: |:CtrlPBookmarkDir|
|
||||
|
Loading…
Reference in New Issue
Block a user