kien avatar kien committed 5926cef

Open all files as hidden buffers

Comments (0)

Files changed (2)

autoload/ctrlp.vim

 	let opts = matchlist(s:opmul, '\v^(\d+)=(\w)=(\w)=$')
 	if opts == [] | retu | en
 	let [nr, md, ucr] = opts[1:3]
+	let nopt = exists('g:ctrlp_open_multiple_files')
 	if s:argmap
 		let md = s:argmaps(md)
 		if md == 'cancel' | retu | en
+		let nr = nr == '0' ? ( nopt ? '' : '1' ) : nr
 	en
 	let mkd = values(s:marked)
 	cal s:sanstail(join(s:prompt, ''))
 	if nr == '0' || md == 'i'
 		retu map(mkd, "s:openfile('bad', fnamemodify(v:val, ':.'), '')")
 	en
-	" Move the cursor to a reusable window
 	let [tail, fnesc] = [s:tail(), exists('*fnameescape') && v:version > 701]
-	let [emptytail, nwpt] = [empty(tail), exists('g:ctrlp_open_multiple_files')]
-	let bufnr = bufnr('^'.mkd[0].'$')
+	let [emptytail, bufnr] = [empty(tail), bufnr('^'.mkd[0].'$')]
 	let useb = bufnr > 0 && buflisted(bufnr) && emptytail
 	let fst = call('ctrlp#normcmd', useb ? ['b', 'bo vert sb'] : ['e'])
-	" Check if it's a replaceable buffer
+	" Check if the current window has a replaceable buffer
 	let repabl = ( empty(bufname('%')) && empty(&l:ft) ) || s:nosplit()
 	" Commands for the rest of the files
 	let [ic, cmds] = [1, { 'v': ['vert sb', 'vne'], 'h': ['sb', 'new'],
 		let cmd = ic == 1 && ( ucr == 'r' || repabl ) ? fst : snd
 		let conds = [( nr != '' && nr > 1 && nr < ic ) || ( nr == '' && ic > 1 ),
 			\ nr != '' && nr < ic]
-		if conds[nwpt]
+		if conds[nopt]
 			if bufnr <= 0 | if fnesc
 				cal s:openfile('bad', fnamemodify(va, ':.'), '')
 			el
   t - each file in a new tab.
   h - each file in a new horizontal split.
   v - each file in a new vertical split.
+  i - all files as hidden buffers.
   Reuse the current window:
   tr,
   hr,
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.