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