evilroot avatar evilroot committed 30dc602

changes

Comments (0)

Files changed (16)

.vim/UltiSnips/html.snippets

 endsnippet
 
 snippet div "XHTML <div>"
-<div${1: id="${2:name}"}>
-	$0
+<div`!p snip.rv=' id="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""`>
+   $0
 </div>
 endsnippet
 

.vim/autoload/ctrlp.vim

 " =============================================================================
 
 " ** Static variables {{{1
-fu! s:ignore() "{{{2
+" s:ignore() {{{2
+fu! s:ignore()
 	let igdirs = [
 		\ '\.git',
 		\ '\.hg',
 		\ 'dir': '\v[\/]('.join(igdirs, '|').')$',
 		\ 'file': '\v'.join(igfiles, '|'),
 		\ }
-endf "}}}2
-" Options
-let [s:pref, s:opts, s:new_opts] = ['g:ctrlp_', {
+endf
+" Script local vars {{{2
+let [s:pref, s:bpref, s:opts, s:new_opts, s:lc_opts] =
+	\ ['g:ctrlp_', 'b:ctrlp_', {
+	\ 'abbrev':                ['s:abbrev', {}],
 	\ 'arg_map':               ['s:argmap', 0],
 	\ 'buffer_func':           ['s:buffunc', {}],
 	\ 'by_filename':           ['s:byfname', 0],
 	\ 'custom_ignore':         ['s:usrign', s:ignore()],
 	\ 'default_input':         ['s:deftxt', 0],
 	\ 'dont_split':            ['s:nosplit', 'netrw'],
-	\ 'dotfiles':              ['s:dotfiles', 1],
+	\ 'dotfiles':              ['s:showhidden', 0],
 	\ 'extensions':            ['s:extensions', []],
 	\ 'follow_symlinks':       ['s:folsym', 0],
 	\ 'highlight_match':       ['s:mathi', [1, 'CtrlPMatch']],
-	\ 'jump_to_buffer':        ['s:jmptobuf', 2],
+	\ 'jump_to_buffer':        ['s:jmptobuf', 'Et'],
+	\ 'key_loop':              ['s:keyloop', 0],
 	\ 'lazy_update':           ['s:lazy', 0],
 	\ 'match_func':            ['s:matcher', {}],
 	\ 'match_window_bottom':   ['s:mwbottom', 1],
 	\ 'use_caching':           ['s:caching', 1],
 	\ 'use_migemo':            ['s:migemo', 0],
 	\ 'user_command':          ['s:usrcmd', ''],
-	\ 'working_path_mode':     ['s:pathmode', 'rc'],
+	\ 'working_path_mode':     ['s:pathmode', 'ra'],
 	\ }, {
 	\ 'open_multiple_files':   's:opmul',
 	\ 'regexp':                's:regexp',
 	\ 'reuse_window':          's:nosplit',
+	\ 'show_hidden':           's:showhidden',
 	\ 'switch_buffer':         's:jmptobuf',
+	\ }, {
+	\ 'root_markers':          's:rmarkers',
+	\ 'user_command':          's:usrcmd',
+	\ 'working_path_mode':     's:pathmode',
 	\ }]
 
 " Global options
 	\ '^\S\\?$': '\\?',
 	\ }
 
-" Specials
-let s:prtunmaps = [
-	\ 'PrtBS()',
-	\ 'PrtDelete()',
-	\ 'PrtDeleteWord()',
-	\ 'PrtClear()',
-	\ 'PrtCurStart()',
-	\ 'PrtCurEnd()',
-	\ 'PrtCurLeft()',
-	\ 'PrtCurRight()',
-	\ 'PrtHistory(-1)',
-	\ 'PrtHistory(1)',
-	\ 'PrtInsert("c")',
-	\ 'PrtInsert()',
-	\ ]
-
 " Keypad
 let s:kprange = {
 	\ 'Plus': '+',
 	\ 'PrtText': 'Normal',
 	\ 'PrtCursor': 'Constant',
 	\ }
-
-fu! s:opts() "{{{2
-	" Options
+" s:opts() {{{2
+fu! s:opts(...)
 	unl! s:usrign s:usrcmd s:urprtmaps
 	for each in ['byfname', 'regexp', 'extensions'] | if exists('s:'.each)
 		let {each} = s:{each}
 	for [ke, va] in items(s:new_opts)
 		let {va} = {exists(s:pref.ke) ? s:pref.ke : va}
 	endfo
+	unl va
+	for [ke, va] in items(s:lc_opts)
+		if exists(s:bpref.ke)
+			unl {va}
+			let {va} = {s:bpref.ke}
+		en
+	endfo
+	if a:0 && a:1 != {}
+		unl va
+		for [ke, va] in items(a:1)
+			let opke = substitute(ke, '\(\w:\)\?ctrlp_', '', '')
+			if has_key(s:lc_opts, opke)
+				let sva = s:lc_opts[opke]
+				unl {sva}
+				let {sva} = va
+			en
+		endfo
+	en
 	for each in ['byfname', 'regexp'] | if exists(each)
 		let s:{each} = {each}
 	en | endfo
 	if !exists('g:ctrlp_newcache') | let g:ctrlp_newcache = 0 | en
 	let s:maxdepth = min([s:maxdepth, 100])
 	let s:mxheight = max([s:mxheight, 1])
-	let s:glob = s:dotfiles ? '.*\|*' : '*'
+	let s:glob = s:showhidden ? '.*\|*' : '*'
 	let s:igntype = empty(s:usrign) ? -1 : type(s:usrign)
+	if s:keyloop
+		let [s:lazy, s:glbs['imd']] = [0, 0]
+	en
 	if s:lazy
 		cal extend(s:glbs, { 'ut': ( s:lazy > 1 ? s:lazy : 250 ) })
 	en
 "}}}1
 " * Open & Close {{{1
 fu! s:Open()
-	let s:ermsg = v:errmsg
 	cal s:log(1)
 	cal s:getenv()
 	cal s:execextvar('enter')
 	sil! exe 'keepa' ( s:mwbottom ? 'bo' : 'to' ) '1new ControlP'
 	cal s:buffunc(1)
-	let [s:bufnr, s:prompt, s:winw] = [bufnr('%'), ['', '', ''], winwidth(0)]
+	let [s:bufnr, s:winw] = [bufnr('%'), winwidth(0)]
+	let [s:focus, s:prompt] = [1, ['', '', '']]
 	abc <buffer>
 	if !exists('s:hstry')
 		let hst = filereadable(s:gethistloc()[1]) ? s:gethistdata() : ['']
 		exe s:winres[0]
 	en
 	unl! s:focus s:hisidx s:hstgot s:marked s:statypes s:cline s:init s:savestr
-		\ s:mrbs
+		\ s:mrbs s:did_exp
 	cal ctrlp#recordhist()
 	cal s:execextvar('exit')
 	cal s:log(0)
 	cal ctrlp#clr()
 endf
 
-fu! ctrlp#reset()
-	cal s:opts()
+fu! s:Reset(args)
+	let opts = has_key(a:args, 'opts') ? [a:args['opts']] : []
+	cal call('s:opts', opts)
 	cal s:autocmds()
 	cal ctrlp#utils#opts()
 	cal s:execextvar('opts')
 " * MatchedItems() {{{1
 fu! s:MatchIt(items, pat, limit, exc)
 	let [lines, id] = [[], 0]
-	let pat = s:byfname ?
-		\ map(split(a:pat, '^[^;]\+\zs;', 1), 's:martcs.v:val') : s:martcs.a:pat
+	let pat =
+		\ s:byfname ? map(split(a:pat, '^[^;]\+\\\@<!\zs;', 1), 's:martcs.v:val')
+		\ : s:martcs.a:pat
 	for item in a:items
 		let id += 1
 		try | if !( s:ispath && item == a:exc ) && call(s:mfunc, [item, pat]) >= 0
 		let lines = s:MatchIt(items, a:pat, a:limit, exc)
 	en
 	let s:matches = len(lines)
+	unl! s:did_exp
 	retu lines
 endf
 
 " * BuildPrompt() {{{1
 fu! s:Render(lines, pat)
 	let [&ma, lines, s:height] = [1, a:lines, min([len(a:lines), s:winh])]
-	let pat = s:byfname ? split(a:pat, '^[^;]\+\zs;', 1)[0] : a:pat
+	let pat = s:byfname ? split(a:pat, '^[^;]\+\\\@<!\zs;', 1)[0] : a:pat
 	" Setup the match window
 	sil! exe '%d _ | res' s:height
 	" Print the new items
 endf
 
 fu! s:ForceUpdate()
-	let [estr, prt] = ['"\', copy(s:prompt)]
-	cal map(prt, 'escape(v:val, estr)')
-	sil! cal s:Update(join(prt, ''))
+	sil! cal s:Update(escape(s:getinput(), '\'))
 endf
 
-fu! s:BuildPrompt(upd, ...)
+fu! s:BuildPrompt(upd)
 	let base = ( s:regexp ? 'r' : '>' ).( s:byfname ? 'd' : '>' ).'> '
-	let [estr, prt] = ['"\', copy(s:prompt)]
-	cal map(prt, 'escape(v:val, estr)')
-	let str = join(prt, '')
-	let lazy = empty(str) || exists('s:force') || !has('autocmd') ? 0 : s:lazy
-	if a:upd && !lazy && ( s:matches || s:regexp
+	let str = escape(s:getinput(), '\')
+	let lazy = str == '' || exists('s:force') || !has('autocmd') ? 0 : s:lazy
+	if a:upd && !lazy && ( s:matches || s:regexp || exists('s:did_exp')
 		\ || str =~ '\(\\\(<\|>\)\|[*|]\)\|\(\\\:\([^:]\|\\:\)*$\)' )
 		sil! cal s:Update(str)
 	en
 	sil! cal ctrlp#statusline()
 	" Toggling
-	let [hiactive, hicursor, base] = a:0 && !a:1
-		\ ? ['CtrlPPrtBase', 'CtrlPPrtBase', tr(base, '>', '-')]
-		\ : ['CtrlPPrtText', 'CtrlPPrtCursor', base]
+	let [hiactive, hicursor, base] = s:focus
+		\ ? ['CtrlPPrtText', 'CtrlPPrtCursor', base]
+		\ : ['CtrlPPrtBase', 'CtrlPPrtBase', tr(base, '>', '-')]
 	let hibase = 'CtrlPPrtBase'
 	" Build it
 	redr
+	let prt = copy(s:prompt)
+	cal map(prt, 'escape(v:val, ''"\'')')
 	exe 'echoh' hibase '| echon "'.base.'"
 		\ | echoh' hiactive '| echon "'.prt[0].'"
 		\ | echoh' hicursor '| echon "'.prt[1].'"
 		\ | echoh' hiactive '| echon "'.prt[2].'" | echoh None'
 	" Append the cursor at the end
-	if empty(prt[1]) && !( a:0 && !a:1 )
+	if empty(prt[1]) && s:focus
 		exe 'echoh' hibase '| echon "_" | echoh None'
 	en
 endf
 " ** Prt Actions {{{1
 " Editing {{{2
 fu! s:PrtClear()
+	if !s:focus | retu | en
 	unl! s:hstgot
 	let [s:prompt, s:matches] = [['', '', ''], 1]
 	cal s:BuildPrompt(1)
 endf
 
 fu! s:PrtBS()
+	if !s:focus | retu | en
 	unl! s:hstgot
 	let [s:prompt[0], s:matches] = [substitute(s:prompt[0], '.$', '', ''), 1]
 	cal s:BuildPrompt(1)
 endf
 
 fu! s:PrtDelete()
+	if !s:focus | retu | en
 	unl! s:hstgot
 	let [prt, s:matches] = [s:prompt, 1]
 	let prt[1] = matchstr(prt[2], '^.')
 endf
 
 fu! s:PrtDeleteWord()
+	if !s:focus | retu | en
 	unl! s:hstgot
 	let [str, s:matches] = [s:prompt[0], 1]
 	let str = str =~ '\W\w\+$' ? matchstr(str, '^.\+\W\ze\w\+$')
 endf
 
 fu! s:PrtInsert(...)
+	if !s:focus | retu | en
 	let type = !a:0 ? '' : a:1
 	if !a:0
 		let type = s:insertstr()
 endf
 
 fu! s:PrtExpandDir()
-	let str = s:prompt[0]
+	if !s:focus | retu | en
+	let str = s:getinput('c')
 	if str =~ '\v^\@(cd|lc[hd]?|chd)\s.+' && s:spi
 		let hasat = split(str, '\v^\@(cd|lc[hd]?|chd)\s*\zs')
 		let str = get(hasat, 1, '')
 endf
 " Movement {{{2
 fu! s:PrtCurLeft()
+	if !s:focus | retu | en
 	let prt = s:prompt
 	if !empty(prt[0])
 		let s:prompt = [substitute(prt[0], '.$', '', ''), matchstr(prt[0], '.$'),
 endf
 
 fu! s:PrtCurRight()
+	if !s:focus | retu | en
 	let prt = s:prompt
 	let s:prompt = [prt[0] . prt[1], matchstr(prt[2], '^.'),
 		\ substitute(prt[2], '^.', '', '')]
 endf
 
 fu! s:PrtCurStart()
+	if !s:focus | retu | en
 	let str = join(s:prompt, '')
 	let s:prompt = ['', matchstr(str, '^.'), substitute(str, '^.', '', '')]
 	cal s:BuildPrompt(0)
 endf
 
 fu! s:PrtCurEnd()
+	if !s:focus | retu | en
 	let s:prompt = [join(s:prompt, ''), '', '']
 	cal s:BuildPrompt(0)
 endf
 	let dirs = {'t': 'gg','b': 'G','j': 'j','k': 'k','u': wht.'k','d': wht.'j'}
 	exe 'keepj norm!' dirs[a:dir]
 	if s:nolim != 1 | let s:cline = line('.') | en
-	if line('$') > winheight(0) | cal s:BuildPrompt(0, s:Focus()) | en
+	if line('$') > winheight(0) | cal s:BuildPrompt(0) | en
 endf
 
-fu! s:PrtSelectJump(char, ...)
+fu! s:PrtSelectJump(char)
 	let lines = copy(s:lines)
-	if a:0
+	if s:byfname
 		cal map(lines, 'split(v:val, ''[\/]\ze[^\/]\+$'')[-1]')
 	en
 	" Cycle through matches, use s:jmpchr to store last jump
-	let chr = escape(a:char, '.~')
-	if match(lines, '\c^'.chr) >= 0
+	let chr = escape(matchstr(a:char, '^.'), '.~')
+	let smartcs = &scs && chr =~ '\u' ? '\C' : ''
+	if match(lines, smartcs.'^'.chr) >= 0
 		" If not exists or does but not for the same char
-		let pos = match(lines, '\c^'.chr)
+		let pos = match(lines, smartcs.'^'.chr)
 		if !exists('s:jmpchr') || ( exists('s:jmpchr') && s:jmpchr[0] != chr )
 			let [jmpln, s:jmpchr] = [pos, [chr, pos]]
 		elsei exists('s:jmpchr') && s:jmpchr[0] == chr
 			" Start of lines
 			if s:jmpchr[1] == -1 | let s:jmpchr[1] = pos | en
-			let npos = match(lines, '\c^'.chr, s:jmpchr[1] + 1)
+			let npos = match(lines, smartcs.'^'.chr, s:jmpchr[1] + 1)
 			let [jmpln, s:jmpchr] = [npos == -1 ? pos : npos, [chr, npos]]
 		en
-		keepj exe jmpln + 1
+		exe 'keepj norm!' ( jmpln + 1 ).'G'
 		if s:nolim != 1 | let s:cline = line('.') | en
-		if line('$') > winheight(0) | cal s:BuildPrompt(0, s:Focus()) | en
+		if line('$') > winheight(0) | cal s:BuildPrompt(0) | en
 	en
 endf
 " Misc {{{2
+fu! s:PrtFocusMap(char)
+	cal call(( s:focus ? 's:PrtAdd' : 's:PrtSelectJump' ), [a:char])
+endf
+
 fu! s:PrtClearCache()
 	if s:itemtype == 0
 		cal ctrlp#clr()
 endf
 
 fu! s:PrtHistory(...)
-	if !s:maxhst | retu | en
+	if !s:focus || !s:maxhst | retu | en
 	let [str, hst, s:matches] = [join(s:prompt, ''), s:hstry, 1]
 	" Save to history if not saved before
 	let [hst[0], hslen] = [exists('s:hstgot') ? hst[0] : str, len(hst)]
 	unl s:force
 endf
 "}}}1
-" * MapKeys() {{{1
-fu! s:MapKeys(...)
-	" Normal keys
-	let pfunc = a:0 && !a:1 ? 'PrtSelectJump' : 'PrtAdd'
-	let dojmp = s:byfname && a:0 && !a:1 ? ', 1' : ''
-	let pcmd = "nn \<buffer> \<silent> \<k%s> :\<c-u>cal \<SID>%s(\"%s\"%s)\<cr>"
+" * Mappings {{{1
+fu! s:MapNorms()
+	if exists('s:nmapped') && s:nmapped == s:bufnr | retu | en
+	let pcmd = "nn \<buffer> \<silent> \<k%s> :\<c-u>cal \<SID>%s(\"%s\")\<cr>"
 	let cmd = substitute(pcmd, 'k%s', 'char-%d', '')
-	for each in range(32, 126)
-		exe printf(cmd, each, pfunc, escape(nr2char(each), '"|\'), dojmp)
+	let pfunc = 'PrtFocusMap'
+	let ranges = [32, 33, 125, 126] + range(35, 91) + range(93, 123)
+	for each in [34, 92, 124]
+		exe printf(cmd, each, pfunc, escape(nr2char(each), '"|\'))
+	endfo
+	for each in ranges
+		exe printf(cmd, each, pfunc, nr2char(each))
 	endfo
 	for each in range(0, 9)
-		exe printf(pcmd, each, pfunc, each, dojmp)
+		exe printf(pcmd, each, pfunc, each)
 	endfo
 	for [ke, va] in items(s:kprange)
-		exe printf(pcmd, ke, pfunc, va, dojmp)
+		exe printf(pcmd, ke, pfunc, va)
 	endfo
-	" Special keys
-	if a:0 < 2
-		cal call('s:MapSpecs', a:0 && !a:1 ? [1] : [])
-	en
+	let s:nmapped = s:bufnr
 endf
 
-fu! s:MapSpecs(...)
-	" Correct arrow keys in terminal
-	if ( has('termresponse') && v:termresponse =~ "\<ESC>" )
-		\ || &term =~? '\vxterm|<k?vt|gnome|screen|linux|ansi'
-		for each in ['\A <up>','\B <down>','\C <right>','\D <left>']
-			exe s:lcmap.' <esc>['.each
-		endfo
-	en
-	if a:0
-		for ke in s:prtunmaps | for kp in s:prtmaps[ke]
-			exe s:lcmap kp '<Nop>'
-		endfo | endfo
-	el
-		for [ke, va] in items(s:prtmaps) | for kp in va
-			exe s:lcmap kp ':<c-u>cal <SID>'.ke.'<cr>'
-		endfo | endfo
+fu! s:MapSpecs()
+	if !( exists('s:smapped') && s:smapped == s:bufnr )
+		" Correct arrow keys in terminal
+		if ( has('termresponse') && v:termresponse =~ "\<ESC>" )
+			\ || &term =~? '\vxterm|<k?vt|gnome|screen|linux|ansi'
+			for each in ['\A <up>','\B <down>','\C <right>','\D <left>']
+				exe s:lcmap.' <esc>['.each
+			endfo
+		en
 	en
-endf
-" * Toggling {{{1
-fu! s:Focus()
-	retu !exists('s:focus') ? 1 : s:focus
+	for [ke, va] in items(s:prtmaps) | for kp in va
+		exe s:lcmap kp ':<c-u>cal <SID>'.ke.'<cr>'
+	endfo | endfo
+	let s:smapped = s:bufnr
 endf
 
+fu! s:KeyLoop()
+	wh exists('s:init') && s:keyloop
+		redr
+		let nr = getchar()
+		let chr = !type(nr) ? nr2char(nr) : nr
+		if nr >=# 0x20
+			cal s:PrtFocusMap(chr)
+		el
+			let cmd = matchstr(maparg(chr), ':<C-U>\zs.\+\ze<CR>$')
+			exe ( cmd != '' ? cmd : 'norm '.chr )
+		en
+	endw
+endf
+" * Toggling {{{1
 fu! s:ToggleFocus()
-	let s:focus = !exists('s:focus') || s:focus ? 0 : 1
-	cal s:MapKeys(s:focus)
-	cal s:BuildPrompt(0, s:focus)
+	let s:focus = !s:focus
+	cal s:BuildPrompt(0)
 endf
 
 fu! s:ToggleRegex()
-	let s:regexp = s:regexp ? 0 : 1
+	let s:regexp = !s:regexp
 	cal s:PrtSwitcher()
 endf
 
 fu! s:ToggleByFname()
 	if s:ispath
-		let s:byfname = s:byfname ? 0 : 1
+		let s:byfname = !s:byfname
 		let s:mfunc = s:mfunc()
-		cal s:MapKeys(s:Focus(), 1)
 		cal s:PrtSwitcher()
 	en
 endf
 	cal s:PrtSwitcher()
 endf
 
+fu! s:ToggleKeyLoop()
+	let s:keyloop = !s:keyloop
+	if s:keyloop
+		let [&ut, s:lazy] = [0, 0]
+		cal s:KeyLoop()
+	elsei has_key(s:glbs, 'ut')
+		let [&ut, s:lazy] = [s:glbs['ut'], 1]
+	en
+endf
+
 fu! s:PrtSwitcher()
 	let [s:force, s:matches] = [1, 1]
-	cal s:BuildPrompt(1, s:Focus())
+	cal s:BuildPrompt(1)
 	unl s:force
 endf
 " - SetWD() {{{1
 fu! s:SetWD(args)
-	let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()]
-	let pmode = has_key(a:args, 'mode') ? a:args['mode'] : s:wpmode
+	if has_key(a:args, 'args') && stridx(a:args['args'], '--dir') >= 0
+		\ && exists('s:dyncwd')
+		cal ctrlp#setdir(s:dyncwd) | retu
+	en
 	if has_key(a:args, 'dir') && a:args['dir'] != ''
 		cal ctrlp#setdir(a:args['dir']) | retu
 	en
+	let pmode = has_key(a:args, 'mode') ? a:args['mode'] : s:pathmode
+	let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()]
 	if s:crfile =~ '^.\+://' | retu | en
-	if pmode =~ 'c' || ( !type(pmode) && pmode )
+	if pmode =~ 'c' || ( pmode =~ 'a' && stridx(s:crfpath, s:cwd) < 0 )
+		\ || ( !type(pmode) && pmode )
 		if exists('+acd') | let [s:glb_acd, &acd] = [&acd, 0] | en
 		cal ctrlp#setdir(s:crfpath)
 	en
 	let [md, filpath] = [a:mode, fnamemodify(a:line, ':p')]
 	cal s:PrtExit()
 	let [bufnr, tail] = [bufnr('^'.filpath.'$'), s:tail()]
-	let j2l = a:0 ? a:1 : str2nr(matchstr(tail, '^ +\D*\zs\d\+\ze\D*'))
-	if s:jmptobuf && bufnr > 0 && md =~ 'e\|t'
+	let j2l = a:0 ? a:1 : matchstr(tail, '^ +\zs\d\+$')
+	if ( s:jmptobuf =~ md || ( s:jmptobuf && md =~ '[et]' ) ) && bufnr > 0
 		\ && !( md == 'e' && bufnr == bufnr('%') )
 		let [jmpb, bufwinnr] = [1, bufwinnr(bufnr)]
-		let buftab = s:jmptobuf > 1 ? s:buftab(bufnr, md) : [0, 0]
+		let buftab = ( s:jmptobuf =~# '[tTVH]' || s:jmptobuf > 1 )
+			\ ? s:buftab(bufnr, md) : [0, 0]
 	en
 	" Switch to existing buffer or open new one
-	if exists('jmpb') && bufwinnr > 0 && md != 't'
+	if exists('jmpb') && bufwinnr > 0
+		\ && !( md == 't' && ( s:jmptobuf !~# toupper(md) || buftab[0] ) )
 		exe bufwinnr.'winc w'
 		if j2l | cal ctrlp#j2l(j2l) | en
 	elsei exists('jmpb') && buftab[0]
+		\ && !( md =~ '[evh]' && s:jmptobuf !~# toupper(md) )
 		exe 'tabn' buftab[0]
 		exe buftab[1].'winc w'
 		if j2l | cal ctrlp#j2l(j2l) | en
 		" Reset &switchbuf option
 		let [swb, &swb] = [&swb, '']
 		" Open new window/buffer
-		let args = [cmd, useb ? bufnr : filpath, a:0 ? ' +'.a:1 : tail, useb, j2l]
+		let [fid, tail] = [( useb ? bufnr : filpath ), ( a:0 ? ' +'.a:1 : tail )]
+		let args = [cmd, fid, tail, 1, [useb, j2l]]
 		cal call('s:openfile', args)
 		let &swb = swb
 	en
 
 fu! s:AcceptSelection(mode)
 	if a:mode != 'e' && s:OpenMulti(a:mode) != -1 | retu | en
-	let str = join(s:prompt, '')
+	let str = s:getinput()
 	if a:mode == 'e' | if s:SpecInputs(str) | retu | en | en
 	" Get the selected line
-	let line = !empty(s:lines) ? s:lines[line('.') - 1] : ''
+	let line = ctrlp#getcline()
 	if a:mode != 'e' && !s:itemtype && line == ''
 		\ && str !~ '\v^(\.\.([\/]\.\.)*[\/]?[.\/]*|/|\\|\?|\@.+)$'
 		cal s:CreateNewFile(a:mode) | retu
 endf
 " - CreateNewFile() {{{1
 fu! s:CreateNewFile(...)
-	let [md, str] = ['', join(s:prompt, '')]
+	let [md, str] = ['', s:getinput('n')]
 	if empty(str) | retu | en
 	if s:argmap && !a:0
 		" Get the extra argument
 		\ s:newfop =~ '2\|h' || ( a:0 && a:1 == 'h' ) || md == 'h' ? 'new' :
 		\ s:newfop =~ '3\|v' || ( a:0 && a:1 == 'v' ) || md == 'v' ? 'vne' :
 		\ ctrlp#normcmd('e')
-	cal s:openfile(cmd, filpath, tail)
+	cal s:openfile(cmd, filpath, tail, 1)
 endf
 " * OpenMulti() {{{1
 fu! s:MarkToOpen()
 		\ || ( s:itemtype > 2 && s:getextvar('opmul') != 1 )
 		retu
 	en
-	let line = !empty(s:lines) ? s:lines[line('.') - 1] : ''
+	let line = ctrlp#getcline()
 	if empty(line) | retu | en
 	let filpath = s:ispath ? fnamemodify(line, ':p') : line
 	if exists('s:marked') && s:dictindex(s:marked, filpath) > 0
 	let md = a:0 ? a:1 : ( md == '' ? 'v' : md )
 	let nopt = exists('g:ctrlp_open_multiple_files')
 	if !has_marked
-		let line = !empty(s:lines) ? s:lines[line('.') - 1] : ''
+		let line = ctrlp#getcline()
 		if line == '' | retu | en
 		let marked = { 1 : fnamemodify(line, ':p') }
 		let [nr, ur, jf, nopt] = ['1', 0, 0, 1]
 			cal s:unmarksigns()
 			unl! s:marked
 			cal s:BuildPrompt(0)
-		elsei !has_marked && md == 'a'
-			let [s:marked, key] = [{}, 1]
-			for line in s:lines
-				let s:marked = extend(s:marked, { key : fnamemodify(line, ':p') })
-				let key += 1
-			endfo
-			cal s:remarksigns()
-			retu s:BuildPrompt(0)
-		elsei !has_marked && md == 'x'
-			retu call(s:openfunc[s:ctype], [md, line])
+		elsei !has_marked && md =~ '[axd]'
+			retu s:OpenNoMarks(md, line)
 		en
 		if md =~ '\v^c(ancel)?$' | retu | en
 		let nr = nr == '0' ? ( nopt ? '' : '1' ) : nr
 	cal s:sanstail(join(s:prompt, ''))
 	cal s:PrtExit()
 	if nr == '0' || md == 'i'
-		retu map(mkd, "s:openfile('bad', fnamemodify(v:val, ':.'), '')")
+		retu map(mkd, "s:openfile('bad', v:val, '', 0)")
 	en
-	let [tail, fnesc] = [s:tail(), exists('*fnameescape') && v:version > 701]
+	let tail = s:tail()
 	let [emptytail, bufnr] = [empty(tail), bufnr('^'.mkd[0].'$')]
 	let useb = bufnr > 0 && buflisted(bufnr) && emptytail
 	" Move to a replaceable window
 		let conds = [( nr != '' && nr > 1 && nr < ic ) || ( nr == '' && ic > 1 ),
 			\ nr != '' && nr < ic]
 		if conds[nopt]
-			if bufnr <= 0 | if fnesc
-				cal s:openfile('bad', fnamemodify(va, ':.'), '')
-			el
-				cal s:openfile(cmd, va, tail) | sil! hid clo!
-			en | en
+			if !buflisted(bufnr) | cal s:openfile('bad', va, '', 0) | en
 		el
-			cal s:openfile(cmd, useb ? bufnr : va, tail) | let ic += 1
-			if jf | if ic == 2
+			cal s:openfile(cmd, useb ? bufnr : va, tail, ic == 1 ? 1 : 0)
+			if jf | if ic == 1
 				let crpos = [tabpagenr(), winnr()]
 			el
 				let crpos[0] += tabpagenr() <= crpos[0]
-				let crpos[1] += winnr() == crpos[1]
+				let crpos[1] += winnr() <= crpos[1]
 			en | en
+			let ic += 1
 		en
 	endfo
 	if jf && exists('crpos') && ic > 2
 	let &swb = swb
 	unl! s:tabct
 endf
+
+fu! s:OpenNoMarks(md, line)
+	if a:md == 'a'
+		let [s:marked, key] = [{}, 1]
+		for line in s:lines
+			let s:marked = extend(s:marked, { key : fnamemodify(line, ':p') })
+			let key += 1
+		endfo
+		cal s:remarksigns()
+		cal s:BuildPrompt(0)
+	elsei a:md == 'x'
+		cal call(s:openfunc[s:ctype], [a:md, a:line])
+	elsei a:md == 'd'
+		let dir = fnamemodify(a:line, ':h')
+		if isdirectory(dir)
+			cal ctrlp#setdir(dir)
+			cal ctrlp#switchtype(0)
+			cal ctrlp#recordhist()
+			cal s:PrtClear()
+		en
+	en
+endf
 " ** Helper functions {{{1
 " Sorting {{{2
 fu! ctrlp#complen(...)
 	let nxt = tps[s:walker(max, s:itemtype,  1)][1]
 	let prv = tps[s:walker(max, s:itemtype, -1)][1]
 	let s:ctype = tps[s:itemtype][0]
-	let focus   = s:Focus() ? 'prt'  : 'win'
+	let focus   = s:focus ? 'prt'  : 'win'
 	let byfname = s:byfname ? 'file' : 'path'
 	let marked  = s:opmul != '0' ?
 		\ exists('s:marked') ? ' <'.s:dismrk().'>' : ' <->' : ''
 		let etype = getftype(each)
 		if s:igntype >= 0 && s:usrign(each, etype) | con | en
 		if etype == 'dir'
-			if s:dotfiles | if each !~ '[\/]\.\{1,2}$'
+			if s:showhidden | if each !~ '[\/]\.\{1,2}$'
 				cal add(items[0], each)
 			en | el
 				cal add(items[0], each)
 	retu [0, 0]
 endf
 
+fu! s:bufwins(bufnr)
+	let winns = 0
+	for tabnr in range(1, tabpagenr('$'))
+		let winns += count(tabpagebuflist(tabnr), a:bufnr)
+	endfo
+	retu winns
+endf
+
 fu! ctrlp#normcmd(cmd, ...)
 	if a:0 < 2 && s:nosplit() | retu a:cmd | en
 	let norwins = filter(range(1, winnr('$')),
 	retu a:0 ? a:1 : 'bo vne'
 endf
 
+fu! ctrlp#modfilecond(w)
+	retu &mod && !&hid && &bh != 'hide' && s:bufwins(bufnr('%')) == 1 && !&cf &&
+		\ ( ( !&awa && a:w ) || filewritable(fnamemodify(bufname('%'), ':p')) != 1 )
+endf
+
 fu! s:nosplit()
 	retu !empty(s:nosplit) && match([bufname('%'), &l:ft, &l:bt], s:nosplit) >= 0
 endf
 	let roh = [
 		\ ['Open Multiple Files', '/h[i]dden/[c]lear', ['i', 'c']],
 		\ ['Create a New File', '/[r]eplace', ['r']],
-		\ ['Open Selected', '/[r]eplace/h[i]dden? Mark [a]ll', ['r', 'i', 'a']],
+		\ ['Open Selected', '/[r]eplace', ['r', 'd', 'a']],
 		\ ]
-	if a:i == 2 && s:openfunc != {} && has_key(s:openfunc, s:ctype)
-		let roh[2][1] = '/[r]eplace/h[i]dden/e[x]ternal? Mark [a]ll'
-		let roh[2][2] = ['r', 'i', 'x', 'a']
+	if a:i == 2
+		if !buflisted(bufnr('^'.fnamemodify(ctrlp#getcline(), ':p').'$'))
+			let roh[2][1] .= '/h[i]dden'
+			let roh[2][2] += ['i']
+		en
+		if s:openfunc != {} && has_key(s:openfunc, s:ctype)
+			let roh[2][1] .= '/e[x]ternal'
+			let roh[2][2] += ['x']
+		en
 	en
 	let str = roh[a:i][0].': [t]ab/[v]ertical/[h]orizontal'.roh[a:i][1].'? '
 	retu s:choices(str, ['t', 'v', 'h'] + roh[a:i][2], 's:argmaps', [a:md, a:i])
 fu! s:narrowable()
 	retu exists('s:act_add') && exists('s:matched') && s:matched != []
 		\ && exists('s:mdata') && s:mdata[:2] == [s:dyncwd, s:itemtype, s:regexp]
-		\ && s:matcher == {}
+		\ && s:matcher == {} && !exists('s:did_exp')
+endf
+
+fu! s:getinput(...)
+	let [prt, spi] = [s:prompt, ( a:0 ? a:1 : '' )]
+	if s:abbrev != {}
+		let gmd = has_key(s:abbrev, 'gmode') ? s:abbrev['gmode'] : ''
+		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' )]
+		for dict in s:abbrev['abbrevs']
+			let dmd = has_key(dict, 'mode') ? dict['mode'] : ''
+			let pat = escape(dict['pattern'], '~')
+			if ( dmd == '' || ( dmd =~ pf && dmd =~ rz && !a:0 )
+				\ || dmd =~ '['.spi.']' ) && str =~ pat
+				let [str, s:did_exp] = [join(split(str, pat, 1), dict['expanded']), 1]
+			en
+		endfo
+		if gmd =~ 't' && !a:0
+			let prt[0] = str
+		el
+			retu str
+		en
+	en
+	retu spi == 'c' ? prt[0] : join(prt, '')
 endf
 
 fu! s:migemo(str)
 endf
 
 fu! ctrlp#j2l(nr)
-	exe a:nr
+	exe 'norm!' a:nr.'G'
 	sil! norm! zvzz
 endf
 
 endf
 
 fu! s:walker(m, p, d)
-	retu a:d > 0 ? a:p < a:m ? a:p + a:d : 0 : a:p > 0 ? a:p + a:d : a:m
+	retu a:d >= 0 ? a:p < a:m ? a:p + a:d : 0 : a:p > 0 ? a:p + a:d : a:m
 endf
 
 fu! s:delent(rfunc)
 	let [s:crword, s:crline] = [expand('<cword>', 1), getline('.')]
 	let [s:winh, s:crcursor] = [min([s:mxheight, &lines]), getpos('.')]
 	let [s:crbufnr, s:crvisual] = [bufnr('%'), s:lastvisual()]
-	let s:wpmode = exists('b:ctrlp_working_path_mode')
-		\ ? b:ctrlp_working_path_mode : s:pathmode
 	let [s:mrbs, s:crgfile] = [ctrlp#mrufiles#bufs(), expand('<cfile>', 1)]
 endf
 
 	en
 endf
 
-fu! s:openfile(cmd, fid, tail, ...)
-	let cmd = a:cmd =~ '^[eb]$' && &modified ? 'hid '.a:cmd : a:cmd
+fu! s:openfile(cmd, fid, tail, chkmod, ...)
+	let cmd = a:cmd
+	if a:chkmod && cmd =~ '^[eb]$' && ctrlp#modfilecond(!( cmd == 'b' && &aw ))
+		let cmd = cmd == 'b' ? 'sb' : 'sp'
+	en
 	let cmd = cmd =~ '^tab' ? ctrlp#tabcount().cmd : cmd
-	let j2l = a:0 && a:1 ? a:2 : 0
-	exe cmd.( a:0 && a:1 ? '' : a:tail ) ctrlp#fnesc(a:fid)
+	let j2l = a:0 && a:1[0] ? a:1[1] : 0
+	exe cmd.( a:0 && a:1[0] ? '' : a:tail ) ctrlp#fnesc(a:fid)
 	if j2l
-		exe j2l
+		cal ctrlp#j2l(j2l)
 	en
-	if !empty(a:tail) || j2l
+	if !empty(a:tail)
 		sil! norm! zvzz
 	en
 	if cmd != 'bad'
 	retu -1
 endf
 
+fu! ctrlp#getcline()
+	retu !empty(s:lines) ? s:lines[line('.') - 1] : ''
+endf
+
 fu! ctrlp#exit()
 	cal s:PrtExit()
 endf
 
 fu! ctrlp#init(type, ...)
 	if exists('s:init') || s:iscmdwin() | retu | en
+	let [s:ermsg, v:errmsg] = [v:errmsg, '']
 	let [s:matches, s:init] = [1, 1]
-	cal ctrlp#reset()
+	cal s:Reset(a:0 ? a:1 : {})
 	noa cal s:Open()
 	cal s:SetWD(a:0 ? a:1 : {})
-	cal s:MapKeys()
+	cal s:MapNorms()
+	cal s:MapSpecs()
 	cal ctrlp#syntax()
 	cal ctrlp#setlines(s:settype(a:type))
 	cal s:SetDefTxt()
 	cal s:BuildPrompt(1)
+	if s:keyloop | cal s:KeyLoop() | en
 endf
 " - Autocmds {{{1
 if has('autocmd')

.vim/autoload/ctrlp/buffertag.vim

 	if exists('+ssl')
 		let [ssl, &ssl] = [&ssl, 0]
 	en
-	let fname = a:0 == 1 ? shellescape(a:1) : ''
+	let fname = a:0 ? shellescape(a:1) : ''
 	let cmd = shellescape(a:bin).' '.a:args.' '.fname
+	if &sh =~ 'cmd\.exe'
+		let cmd = substitute(cmd, '[&()@^<>|]', '^\0', 'g')
+	en
 	if exists('+ssl')
 		let &ssl = ssl
 	en
 endf
 
 fu! s:parseline(line)
-	let eval = '\v^([^\t]+)\t(.+)\t[?/]\^?(.{-1,})\$?[?/]\;\"\t(.+)\tline(no)?\:(\d+)'
-	let vals = matchlist(a:line, eval)
+	let vals = matchlist(a:line,
+		\ '\v^([^\t]+)\t(.+)\t[?/]\^?(.{-1,})\$?[?/]\;\"\t(.+)\tline(no)?\:(\d+)')
 	if vals == [] | retu '' | en
 	let [bufnr, bufname] = [bufnr('^'.vals[2].'$'), fnamemodify(vals[2], ':p:t')]
 	retu vals[1].'	'.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'| '.vals[3]
 		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
 endf
 
 fu! ctrlp#buffertag#accept(mode, str)
-	let vals = matchlist(a:str, '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)\|')
+	let vals = matchlist(a:str,
+		\ '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)\|\s(.+)$')
 	let bufnr = str2nr(get(vals, 1))
 	if bufnr
-		cal ctrlp#acceptfile(a:mode, bufname(bufnr), get(vals, 2))
+		cal ctrlp#acceptfile(a:mode, bufname(bufnr))
+		exe 'norm!' str2nr(get(vals, 2, line('.'))).'G'
+		cal s:chknearby('\V\C'.get(vals, 3, ''))
+		sil! norm! zvzz
 	en
 endf
 

.vim/autoload/ctrlp/quickfix.vim

 endf
 
 fu! ctrlp#quickfix#accept(mode, str)
-	let items = matchlist(a:str, '^\([^|]\+\ze\)|\(\d\+\):\(\d\+\)|')
-	if items == [] | retu | en
-	let [md, filpath] = [a:mode, fnamemodify(items[1], ':p')]
-	if empty(filpath) | retu | en
-	cal ctrlp#exit()
-	let cmd = md == 't' ? 'tabe' : md == 'h' ? 'new' : md == 'v' ? 'vne'
-		\ : ctrlp#normcmd('e')
-	let cmd = cmd == 'e' && &modified ? 'hid e' : cmd
-	exe cmd ctrlp#fnesc(filpath)
-	cal cursor(items[2], items[3])
+	let vals = matchlist(a:str, '^\([^|]\+\ze\)|\(\d\+\):\(\d\+\)|')
+	if vals == [] || vals[1] == '' | retu | en
+	cal ctrlp#acceptfile(a:mode, vals[1])
+	let cur_pos = getpos('.')[1:2]
+	if cur_pos != [1, 1] && cur_pos != map(vals[2:3], 'str2nr(v:val)')
+		mark '
+	en
+	cal cursor(vals[2], vals[3])
 	sil! norm! zvzz
-	cal ctrlp#setlcdir()
 endf
 
 fu! ctrlp#quickfix#id()

.vim/autoload/ctrlp/tag.vim

 		\ 'e': ['', 'tj'],
 		\ }
 	let cmd = fnd[0] == 1 ? cmds[a:mode][0] : cmds[a:mode][1]
-	let cmd = cmd == 'tj' && &mod ? 'hid '.cmd : cmd
+	let cmd = a:mode == 'e' && ctrlp#modfilecond(!&aw)
+		\ ? ( cmd == 'tj' ? 'stj' : 'sp' ) : cmd
 	let cmd = a:mode == 't' ? ctrlp#tabcount().cmd : cmd
 	if fnd[0] == 1
 		if cmd != ''

.vim/autoload/nrrwrgn.vim

 " nrrwrgn.vim - Narrow Region plugin for Vim
 " -------------------------------------------------------------
-" Version:	   0.28
+" Version:	   0.29
 " Maintainer:  Christian Brabandt <cb@256bit.org>
-" Last Change: Sun, 03 Jun 2012 13:47:04 +0200
+" Last Change: Mon, 20 Aug 2012 19:34:23 +0200
 "
 " Script: http://www.vim.org/scripts/script.php?script_id=3075 
 " Copyright:   (c) 2009, 2010 by Christian Brabandt
 "			   instead of "Vim".
 "			   No warranty, express or implied.
 "	 *** ***   Use At-Your-Own-Risk!   *** ***
-" GetLatestVimScripts: 3075 28 :AutoInstall: NrrwRgn.vim
+" GetLatestVimScripts: 3075 29 :AutoInstall: NrrwRgn.vim
 "
 " Functions:
 
 	" Customization
 	let s:nrrw_rgn_vert = (exists("g:nrrw_rgn_vert") ? g:nrrw_rgn_vert : 0)
 	let s:nrrw_rgn_wdth = (exists("g:nrrw_rgn_wdth") ? g:nrrw_rgn_wdth : 20)
-	let s:nrrw_rgn_hl	= (exists("g:nrrw_rgn_hl")	 ? g:nrrw_rgn_hl   : "WildMenu")
+	let s:nrrw_rgn_hl	= (exists("g:nrrw_rgn_hl")	 ? g:nrrw_rgn_hl   :
+							\ "WildMenu")
 	let s:nrrw_rgn_nohl = (exists("g:nrrw_rgn_nohl") ? g:nrrw_rgn_nohl : 0)
 
 	let s:debug         = (exists("s:debug") ? s:debug : 0)
 		exe "aug NrrwRgn" . b:nrrw_instn
 			au!
 			au BufWriteCmd <buffer> nested :call s:WriteNrrwRgn(1)
-			au BufWinLeave,BufWipeout,BufDelete <buffer> nested :call s:WriteNrrwRgn()
+			au BufWinLeave,BufWipeout,BufDelete <buffer> nested
+						\ :call s:WriteNrrwRgn()
 		aug end
 	else
 		exe "aug NrrwRgn" .  a:instn
 		au!
 		aug end
 		exe "aug! NrrwRgn" . a:instn
+		
+		if !has_key(s:nrrw_rgn_lines, a:instn)
+			" narrowed buffer was already cleaned up
+			call s:WarningMsg("Window was already cleaned up. Nothing to do.")
+			return
+		endif
 
 		" make the original buffer modifiable, if possible
 		let buf = s:nrrw_rgn_lines[a:instn].orig_buf
 			" bwipe! throws E855 (catching does not work)
 			" but because of 'bufhidden' wipeing will happen anyways
 			"exe "bwipe! " bufnr(s:nrrw_winname . '_' . a:instn)
-			if winnr('$') > 1
+			if has_key(s:nrrw_rgn_lines[a:instn], 'single') &&
+			\  s:nrrw_rgn_lines[a:instn].single
 				" If there is only a single window open don't clean up now
 				" because we can't put the narrowed lines back, so do not
 				" clean up now. We need to clean up then later. But how?
-				call <sid>CleanUpInstn(a:instn)
+				return
 			endif
+			call <sid>CleanUpInstn(a:instn)
 		endif
 	endif
 endfun
 
 fun! <sid>CleanUpInstn(instn) "{{{1
-	if s:instn>=1
+	if s:instn>=1 && has_key(s:nrrw_rgn_lines, 'a:instn')
 		unlet s:nrrw_rgn_lines[a:instn]
 		let s:instn-=1
 	endif
 fun! <sid>StoreLastNrrwRgn(instn) "{{{1
 	" Only store the last region, when the narrowed instance is still valid
 	if !has_key(s:nrrw_rgn_lines, a:instn)
-		call <sid>WarningMsg("Error storing the last Narrowed Window, it's invalid!")
+		call <sid>WarningMsg("Error storing the last Narrowed Window,".
+					\ "it's invalid!")
 		return
 	endif
 
 	else
 		let block = 1
 	endif
-	" This is just a best guess, the highlighted block could still be wrong (a
-	" rectangle has been selected, but the complete lines are highlighted
+	" This is just a best guess, the highlighted block could still be wrong
+	" (a " rectangle has been selected, but the complete lines are
+	" highlighted
 	if a:mode ==# '' && a:startl[0] > 0 && a:startl[1] > 0 && block
 		return '\%>' . (a:startl[0]-1) . 'l\&\%>' . (a:startl[1]-1) .
 			\ 'v\&\%<' . (a:endl[0]+1) . 'l'
 endfun
 
 fun! <sid>HideNrrwRgnLines() "{{{1
-	 syn region StartNrrwRgnIgnore start="^# Start NrrwRgn\z(\d\+\).*$" fold
-	 syn region EndNrrwRgnIgnore start="^# End NrrwRgn\z1\d\+.*$" end="^$" fold
-	 hi def link StartNrrwRgnIgnore Ignore
-	 hi def link EndNrrwRgnIgnore Ignore
+	let cnc = has("Conceal")
+	let cmd='syn match NrrwRgnStart "^# Start NrrwRgn\d\+$" '.
+				\ (cnc ? 'conceal' : '')
+	exe cmd
+	let cmd='syn match NrrwRgnEnd "^# End NrrwRgn\d\+$" '.
+				\ (cnc ? 'conceal' : '')
+	exe cmd
+	syn region NrrwRgn start="^# Start NrrwRgn\z(\d\+\).*$"
+		\ end="^# End NrrwRgn\z1$" fold transparent
+	if cnc
+		setl conceallevel=3
+	endif
+	setl fdm=syntax
 endfun
 
 fun! <sid>ReturnCommentFT() "{{{1
 
 fun! <sid>NrrwSettings(on) "{{{1
 	if a:on
-		setl noswapfile buftype=acwrite bufhidden=wipe foldcolumn=0 nobuflisted
+		setl noswapfile buftype=acwrite bufhidden=wipe foldcolumn=0
+		setl nobuflisted
 	else
 		setl swapfile buftype= bufhidden= buflisted
 	endif
 	call <sid>SetupBufLocalCommands(0, bang)
 	call <sid>NrrwRgnAuCmd(0)
 	call <sid>CleanRegions()
+	call <sid>HideNrrwRgnLines()
 
 	" restore settings
 	let &lz   = o_lz
 			exe 'f' s:nrrw_winname . '_' . s:instn
 			call <sid>SetOptions(local_options)
 			call <sid>NrrwSettings(1)
+			" succeeded to create a single window
+			let s:nrrw_rgn_lines[s:instn].single = 1
 		catch /^Vim\%((\a\+)\)\=:E37/	" catch error E37
 			" Fall back and use a new window
 			" Set the highlighting
 	call add(s:nrrw_rgn_line, line('.'))
 endfun
 
-fun! nrrwrgn#WidenRegion(vmode,force, close) "{{{1
+fun! nrrwrgn#WidenRegion(vmode, force, close) "{{{1
 	" a:close: original narrowed window is going to be closed
 	" so, clean up, don't renew highlighting, etc.
 	let nrw_buf  = bufnr('')
 		if bufexists(orig_buf)
 			exe orig_buf "b!"
 		else
-			call s:WarningMsg("Original buffer does no longer exist! Aborting!")
+			call s:WarningMsg("Original buffer does no longer exist!".
+						\ " Aborting!")
 			return
 		endif
 	else
 	" Make sure the narrowed buffer is still valid (happens, when 2 split
 	" window of the narrowed buffer is opened.
 	if !has_key(s:nrrw_rgn_lines, instn)
-		call <sid>WarningMsg("Error writing changes back, Narrowed Window invalid!")
+		call <sid>WarningMsg("Error writing changes back,".
+					\ "Narrowed Window invalid!")
 		return
 	endif
 
 	" 2) Visual Selection
 	elseif a:vmode
 		"charwise, linewise or blockwise selection 
-		call setreg('a', join(cont, "\n") . "\n", s:nrrw_rgn_lines[instn].vmode)
+		call setreg('a', join(cont, "\n") . "\n",
+					\ s:nrrw_rgn_lines[instn].vmode)
 		if s:nrrw_rgn_lines[instn].vmode == 'v' &&
 			\ s:nrrw_rgn_lines[instn].end[1] -
 			\ s:nrrw_rgn_lines[instn].start[1] + 1 == len(cont) + 1
 			else
 				keepj norm! $
 			endif
-			" overwrite the visually selected region with the contents from the
-			" narrowed buffer
+			" overwrite the visually selected region with the contents from
+			" the narrowed buffer
 			norm! "aP
 		endif
 		" Recalculate the start and end positions of the narrowed window
 		" make sure the visual selected lines did not add a new linebreak,
 		" this messes up the characterwise selected regions and removes lines
 		" on further writings
-		if s:nrrw_rgn_lines[instn].end[1] - s:nrrw_rgn_lines[instn].start[1] + 1 >
-			\	len(cont) && s:nrrw_rgn_lines[instn].vmode == 'v'
-			let s:nrrw_rgn_lines[instn].end[1] = s:nrrw_rgn_lines[instn].end[1] - 1
+		if s:nrrw_rgn_lines[instn].end[1] - s:nrrw_rgn_lines[instn].start[1]
+				\ + 1 >	len(cont) && s:nrrw_rgn_lines[instn].vmode == 'v'
+			let s:nrrw_rgn_lines[instn].end[1] =
+				\ s:nrrw_rgn_lines[instn].end[1] - 1
 			let s:nrrw_rgn_lines[instn].end[2] = virtcol('$')
 		endif
 
 		" so subsequent calls will adjust the region accordingly
 		" so subsequent calls will adjust the region accordingly
 		let  s:nrrw_rgn_lines[instn].end[1] =
-			\s:nrrw_rgn_lines[instn].start[1] + len(cont) -1
+			\ s:nrrw_rgn_lines[instn].start[1] + len(cont) -1
 		if s:nrrw_rgn_lines[instn].end[1] > line('$')
 			let s:nrrw_rgn_lines[instn].end[1] = line('$')
 		endif
 	if exists("g:nrrw_rgn_protect") && g:nrrw_rgn_protect =~? 'n'
 		call <sid>RecalculateLineNumbers(instn, adjust_line_numbers)
 	endif
-	if a:close
+	if a:close && !has_key(s:nrrw_rgn_lines[instn], 'single')
+		" For narrowed windows that have been created using !,
+		" don't clean up yet, or else we loose all data and can't write
+		" it back later.
+		" (e.g. :NR! createas a new single window, do :sp
+		"  and you can only write one of the windows back, the other will
+		"  become invalid, if CleanUp is executed)
 		call <sid>CleanUpInstn(instn)
 	endif
 	call <sid>SaveRestoreRegister(0)
 	call <sid>DeleteMatches(s:instn)
 	norm! gv"ay
 	if len(split(@a, "\n", 1)) != 
-			\ (s:nrrw_rgn_lines[s:instn].end[1] - s:nrrw_rgn_lines[s:instn].start[1] + 1)
+			\ (s:nrrw_rgn_lines[s:instn].end[1] -
+			\ s:nrrw_rgn_lines[s:instn].start[1] + 1)
 		" remove trailing "\n"
 		let @a=substitute(@a, '\n$', '', '') 
 	endif
 			exe 'f' s:nrrw_winname . '_' . s:instn
 			call <sid>SetOptions(local_options)
 			call <sid>NrrwSettings(1)
+			" succeeded to create a single window
+			let s:nrrw_rgn_lines[s:instn].single = 1
 		catch /^Vim\%((\a\+)\)\=:E37/	" catch error E37
 			" Fall back and use a new window
 			" Set the highlighting
 	let save_winposview=winsaveview()
 	let orig_win = winnr()
 	" close previous opened Narrowed buffers
-	silent! windo | if bufname('')=~'^Narrow_Region' && &diff |diffoff|q!|endif
+	silent! windo | if bufname('')=~'^Narrow_Region' &&
+			\ &diff |diffoff|q!|endif
 	" minimize Window
 	" this is disabled, because this might be useful, to see everything
 	"exe "vert resize -999999"
 			"sil! unlet s:instn
 			com! NI :call <sid>WarningMsg("Instance: ".s:instn)
 			com! NJ :call <sid>WarningMsg("Data: ".string(s:nrrw_rgn_lines))
-			com! -nargs=1 NOutput :if exists("s:".<q-args>)|redraw!|:exe 'echo s:'.<q-args>|else| echo "s:".<q-args>. " does not exist!"|endif
+			com! -nargs=1 NOutput :if exists("s:".<q-args>)|redraw!|
+						\ :exe 'echo s:'.<q-args>|else|
+						\ echo "s:".<q-args>. " does not exist!"|endif
 		endfun
 		call <sid>NrrwRgnDebug()
 	else

.vim/doc/NarrowRegion.txt

 *NrrwRgn.txt*   A Narrow Region Plugin (similar to Emacs)
 
 Author:  Christian Brabandt <cb@256bit.org>
-Version: 0.28 Sun, 03 Jun 2012 13:47:04 +0200
+Version: 0.29 Mon, 20 Aug 2012 19:34:23 +0200
 Copyright: (c) 2009, 2010, 2011, 2012 by Christian Brabandt         
            The VIM LICENSE applies to NrrwRgnPlugin.vim and NrrwRgnPlugin.txt
            (see |copyright|) except use NrrwRgnPlugin instead of "Vim".
 
 
 ==============================================================================
-1. Contents                                     *NarrowRegion*  *NrrwRgnPlugin*
+1. Contents                                    *NarrowRegion*  *NrrwRgnPlugin*
 
         1.  Contents.....................................: |NrrwRgnPlugin|
         2.  NrrwRgn Manual...............................: |NrrwRgn-manual|
 
                                                                     *:NRL*
                 
-:NRL[!]                     Reselect the last selected region again and open in
-                            a narrowed window. 
+:NRL[!]                     Reselect the last selected region again and open
+                            in a narrowed window. 
                             If ! is given, open the narrowed buffer not in a
                             split buffer but in the current window.
 
 4. NrrwRgn History                                          *NrrwRgn-history*
 
 
-0.29: (unreleased) {{{1
+0.29: Aug 20, 2012 {{{1
 - Use ! to have the narrowed buffer not opened in a new window (suggested by
   Greg Sexton thanks!, issue #8
   https://github.com/chrisbra/NrrwRgn/issues/8)

.vim/doc/UltiSnips.txt

 3. Settings & Commands                          |UltiSnips-settings|
    3.1 Commands                                 |UltiSnips-commands|
    3.2 Triggers                                 |UltiSnips-triggers|
+      3.2.1 Using your own trigger functions    |UltiSnips-trigger-functions|
    3.3 Snippet Search Path                      |UltiSnips-snippet-search-path|
    3.4 Warning About Select Mode Mappings       |UltiSnips-warning-smappings|
    3.5 Functions                                |UltiSnips-functions|
       3.5.1 UltiSnips_AddSnippet                |UltiSnips_AddSnippet|
       3.5.2 UltiSnips_Anon                      |UltiSnips_Anon|
-   3.6 Missing python support                   |Ultisnips-python-warning|
+   3.6 Missing python support                   |UltiSnips-python-warning|
 4. Syntax                                       |UltiSnips-syntax|
    4.1 Adding Snippets                          |UltiSnips-adding-snippets|
       4.1.1 Character Escaping                  |UltiSnips-character-escaping|
    let g:UltiSnipsJumpForwardTrigger="<tab>"
    let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
 
+3.2.1 Using your own trigger functions           *UltiSnips-trigger-functions*
+--------------------------------------
+
+For advanced users there are four functions that you can map directly to a 
+key and that correspond to some of the triggers previously defined:
+   g:UltiSnipsExpandTrigger        <--> UltiSnips_ExpandSnippet
+   g:UltiSnipsJumpForwardTrigger   <--> UltiSnips_JumpForwards
+   g:UltiSnipsJumpBackwardTrigger  <--> UltiSnips_JumpBackwards
+
+If you have g:UltiSnipsExpandTrigger and g:UltiSnipsJumpForwardTrigger set
+to the same value then when the function you are actually going to use is
+UltiSnips_ExpandSnippetOrJump.
+
+Each time any of the functions UltiSnips_ExpandSnippet,
+UltiSnips_ExpandSnippet, UltiSnips_JumpBackwards or UltiSnips_JumpBackwards is
+called a global variable is set that contains the corresponding return value
+of the corresponding function.
+
+The corresponding variables and functions are:
+UltiSnips_ExpandSnippet       --> g:ulti_expand_res (0: fail, 1: success)
+UltiSnips_ExpandSnippetOrJump --> g:ulti_expand_or_jump_res (0: fail,
+                                                    1: expand, 2: jump)
+UltiSnips_JumpForwards        --> g:ulti_jump_forwards_res (0: fail, 1: success)
+UltiSnips_JumpBackwards       --> g:ulti_jump_backwards_res (0: fail, 1: success)
+
+To see how these return values may come in handy suppose that you want to map
+a key to expand or jump, but if none of these actions is successful you want
+to call another function. Ultisnips already does this automaticall for supertab, but
+this allows you individual fine tuning of your tab key usage.
+
+Usage is as follows: You define a function >
+
+   let g:ulti_expand_or_jump_res = 0 "default value, just set once
+   function! Ulti_ExpandOrJump_and_getRes()
+     call UltiSnips_ExpandSnippetOrJump()
+     return g:ulti_expand_or_jump_res
+   endfunction
+
+then you define your mapping as >
+
+   inoremap <NL> <C-R>=(Ulti_ExpandOrJump_and_getRes() > 0)?"":IMAP_Jumpfunc('', 0)<CR>
+
+and if the you can't expand or jump from the current location then the
+alternative function IMAP_Jumpfunc('', 0) is called.
 
 3.3 Snippet Search Path                       *UltiSnips-snippet-search-path*
 -----------------------
 typed so it can determine if the trigger matches or not.
 
 
-3.6 Warning about missing python support           *Ultisnips-python-warning*
+3.6 Warning about missing python support           *UltiSnips-python-warning*
 ----------------------------------------
 
 When UltiSnips is loaded, it will check that the running Vim was compiled with
 python support.  If no support is detected, a warning will be displayed and
-loading of Ultisnips will be skipped.
+loading of UltiSnips will be skipped.
 
 If you would like to suppress this warning message, you may add the following
 line to your vimrc file.
 This project aims to be the one-for-all solution for Snippets for Vim. If you
 miss a feature or find a bug, please contact me or file a support ticket.
 
-
 =============================================================================
 7. Contributors                                      *UltiSnips-contributors*
 
    lucapette
    Psycojoker - Laurent Peuch 
    aschrab - Aaron Schrab
-   NagatoPain (stardiviner)
+   stardiviner - NagatoPain
+   skeept - Jorge Rodrigues
 
 
 7.2 Snippets                                       *UltiSnips-contrisnippets*
    Georgi Valkov (gvalkov)
    Miek Gieben (miek)
    Aldis Berjoza (graudeejs)
-   Jorge (skeept)
+   Jorge Rodrigues (skeept)
    Martin Grenfell (scrooloose)
    Laughedelic
    Anthony Wilson (anthonywilson)

.vim/doc/ctrlp.txt

 
 Overview:~
 
-  |loaded_ctrlp|                Disable the plugin.
-  |ctrlp_map|                   Default mapping.
-  |ctrlp_cmd|                   Default command used for the default mapping.
-  |ctrlp_by_filename|           Default to filename mode or not.
-  |ctrlp_regexp|                Default to regexp mode or not.
-  |ctrlp_match_window_bottom|   Where to show the match window.
-  |ctrlp_match_window_reversed| Sort order in the match window.
-  |ctrlp_max_height|            Max height of the match window.
-  |ctrlp_switch_buffer|         Jump to an open buffer if already opened.
-  |ctrlp_reuse_window|          Reuse special windows (help, quickfix, etc).
-  |ctrlp_tabpage_position|      Where to put the new tab page.
-  |ctrlp_working_path_mode|     How to set CtrlP's local working directory.
-  |ctrlp_root_markers|          Additional, high priority root markers.
-  |ctrlp_use_caching|           Use per-session caching or not.
-  |ctrlp_clear_cache_on_exit|   Keep cache after exiting Vim or not.
-  |ctrlp_cache_dir|             Location of the cache directory.
-  |ctrlp_dotfiles|              Ignore dotfiles and dotdirs or not.
-  |ctrlp_custom_ignore|         Hide stuff when using |globpath()|.
-  |ctrlp_max_files|             Number of files to scan initially.
-  |ctrlp_max_depth|             Directory depth to recurse into when scanning.
-  |ctrlp_user_command|          Use an external scanner.
-  |ctrlp_max_history|           Number of entries saved in the prompt history.
-  |ctrlp_open_new_file|         How to open a file created by <c-y>.
-  |ctrlp_open_multiple_files|   How to open files selected by <c-z>.
-  |ctrlp_arg_map|               Intercept <c-y> and <c-o> or not.
-  |ctrlp_follow_symlinks|       Follow symbolic links or not.
-  |ctrlp_lazy_update|           Only update when typing has stopped.
-  |ctrlp_default_input|         Seed the prompt with an initial string.
-  |ctrlp_use_migemo|            Use Migemo patterns for Japanese filenames.
-  |ctrlp_prompt_mappings|       Change the mappings in the prompt.
+  |loaded_ctrlp|................Disable the plugin.
+  |ctrlp_map|...................Default mapping.
+  |ctrlp_cmd|...................Default command used for the default mapping.
+  |ctrlp_by_filename|...........Default to filename mode or not.
+  |ctrlp_regexp|................Default to regexp mode or not.
+  |ctrlp_match_window_bottom|...Where to show the match window.
+  |ctrlp_match_window_reversed|.Sort order in the match window.
+  |ctrlp_max_height|............Max height of the match window.
+  |ctrlp_switch_buffer|.........Jump to an open buffer if already opened.
+  |ctrlp_reuse_window|..........Reuse special windows (help, quickfix, etc).
+  |ctrlp_tabpage_position|......Where to put the new tab page.
+  |ctrlp_working_path_mode|.....How to set CtrlP's local working directory.
+  |ctrlp_root_markers|..........Additional, high priority root markers.
+  |ctrlp_use_caching|...........Use per-session caching or not.
+  |ctrlp_clear_cache_on_exit|...Keep cache after exiting Vim or not.
+  |ctrlp_cache_dir|.............Location of the cache directory.
+  |ctrlp_show_hidden|...........Ignore dotfiles and dotdirs or not.
+  |ctrlp_custom_ignore|.........Hide stuff when using |globpath()|.
+  |ctrlp_max_files|.............Number of files to scan initially.
+  |ctrlp_max_depth|.............Directory depth to recurse into when scanning.
+  |ctrlp_user_command|..........Use an external scanner.
+  |ctrlp_max_history|...........Number of entries saved in the prompt history.
+  |ctrlp_open_new_file|.........How to open a file created by <c-y>.
+  |ctrlp_open_multiple_files|...How to open files selected by <c-z>.
+  |ctrlp_arg_map|...............Intercept <c-y> and <c-o> or not.
+  |ctrlp_follow_symlinks|.......Follow symbolic links or not.
+  |ctrlp_lazy_update|...........Only update when typing has stopped.
+  |ctrlp_default_input|.........Seed the prompt with an initial string.
+  |ctrlp_abbrev|................Input abbreviations.
+  |ctrlp_key_loop|..............Use input looping for multi-byte input.
+  |ctrlp_use_migemo|............Use Migemo patterns for Japanese filenames.
+  |ctrlp_prompt_mappings|.......Change the mappings inside the prompt.
 
   MRU mode:
-  |ctrlp_mruf_max|              Max MRU entries to remember.
-  |ctrlp_mruf_exclude|          Files that shouldn't be remembered.
-  |ctrlp_mruf_include|          Files to be remembered.
-  |ctrlp_mruf_relative|         Show only MRU files in the working directory.
-  |ctrlp_mruf_default_order|    Disable sorting.
-  |ctrlp_mruf_case_sensitive|   MRU files are case sensitive or not.
+  |ctrlp_mruf_max|..............Max MRU entries to remember.
+  |ctrlp_mruf_exclude|..........Files that shouldn't be remembered.
+  |ctrlp_mruf_include|..........Files to be remembered.
+  |ctrlp_mruf_relative|.........Show only MRU files in the working directory.
+  |ctrlp_mruf_default_order|....Disable sorting.
+  |ctrlp_mruf_case_sensitive|...MRU files are case sensitive or not.
 
   Advanced options:
-  |ctrlp_open_func|             Use custom file opening functions.
-  |ctrlp_status_func|           Change CtrlP's two statuslines.
-  |ctrlp_buffer_func|           Call custom functions in the CtrlP buffer.
-  |ctrlp_match_func|            Replace the built-in matching algorithm.
+  |ctrlp_open_func|.............Use custom file opening functions.
+  |ctrlp_status_func|...........Change CtrlP's two statuslines.
+  |ctrlp_buffer_func|...........Call custom functions in the CtrlP buffer.
+  |ctrlp_match_func|............Replace the built-in matching algorithm.
 
 -------------------------------------------------------------------------------
 Detailed descriptions and default values:~
 <
 
                                                       *'g:ctrlp_switch_buffer'*
-When opening a file with <cr> or <c-t>, if the file's already opened somewhere
-CtrlP will try to jump to it instead of opening a new instance: >
-  let g:ctrlp_switch_buffer = 2
+When opening a file, if it's already open in a window somewhere, CtrlP will try
+to jump to it instead of opening a new instance: >
+  let g:ctrlp_switch_buffer = 'Et'
 <
-  1 - only jump to the buffer if it's opened in the current tab.
-  2 - jump tab as well if the buffer's opened in another tab.
-  0 - disable this feature.
+  e - jump when <cr> is pressed, but only to windows in the current tab.
+  t - jump when <c-t> is pressed, but only to windows in another tab.
+  v - like "e", but jump when <c-v> is pressed.
+  h - like "e", but jump when <c-x> is pressed.
+  E, T, V, H - like "e", "t", "v", and "h", but jump to windows anywhere.
+  0 or <empty> - disable this feature.
 
                                                        *'g:ctrlp_reuse_window'*
 When opening a file with <cr>, CtrlP avoids opening it in windows created by
                                                   *'g:ctrlp_working_path_mode'*
 When starting up, CtrlP sets its local working directory according to this
 variable: >
-  let g:ctrlp_working_path_mode = 'rc'
+  let g:ctrlp_working_path_mode = 'ra'
 <
   c - the directory of the current file.
+  a - like "c", but only applies when the current working directory outside of
+      CtrlP isn't a direct ancestor of the directory of the current file.
   r - the nearest ancestor that contains one of these directories or files:
       .git .hg .svn .bzr _darcs
-  0 or [empty-string] - don't manage working directory.
+  w - begin finding a root from the current working directory outside of CtrlP
+      instead of from the directory of the current file (default). Only applies
+      when "r" is also present.
+  0 or <empty> - disable this feature.
 
-Note #1: you can use b:ctrlp_working_path_mode (a |b:var|) to set this option
-on a per buffer basis.
+Note #1: if "a" or "c" is included with "r", use the behavior of "a" or "c" (as
+a fallback) when a root can't be found.
 
-Note #2: with both 'r' and 'c' in the option, when a root isn't found, use the
-directory of the current file.
+Note #2: you can use a |b:var| to set this option on a per buffer basis.
 
                                                        *'g:ctrlp_root_markers'*
 Use this to set your own root markers in addition to the default ones (.git,
 .hg, .svn, .bzr, and _darcs). Your markers will take precedence: >
   let g:ctrlp_root_markers = ['']
 <
+Note: you can use a |b:var| to set this option on a per buffer basis.
 
                                                         *'g:ctrlp_use_caching'*
 Enable/Disable per-session caching: >
   1 - Enable caching.
   n - When bigger than 1, disable caching and use the number as the limit to
       enable caching again.
+
 Note: you can quickly purge the cache by pressing <F5> while inside CtrlP.
 
                                                 *'g:ctrlp_clear_cache_on_exit'*
   let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp'
 <
 
-                                                           *'g:ctrlp_dotfiles'*
-Set this to 0 if you don't want CtrlP to scan for dotfiles and dotdirs: >
-  let g:ctrlp_dotfiles = 1
+                                                        *'g:ctrlp_show_hidden'*
+Set this to 1 if you want CtrlP to scan for dotfiles and dotdirs: >
+  let g:ctrlp_show_hidden = 0
 <
+Note: does not apply when a command defined with |g:ctrlp_user_command| is
+being used.
 
                                                            *'ctrlp-wildignore'*
 You can use Vim's |'wildignore'| to exclude files and directories from the
   let g:ctrlp_custom_ignore = ''
 <
 Examples: >
-  let g:ctrlp_custom_ignore = '\v[\/](\.git|\.hg|\.svn)$'
+  let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
   let g:ctrlp_custom_ignore = {
-    \ 'dir':  '\v[\/](\.git|\.hg|\.svn)$',
-    \ 'file': '\.exe$\|\.so$\|\.dll$',
+    \ 'dir':  '\v[\/]\.(git|hg|svn)$',
+    \ 'file': '\v\.(exe|so|dll)$',
     \ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
     \ }
   let g:ctrlp_custom_ignore = {
 The maximum number of files to scan, set to 0 for no limit: >
   let g:ctrlp_max_files = 10000
 <
+Note: does not apply when a command defined with |g:ctrlp_user_command| is
+being used.
 
                                                           *'g:ctrlp_max_depth'*
 The maximum depth of a directory tree to recurse into: >
   let g:ctrlp_max_depth = 40
 <
-Note: the larger these values, the more memory Vim uses.
+Note: does not apply when a command defined with |g:ctrlp_user_command| is
+being used.
 
                                                        *'g:ctrlp_user_command'*
 Specify an external tool to use for listing files instead of using Vim's
 <
 You can also use 'grep', 'findstr' or something else to filter the results.
 Examples: >
-  let g:ctrlp_user_command = 'find %s -type f | grep (?!tmp/.*)'
-  let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d | findstr .*\.py$'
+  let g:ctrlp_user_command =
+    \ 'find %s -type f | grep -v -P "\.jpg$|/tmp/"'          " MacOSX/Linux
+  let g:ctrlp_user_command =
+    \ 'dir %s /-n /b /s /a-d | findstr /v /l ".jpg \\tmp\\"' " Windows
 <
 Use a version control listing command when inside a repository, this is faster
 when scanning large projects: >
     \ 'ignore': 0 or 1
     \ }
 <
-Examples: >
+Some examples: >
+  " Single VCS, listing command does not list untracked files:
   let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files']
   let g:ctrlp_user_command = ['.hg', 'hg --cwd %s locate -I .']
+
+  " Multiple VCS's:
   let g:ctrlp_user_command = {
     \ 'types': {
       \ 1: ['.git', 'cd %s && git ls-files'],
       \ 2: ['.hg', 'hg --cwd %s locate -I .'],
       \ },
-    \ 'fallback': 'find %s -type f',
-    \ 'ignore': 0
+    \ 'fallback': 'find %s -type f'
     \ }
+
+  " Single VCS, listing command lists untracked files (slower):
+  let g:ctrlp_user_command =
+    \ ['.git', 'cd %s && git ls-files . -co --exclude-standard']
+
+  let g:ctrlp_user_command =
+    \ ['.hg', 'hg --cwd %s status -numac -I . $(hg root)'] " MacOSX/Linux
+
+  let g:ctrlp_user_command = ['.hg', 'for /f "tokens=1" %%a in (''hg root'') '
+    \ . 'do hg --cwd %s status -numac -I . %%a']           " Windows
 <
-Note #1: if the fallback_command is empty or not defined, |globpath()| will
-then be used when searching outside a repo.
+Note #1: if the fallback_command is empty or the 'fallback' key is not defined,
+|globpath()| will then be used when scanning outside of a repository.
 
 Note #2: unless the |Dictionary| format is used and 'ignore' is defined and set
 to 1, the |wildignore| and |g:ctrlp_custom_ignore| options do not apply when
-these custom commands are being used. When not defined, 'ignore' is set to 0 by
+these custom commands are being used. When not present, 'ignore' is set to 0 by
 default to retain the performance advantage of using external commands.
 
 Note #3: when changing the option's variable type, remember to |:unlet| it
 first or restart Vim to avoid the "E706: Variable type mismatch" error.
 
+Note #4: you can use a |b:var| to set this option on a per buffer basis.
+
                                                         *'g:ctrlp_max_history'*
 The maximum number of input strings you want CtrlP to remember. The default
 value mirrors Vim's global |'history'| option: >
 
                                                       *'g:ctrlp_open_new_file'*
 Use this option to specify how the newly created file is to be opened when
-pressing <c-y>:
-  t - in a new tab
-  h - in a new horizontal split
-  v - in a new vertical split
-  r - in the current window
->
+pressing <c-y>: >
   let g:ctrlp_open_new_file = 'v'
 <
+  t - in a new tab.
+  h - in a new horizontal split.
+  v - in a new vertical split.
+  r - in the current window.
 
                                                 *'g:ctrlp_open_multiple_files'*
 If non-zero, this will enable opening multiple files with <c-z> and <c-o>: >
   i - all files as hidden buffers.
   j - after opening, jump to the first opened tab or window.
   r - open the first file in the current window, then the remaining files in
-      new splits or new tabs depending on which of h, v and t is also present.
+      new splits or new tabs depending on which of "h", "v" and "t" is also
+      present.
 
                                                             *'g:ctrlp_arg_map'*
 When this is set to 1, the <c-o> and <c-y> mappings will accept one extra key
   1 - follow but ignore looped internal symlinks to avoid duplicates.
   2 - follow all symlinks indiscriminately.
 
+Note: does not apply when a command defined with |g:ctrlp_user_command| is
+being used.
+
                                                         *'g:ctrlp_lazy_update'*
 Set this to 1 to enable the lazy-update feature: only update the match window
 after typing's been stopped for a certain amount of time: >
   let g:ctrlp_default_input = 'anystring'
 <
 
+                                                             *'g:ctrlp_abbrev'*
+Define input abbreviations that can be expanded (either internally or visibly)
+in the prompt: >
+  let g:ctrlp_abbrev = {}
+<
+Examples: >
+  let g:ctrlp_abbrev = {
+    \ 'gmode': 'i',
+    \ 'abbrevs': [
+      \ {
+        \ 'pattern': '^cd b',
+        \ 'expanded': '@cd ~/.vim/bundle',
+        \ 'mode': 'pfrz',
+      \ },
+      \ {
+        \ 'pattern': '\(^@.\+\|\\\@<!:.\+\)\@<! ',
+        \ 'expanded': '.\{-}',
+        \ 'mode': 'pfr',
+      \ },
+      \ {
+        \ 'pattern': '\\\@<!:.\+\zs\\\@<! ',
+        \ 'expanded': '\ ',
+        \ 'mode': 'pfz',
+      \ },
+      \ ]
+    \ }
+<
+The 'pattern' string is regexp matched against the entered input. The expansion
+is as if the 'expanded' string was typed into the prompt.
+
+For 'gmode' (optional):
+  i - expand internally (default).
+  t - insert the expanded results into the prompt as you type.
+  k - insert the expanded results when a non-keyword character is typed. Only
+      applies when "t" is also present.
+
+For 'mode' (of each entry; optional):
+  f - only in filename mode.
+  p - only in full path mode.
+  r - only in regexp mode.
+  z - only in fuzzy mode.
+  n - only when creating a new file with <c-y> (use the expanded string in the
+      new filename).
+  c - only when auto-completing directory names with <tab> (expand the pattern
+      immediately before doing the auto-completion).
+  <empty> or not defined - always enable.
+
+Note: the abbrev entries are evaluated in sequence, so a later entry can be
+evaluated against the expanded result of a previous entry; this includes itself
+when 'gmode' is "t".
+
+                                                           *'g:ctrlp_key_loop'*
+An experimental feature. Set this to 1 to enable input looping for the typing
+of multi-byte characters: >
+  let g:ctrlp_key_loop = 0
+<
+Note #1: when set, this option resets the |g:ctrlp_lazy_update| option.
+
+Note #2: you can toggle this feature inside the prompt with a custom mapping: >
+  let g:ctrlp_prompt_mappings = { 'ToggleKeyLoop()': ['<F3>'] }
+<
+
                                                          *'g:ctrlp_use_migemo'*
 Set this to 1 to use Migemo Pattern for Japanese filenames. Migemo Search only
 works in regexp mode. To split the pattern, separate words with space: >
    Open CtrlP in find Most-Recently-Used file mode.
 
                                                                *:CtrlPLastMode*
-:CtrlPLastMode
-   Open CtrlP in the last mode used.
+:CtrlPLastMode [--dir]
+   Open CtrlP in the last mode used. When having the "--dir" argument, also
+   reuse the last working directory.
 
                                                                    *:CtrlPRoot*
 :CtrlPRoot
-    This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 'rc' and ignores
+    This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 'r' and ignores
     the variable's current value.
 
                                                              *:CtrlPClearCache*
     - Mark/unmark a file to create a new file in its directory using <c-y>.
 
   <c-o>
-    Open files marked by <c-z>.
+    - Open files marked by <c-z>.
+    - When no file has been marked by <c-z>, open a console dialog with the
+      following options:
+
+      Open the selected file:
+        t - in a tab page.
+        v - in a vertical split.
+        h - in a horizontal split.
+        r - in the current window.
+        i - as a hidden buffer.
+        x - (optional) with the function defined in |g:ctrlp_open_func|.
+
+      Other options (not shown):
+        a - mark all files in the match window.
+        d - change CtrlP's local working directory to the selected file's
+            directory and switch to find file mode.
 
 Function keys:~
 
                                                                     *:CtrlPTag*
   * Tag mode:~
     - Name: 'tag'
-    - Command: ':CtrlPTag'
+    - Command: ":CtrlPTag"
     - Search for a tag within a generated central tags file, and jump to the
       definition. Use the Vim's option |'tags'| to specify the names and the
       locations of the tags file(s).
                                                               *:CtrlPBufTagAll*
   * Buffer Tag mode:~
     - Name: 'buffertag'
-    - Commands: ':CtrlPBufTag [buffer]',
-                ':CtrlPBufTagAll'.
+    - Commands: ":CtrlPBufTag [buffer]",
+                ":CtrlPBufTagAll".
     - Search for a tag within the current buffer or all listed buffers and jump
       to the definition. Requires |exuberant_ctags| or compatible programs.
 
                                                                *:CtrlPQuickfix*
   * Quickfix mode:~
     - Name: 'quickfix'
-    - Command: ':CtrlPQuickfix'
+    - Command: ":CtrlPQuickfix"
     - Search for an entry in the current quickfix errors and jump to it.
 
                                                                     *:CtrlPDir*
   * Directory mode:~
     - Name: 'dir'
-    - Command: ':CtrlPDir [starting-directory]'
+    - Command: ":CtrlPDir [starting-directory]"
     - Search for a directory and change the working directory to it.
     - Mappings:
       + <cr> change the local working directory for CtrlP and keep it open.
                                                                     *:CtrlPRTS*
   * Runtime script mode:~
     - Name: 'rtscript'
-    - Command: ':CtrlPRTS'
+    - Command: ":CtrlPRTS"
     - Search for files (vimscripts, docs, snippets...) in runtimepath.
 
                                                                    *:CtrlPUndo*
   * Undo mode:~
     - Name: 'undo'
-    - Command: ':CtrlPUndo'
+    - Command: ":CtrlPUndo"
     - Browse undo history.
 
                                                                    *:CtrlPLine*
   * Line mode:~
     - Name: 'line'
-    - Command: ':CtrlPLine'
+    - Command: ":CtrlPLine"
     - Search for a line in all listed buffers.
 
                                                                  *:CtrlPChange*
                                                               *:CtrlPChangeAll*
   * Change list mode:~
     - Name: 'changes'
-    - Commands: ':CtrlPChange [buffer]',
-                ':CtrlPChangeAll'.
+    - Commands: ":CtrlPChange [buffer]",
+                ":CtrlPChangeAll".
     - Search for and jump to a recent change in the current buffer or in all
       listed buffers.
 
                                                                   *:CtrlPMixed*
   * Mixed mode:~
     - Name: 'mixed'
-    - Command: ':CtrlPMixed'
+    - Command: ":CtrlPMixed"
     - Search in files, buffers and MRU files at the same time.
 
                                                             *:CtrlPBookmarkDir*
                                                          *:CtrlPBookmarkDirAdd*
   * BookmarkDir mode:~
     - Name: 'bookmarkdir'
-    - Commands: ':CtrlPBookmarkDir',
-                ':CtrlPBookmarkDirAdd [directory]'.
+    - Commands: ":CtrlPBookmarkDir",
+                ":CtrlPBookmarkDirAdd [directory]".
     - Search for a bookmarked directory and change the working directory to it.
     - Mappings:
       + <cr> change the local working directory for CtrlP, keep it open and
 ===============================================================================
 CHANGELOG                                                     *ctrlp-changelog*
 
+    + New options: |g:ctrlp_abbrev|,
+                   |g:ctrlp_key_loop|,
+                   |g:ctrlp_open_func|,
+                   |g:ctrlp_tabpage_position|
+    + Rename:
+        *g:ctrlp_dotfiles* -> |g:ctrlp_show_hidden|.
+    + Change |g:ctrlp_switch_buffer|'s and |g:ctrlp_working_path_mode|'s type
+      (old values still work).
     + New key for |g:ctrlp_user_command| when it's a Dictionary: 'ignore'.
-    + New options: |g:ctrlp_open_func|.
-                   |g:ctrlp_tabpage_position|.
 
 Before 2012/06/15~
 

.vim/plugin/NrrwRgn.vim

 " NrrwRgn.vim - Narrow Region plugin for Vim
 " -------------------------------------------------------------
-" Version:	   0.28
+" Version:	   0.29
 " Maintainer:  Christian Brabandt <cb@256bit.org>
-" Last Change: Sun, 03 Jun 2012 13:47:04 +0200
+" Last Change: Mon, 20 Aug 2012 19:34:23 +0200
 "
 " Script: http://www.vim.org/scripts/script.php?script_id=3075
 " Copyright:   (c) 2009, 2010 by Christian Brabandt
 "			   instead of "Vim".
 "			   No warranty, express or implied.
 "	 *** ***   Use At-Your-Own-Risk!   *** ***
-" GetLatestVimScripts: 3075 28 :AutoInstall: NrrwRgn.vim
+" GetLatestVimScripts: 3075 29 :AutoInstall: NrrwRgn.vim
 "
 " Init: {{{1
 let s:cpo= &cpo

.vim/plugin/UltiSnips/__init__.py

 
     @err_to_scratch_buffer
     def jump_forwards(self):
+        _vim.command("let g:ulti_jump_forwards_res = 1")
         if not self._jump():
+            _vim.command("let g:ulti_jump_forwards_res = 0")
             return self._handle_failure(self.forward_trigger)
 
     @err_to_scratch_buffer
     def jump_backwards(self):
+        _vim.command("let g:ulti_jump_backwards_res = 1")
         if not self._jump(True):
+            _vim.command("let g:ulti_jump_backwards_res = 0")
             return self._handle_failure(self.backward_trigger)
 
     @err_to_scratch_buffer
     def expand(self):
+        _vim.command("let g:ulti_expand_res = 1")
         if not self._try_expand():
+            _vim.command("let g:ulti_expand_res = 0")
             self._handle_failure(self.expand_trigger)
 
     @err_to_scratch_buffer
         expansion and forward jumping. It first tries to expand a snippet, if
         this fails, it tries to jump forward.
         """
+        _vim.command('let g:ulti_expand_or_jump_res = 1')
         rv = self._try_expand()
         if not rv:
+            _vim.command('let g:ulti_expand_or_jump_res = 2')
             rv = self._jump()
         if not rv:
+            _vim.command('let g:ulti_expand_or_jump_res = 0')
             self._handle_failure(self.expand_trigger)
 
     @err_to_scratch_buffer
Add a comment to this file

.vim/plugin/UltiSnips/__init__.pyc

Binary file modified.

.vim/plugin/ctrlp.vim

 com! -n=? -com=dir CtrlPMRUFiles cal ctrlp#init(2, { 'dir': <q-args> })
 
 com! -bar CtrlPBuffer   cal ctrlp#init(1)
-com! -bar CtrlPLastMode cal ctrlp#init(-1)
+com! -n=? CtrlPLastMode cal ctrlp#init(-1, { 'args': <q-args> })
 
 com! -bar CtrlPClearCache     cal ctrlp#clr()
 com! -bar CtrlPClearAllCaches cal ctrlp#clra()
-com! -bar CtrlPReload         cal ctrlp#reset()
 
 com! -bar ClearCtrlPCache     cal ctrlp#clr()
 com! -bar ClearAllCtrlPCaches cal ctrlp#clra()
-com! -bar ResetCtrlP          cal ctrlp#reset()
 
 com! -bar CtrlPCurWD   cal ctrlp#init(0, { 'mode': '' })
 com! -bar CtrlPCurFile cal ctrlp#init(0, { 'mode': 'c' })
-com! -bar CtrlPRoot    cal ctrlp#init(0, { 'mode': 'rc' })
+com! -bar CtrlPRoot    cal ctrlp#init(0, { 'mode': 'r' })
 
 if g:ctrlp_map != '' && !hasmapto(':<c-u>'.g:ctrlp_cmd.'<cr>', 'n')
 	exe 'nn <silent>' g:ctrlp_map ':<c-u>'.g:ctrlp_cmd.'<cr>'
 
 com! -n=? -com=dir CtrlPBookmarkDirAdd
 	\ cal ctrlp#call('ctrlp#bookmarkdir#add', <q-args>)
+
+" vim:ts=2:sw=2:sts=2

.vim/utils/convert_snipmate_snippets.py

+#!/usr/bin/env python
+# encoding: utf-8
+"""
+Convert snipmate compatible snippets to UltiSnips compatible snippets
+by Phillip Berndt
+"""
+import sys
+import re
+import os
+import argparse
+
+def convert_snippet_contents(content):
+    " If the snippet contains snipmate style substitutions, convert them to ultisnips style "
+    content = re.sub("`([^`]+`)", "`!v \g<1>", content)
+    return content
+
+def convert_snippet_file(source):
+    " One file per filetype "
+    retval = ""
+    state = 0
+    for line in open(source).readlines():
+        # Ignore empty lines
+        if line.strip() == "":
+            continue
+        # The rest of the handlig is stateful
+        if state == 0:
+            # Find snippet start
+            if line[:8] == "snippet ":
+                snippet_info = re.match("(\S+)\s*(.*)", line[8:])
+                if not snippet_info:
+                    print >> sys.stderr, "Warning: Malformed snippet\n %s\n" % line
+                    continue
+                retval += 'snippet %s "%s"' % (snippet_info.group(1), snippet_info.group(2) if snippet_info.group(2) else snippet_info.group(1)) + "\n"
+                state = 1
+                snippet = ""
+        elif state == 1:
+            # First line of snippet: Get indentation
+            whitespace = re.search("^\s+", line)
+            if not whitespace:
+                print >> sys.stderr, "Warning: Malformed snippet, content not indented.\n"
+                retval += "endsnippet\n\n"
+                state = 0
+            else:
+                whitespace = whitespace.group(0)
+                snippet += line[len(whitespace):]
+                state = 2
+        elif state == 2:
+            # In snippet: Check if indentation level is the same. If not, snippet has ended
+            if line[:len(whitespace)] != whitespace:
+                retval += convert_snippet_contents(snippet) + "endsnippet\n\n"
+                # Copy-paste the section from state=0 so that we don't skip every other snippet
+                if line[:8] == "snippet ":
+                    snippet_info = re.match("(\S+)\s*(.*)", line[8:])
+                    if not snippet_info:
+                        print >> sys.stderr, "Warning: Malformed snippet\n %s\n" % line
+                        continue
+                    retval += 'snippet %s "%s"' % (snippet_info.group(1), snippet_info.group(2) if snippet_info.group(2) else snippet_info.group(1)) + "\n"
+                    state = 1
+                    snippet = ""
+            else:
+                snippet += line[len(whitespace):]
+    if state == 2:
+        retval += convert_snippet_contents(snippet) + "endsnippet\n\n"
+    return retval
+
+def convert_snippet(source):
+    " One file per snippet "
+    name = os.path.basename(source)[:-8]
+    return 'snippet %s "%s"' % (name, name) + "\n" + \
+        convert_snippet_contents(open(source).read()) + \
+        "\nendsnippet\n"
+
+def convert_snippets(source):
+    if os.path.isdir(source):
+        return "\n".join((convert_snippet(os.path.join(source, x)) for x in os.listdir(source) if x[-8:] == ".snippet"))
+    else:
+        return convert_snippet_file(source)
+
+if __name__ == '__main__':
+    # Parse command line
+    argsp = argparse.ArgumentParser(description="Convert snipmate compatible snippets to UltiSnips' file format",
+        epilog="example:\n  %s drupal/ drupal.snippets\n   will convert all drupal specific snippets from snipmate into one file drupal.snippets" % sys.argv[0],
+        formatter_class=argparse.RawDescriptionHelpFormatter)
+    argsp.add_argument("source", help="Source directory for one filetype or a snippets file")
+    argsp.add_argument("target", help="File to write the resulting snippets into. If omitted, the snippets will be written to stdout.", nargs="?", default="-")
+    args = argsp.parse_args()
+
+    source = args.source
+    try:
+        target = sys.stdout if args.target == "-" else open(args.target, "w")
+    except IOError:
+        print >> sys.stderr, "Error: Failed to open output file %s for writing" % args.target
+        sys.exit(1)
+
+    snippets = convert_snippets(source)
+    print >> target, snippets

.vim/utils/get_tm_snippets.py

+#!/usr/bin/env python
+# encoding: utf-8
+
+import urllib