Commits

kien  committed 646bf37 Draft

Remove unneeded variables [...]

Match the tag pattern with "very nomagic"

  • Participants
  • Parent commits 24d52d8

Comments (0)

Files changed (2)

File autoload/ctrlp.vim

 	let [prt, spi] = [s:prompt, ( a:0 ? a:1 : '' )]
 	if s:abbrev != {}
 		let gmd = has_key(s:abbrev, 'gmode') ? s:abbrev['gmode'] : ''
-		let [ayt, nkw] = [( gmd =~ 't' ), ( gmd =~ 'k' )]
-		let str = ( ayt && !a:0 ) || spi == 'c' ? prt[0] : join(prt, '')
-		if ayt && nkw && !a:0 && matchstr(str, '.$') =~ '\k'
+		let str = ( gmd =~ 't' && !a:0 ) || spi == 'c' ? prt[0] : join(prt, '')
+		if gmd =~ 't' && gmd =~ 'k' && !a:0 && matchstr(str, '.$') =~ '\k'
 			retu join(prt, '')
 		en
 		let [pf, rz] = [( s:byfname ? 'f' : 'p' ), ( s:regexp ? 'r' : 'z' )]
 				let [str, s:did_exp] = [join(split(str, pat, 1), dict['expanded']), 1]
 			en
 		endfo
-		if ayt && !a:0
+		if gmd =~ 't' && !a:0
 			let prt[0] = str
 		el
 			retu str

File autoload/ctrlp/buffertag.vim

 		sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName,CtrlPTagKind
 	en
 endf
+
+fu! s:chknearby(pat)
+	if match(getline('.'), a:pat) < 0
+		let [int, forw, maxl] = [1, 1, line('$')]
+		wh !search(a:pat, 'W'.( forw ? '' : 'b' ))
+			if !forw
+				if int > maxl | brea | en
+				let int += int
+			en
+			let forw = !forw
+		endw
+	en
+endf
 " Public {{{1
 fu! ctrlp#buffertag#init(fname)
 	let bufs = exists('s:btmode') && s:btmode
 	let bufnr = str2nr(get(vals, 1))
 	if bufnr
 		cal ctrlp#acceptfile(a:mode, bufname(bufnr))
-		let pat = get(vals, 3, '')
 		exe 'norm!' str2nr(get(vals, 2, line('.'))).'G'
-		if match(getline('.'), pat) < 0
-			let [int, forw, maxl] = [1, 1, line('$')]
-			wh !search(pat, 'W'.( forw ? '' : 'b' ))
-				if !forw
-					if int > maxl | brea | en
-					let int += int
-				en
-				let forw = !forw
-			endw
-		en
+		cal s:chknearby('\V\C'.get(vals, 3, ''))
 		sil! norm! zvzz
 	en
 endf