kien avatar kien committed d589d82 Draft

Move the completion function

Comments (0)

Files changed (3)

autoload/ctrlp.vim

 	endfo
 	retu cmn
 endf
-
-fu! ctrlp#dircompl(...)
-	let [hsl, str] = [match(a:1, '[\/]'), '']
-	let par = substitute(a:1, '[^\/]*$', '', '')
-	let path = !hsl ? par : hsl > 0 ? getcwd().s:lash().par : getcwd()
-	for dir in split(globpath(s:fnesc(path, 'g', ','), '*/'), '\n')
-		let str .= par.split(dir, '[\/]')[-1]."\n"
-	endfo
-	retu str
-endf
 " Misc {{{3
 fu! s:headntail(str)
 	let parts = split(a:str, '[\/]\ze[^\/]\+[\/:]\?$')

autoload/ctrlp/utils.vim

 	en
 	retu a:0 ? escape(path, a:1) : path
 endf
+
+fu! ctrlp#utils#dircompl(...)
+	let [hsl, str] = [match(a:1, '[\/]'), '']
+	let par = substitute(a:1, '[^\/]*$', '', '')
+	let path = !hsl ? par : hsl > 0 ? getcwd().s:lash().par : getcwd()
+	for dir in split(globpath(ctrlp#utils#fnesc(path, 'g', ','), '*/'), '\n')
+		let str .= par.split(dir, '[\/]')[-1]."\n"
+	endfo
+	retu str
+endf
 "}}}
 
 " vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
 if !exists('g:ctrlp_map') | let g:ctrlp_map = '<c-p>' | en
 if !exists('g:ctrlp_cmd') | let g:ctrlp_cmd = 'CtrlP' | en
 
-com! -n=? -com=custom,ctrlp#dircompl CtrlP
+com! -n=? -com=custom,ctrlp#utils#dircompl CtrlP
 	\ cal ctrlp#init(0, { 'dir': <q-args> })
 
-com! -n=? -com=custom,ctrlp#dircompl CtrlPMRUFiles
+com! -n=? -com=custom,ctrlp#utils#dircompl CtrlPMRUFiles
 	\ cal ctrlp#init(2, { 'dir': <q-args> })
 
 com! -bar CtrlPBuffer   cal ctrlp#init(1)
 com! -bar CtrlPTag      cal ctrlp#init(ctrlp#tag#id())
 com! -bar CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id())
 
-com! -n=? -com=custom,ctrlp#dircompl CtrlPDir
+com! -n=? -com=custom,ctrlp#utils#dircompl CtrlPDir
 	\ cal ctrlp#init(ctrlp#dir#id(), { 'dir': <q-args> })
 
 com! -n=? -com=buffer CtrlPBufTag
 com! -bar CtrlPMixed       cal ctrlp#init(ctrlp#mixed#id())
 com! -bar CtrlPBookmarkDir cal ctrlp#init(ctrlp#bookmarkdir#id())
 
-com! -n=? -com=custom,ctrlp#dircompl CtrlPBookmarkDirAdd
+com! -n=? -com=custom,ctrlp#utils#dircompl CtrlPBookmarkDirAdd
 	\ cal ctrlp#call('ctrlp#bookmarkdir#add', <q-args>)
 
 " vim:ts=2:sw=2:sts=2
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.