16d004f71445

Update ALL the bundles!
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Tue, 27 Mar 2012 11:38:35 -0400
parents f8d38666b868
children 2b78b064b415
branches/tags (none)
files .hgsubstate vim/.vimrc vim/bundle/snipmate/README.markdown vim/bundle/snipmate/after/plugin/snipMate.vim vim/bundle/snipmate/autoload/snipMate.vim vim/bundle/snipmate/doc/snipMate.txt vim/bundle/snipmate/ftplugin/html_snip_helper.vim vim/bundle/snipmate/plugin-info.txt vim/bundle/snipmate/plugin/snipMate.vim vim/bundle/snipmate/syntax/snippet.vim vim/bundle/yankring/doc/yankring.txt vim/bundle/yankring/plugin/yankring.vim

Changes

--- a/.hgsubstate	Mon Mar 26 10:21:27 2012 -0400
+++ b/.hgsubstate	Tue Mar 27 11:38:35 2012 -0400
@@ -1,31 +1,31 @@
 c711681883f3419b85494e3b285b988e8e2dcbca keymando/Plugins/abbrev
 4d95cb18a3b420154ef978c53de1d2e692f8343d mercurial/templates
 d2bb7878622e4c16203acf1c92a0f4bc7ac58003 vim/bundle/AnsiEsc.vim
-a41d5d52c39a31128e969e69acf800b198cb07f9 vim/bundle/ack
+9895285042a2fd5691b2f6582aa979e4d1bdffea vim/bundle/ack
 7d5b26907ce4e4d6de7ddf033fee82930733718c vim/bundle/badwolf
-93cb20dbfbab723e1557801469ae70f4f46499da vim/bundle/ctrlp
+c4fe3045653877518ddbe776a9cb7cbd4fdd0bc8 vim/bundle/ctrlp
 667a668e114e9ec0e5d4cbcb0962d835b23614c4 vim/bundle/easymotion
-22c8ffa2ba3ce30364fef382a7c505826a5c5761 vim/bundle/fugitive
+24e9b492fed51b1390b0f7984a047cdef776db7d vim/bundle/fugitive
 8078f3e3ed0f8a954d83ab35f238881e9fce479a vim/bundle/gundo
-4ef2d418f48d30fed2f7ce00f598d6871a0010fe vim/bundle/html5
+9b71f09cb0665560ef23b0c5a7d158b572fb8118 vim/bundle/html5
 78fffa609b3e6b84ef01ee4c9aba6d7435d7b18e vim/bundle/indent-object
-75ab8c11b56aae8e35f211d96fb008efb1ab946a vim/bundle/linediff
-34e28b3f6f6d702ff2963b8196eccae9344ed4bc vim/bundle/markdown
-2dd198c6c412b4ddd361b43586b01981e8383239 vim/bundle/nerdtree
+9543eec44e5cb75b67f0e5eaf1377ca82ced7b90 vim/bundle/linediff
+fdc0f091c78cd9a474ac3e3cf40ba7d6933ef9da vim/bundle/markdown
+678bb2816874d92bca4eea46e0f5f40a15ddab68 vim/bundle/nerdtree
 b7889db57c90824ff5092da4fdde9e05689f24fa vim/bundle/nosecompiler
-d6da78f985e99d8388cd55db2587b19abc0628c2 vim/bundle/powerline
-d27022dc0bf2302cf31015d1ca0a2f80d55f3596 vim/bundle/python-mode
-fa3563dda862c1dc46ddac32d8a9f939e9077379 vim/bundle/rainbow-parentheses
+99277d9eed97a59cacc1db8c1dece2bcfd96d877 vim/bundle/powerline
+1d60548ce9543c462a1fc36830c5e7ec33a57b78 vim/bundle/python-mode
+45e270d2001d07165d24cf8e6936fdcba5724cfb vim/bundle/rainbow-parentheses
 86228e5aaf622c6386ab4e98c3bca144ca333ba1 vim/bundle/slimv
 c6197a10ace82e0fe0c08e5cf5c017b7069a978e vim/bundle/sparkup
 6eec2c131213850ed65fd6da494dfd1a0d620a4e vim/bundle/strftimedammit
-b8a34a485dfdda1f88a2290c8e4b611556cc2fc4 vim/bundle/supertab
-4eb2cdfccc016889acfa3b5d63e8f390a87863cf vim/bundle/surround
-2616623bb9208c4bf2559b6aa5c1eff53644a0f7 vim/bundle/syntastic
+5a38ce8b600e11941f695523363fe04e6478549a vim/bundle/supertab
+489a1e8c676ad47dd358dbf883bfaf492148d38b vim/bundle/surround
+b4e85a87629c3db9900fed82f507c43d634fe7c0 vim/bundle/syntastic
 bbc5193de145ba5334cf02693d959f475a3e850b vim/bundle/threesome
 8b551fcb75170ffb5554a3b8bb456b4d8bae1020 vim/bundle/tslime
-62b72580aba57cb5185bd077ac7a905c1c6893ea vim/bundle/vim-commentary
-6362ba99c825afc046818807267d5c1143b5c887 vim/bundle/vim-javascript
+50b055633580c65c381ebb310bc1786ff14e3340 vim/bundle/vim-commentary
+a8ce721701fdd015695406f7df315f48bb447ebb vim/bundle/vim-javascript
 f21fbd8759d7fa6c3cb1bbb9fe05eae90422f01a vim/bundle/vim-makegreen
-80cc08f3fb2205630a1f1cee159d8ff6052d91d0 vim/bundle/vim-orgmode
-280ca1b471bd3a0d2347735e8fcbd03a53f2c6ad vim/bundle/yankring
+1c039193c59357dd09ddda28aefc6809bd0f90dc vim/bundle/vim-orgmode
+e42cac0d8d84be5602109f4e614caa0854470fc1 vim/bundle/yankring
--- a/vim/.vimrc	Mon Mar 26 10:21:27 2012 -0400
+++ b/vim/.vimrc	Tue Mar 27 11:38:35 2012 -0400
@@ -1077,6 +1077,7 @@
 let g:pymode_breakpoint = 0
 let g:pymode_utils_whitespaces = 0
 let g:pymode_virtualenv = 0
+let g:pymode_folding = 0
 
 let g:pymode_options_indent = 0
 let g:pymode_options_fold = 0
--- a/vim/bundle/snipmate/README.markdown	Mon Mar 26 10:21:27 2012 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-Quickly install with:
-
-    git clone git://github.com/msanders/snipmate.vim.git
-	cd snipmate.vim
-	cp -R * ~/.vim
--- a/vim/bundle/snipmate/after/plugin/snipMate.vim	Mon Mar 26 10:21:27 2012 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-" These are the mappings for snipMate.vim. Putting it here ensures that it
-" will be mapped after other plugins such as supertab.vim.
-if !exists('loaded_snips') || exists('s:did_snips_mappings')
-	finish
-endif
-let s:did_snips_mappings = 1
-
-" This is put here in the 'after' directory in order for snipMate to override
-" other plugin mappings (e.g., supertab).
-"
-" You can safely adjust these mappings to your preferences (as explained in
-" :help snipMate-remap).
-ino <silent> <tab> <c-r>=TriggerSnippet()<cr>
-snor <silent> <tab> <esc>i<right><c-r>=TriggerSnippet()<cr>
-ino <silent> <s-tab> <c-r>=BackwardsSnippet()<cr>
-snor <silent> <s-tab> <esc>i<right><c-r>=BackwardsSnippet()<cr>
-ino <silent> <c-r><tab> <c-r>=ShowAvailableSnips()<cr>
-
-" The default mappings for these are annoying & sometimes break snipMate.
-" You can change them back if you want, I've put them here for convenience.
-snor <bs> b<bs>
-snor <right> <esc>a
-snor <left> <esc>bi
-snor ' b<bs>'
-snor ` b<bs>`
-snor % b<bs>%
-snor U b<bs>U
-snor ^ b<bs>^
-snor \ b<bs>\
-snor <c-x> b<bs><c-x>
-
-" By default load snippets in snippets_dir
-if empty(snippets_dir)
-	finish
-endif
-
-call GetSnippets(snippets_dir, '_') " Get global snippets
-
-au FileType * if &ft != 'help' | call GetSnippets(snippets_dir, &ft) | endif
-" vim:noet:sw=4:ts=4:ft=vim
--- a/vim/bundle/snipmate/autoload/snipMate.vim	Mon Mar 26 10:21:27 2012 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,435 +0,0 @@
-fun! Filename(...)
-	let filename = expand('%:t:r')
-	if filename == '' | return a:0 == 2 ? a:2 : '' | endif
-	return !a:0 || a:1 == '' ? filename : substitute(a:1, '$1', filename, 'g')
-endf
-
-fun s:RemoveSnippet()
-	unl! g:snipPos s:curPos s:snipLen s:endCol s:endLine s:prevLen
-	     \ s:lastBuf s:oldWord
-	if exists('s:update')
-		unl s:startCol s:origWordLen s:update
-		if exists('s:oldVars') | unl s:oldVars s:oldEndCol | endif
-	endif
-	aug! snipMateAutocmds
-endf
-
-fun snipMate#expandSnip(snip, col)
-	let lnum = line('.') | let col = a:col
-
-	let snippet = s:ProcessSnippet(a:snip)
-	" Avoid error if eval evaluates to nothing
-	if snippet == '' | return '' | endif
-
-	" Expand snippet onto current position with the tab stops removed
-	let snipLines = split(substitute(snippet, '$\d\+\|${\d\+.\{-}}', '', 'g'), "\n", 1)
-
-	let line = getline(lnum)
-	let afterCursor = strpart(line, col - 1)
-	" Keep text after the cursor
-	if afterCursor != "\t" && afterCursor != ' '
-		let line = strpart(line, 0, col - 1)
-		let snipLines[-1] .= afterCursor
-	else
-		let afterCursor = ''
-		" For some reason the cursor needs to move one right after this
-		if line != '' && col == 1 && &ve != 'all' && &ve != 'onemore'
-			let col += 1
-		endif
-	endif
-
-	call setline(lnum, line.snipLines[0])
-
-	" Autoindent snippet according to previous indentation
-	let indent = matchend(line, '^.\{-}\ze\(\S\|$\)') + 1
-	call append(lnum, map(snipLines[1:], "'".strpart(line, 0, indent - 1)."'.v:val"))
-
-	" Open any folds snippet expands into
-	if &fen | sil! exe lnum.','.(lnum + len(snipLines) - 1).'foldopen' | endif
-
-	let [g:snipPos, s:snipLen] = s:BuildTabStops(snippet, lnum, col - indent, indent)
-
-	if s:snipLen
-		aug snipMateAutocmds
-			au CursorMovedI * call s:UpdateChangedSnip(0)
-			au InsertEnter * call s:UpdateChangedSnip(1)
-		aug END
-		let s:lastBuf = bufnr(0) " Only expand snippet while in current buffer
-		let s:curPos = 0
-		let s:endCol = g:snipPos[s:curPos][1]
-		let s:endLine = g:snipPos[s:curPos][0]
-
-		call cursor(g:snipPos[s:curPos][0], g:snipPos[s:curPos][1])
-		let s:prevLen = [line('$'), col('$')]
-		if g:snipPos[s:curPos][2] != -1 | return s:SelectWord() | endif
-	else
-		unl g:snipPos s:snipLen
-		" Place cursor at end of snippet if no tab stop is given
-		let newlines = len(snipLines) - 1
-		call cursor(lnum + newlines, indent + len(snipLines[-1]) - len(afterCursor)
-					\ + (newlines ? 0: col - 1))
-	endif
-	return ''
-endf
-
-" Prepare snippet to be processed by s:BuildTabStops
-fun s:ProcessSnippet(snip)
-	let snippet = a:snip
-	" Evaluate eval (`...`) expressions.
-	" Backquotes prefixed with a backslash "\" are ignored.
-	" Using a loop here instead of a regex fixes a bug with nested "\=".
-	if stridx(snippet, '`') != -1
-		while match(snippet, '\(^\|[^\\]\)`.\{-}[^\\]`') != -1
-			let snippet = substitute(snippet, '\(^\|[^\\]\)\zs`.\{-}[^\\]`\ze',
-		                \ substitute(eval(matchstr(snippet, '\(^\|[^\\]\)`\zs.\{-}[^\\]\ze`')),
-		                \ "\n\\%$", '', ''), '')
-		endw
-		let snippet = substitute(snippet, "\r", "\n", 'g')
-		let snippet = substitute(snippet, '\\`', '`', 'g')
-	endif
-
-	" Place all text after a colon in a tab stop after the tab stop
-	" (e.g. "${#:foo}" becomes "${:foo}foo").
-	" This helps tell the position of the tab stops later.
-	let snippet = substitute(snippet, '${\d\+:\(.\{-}\)}', '&\1', 'g')
-
-	" Update the a:snip so that all the $# become the text after
-	" the colon in their associated ${#}.
-	" (e.g. "${1:foo}" turns all "$1"'s into "foo")
-	let i = 1
-	while stridx(snippet, '${'.i) != -1
-		let s = matchstr(snippet, '${'.i.':\zs.\{-}\ze}')
-		if s != ''
-			let snippet = substitute(snippet, '$'.i, s.'&', 'g')
-		endif
-		let i += 1
-	endw
-
-	if &et " Expand tabs to spaces if 'expandtab' is set.
-		return substitute(snippet, '\t', repeat(' ', &sts ? &sts : &sw), 'g')
-	endif
-	return snippet
-endf
-
-" Counts occurences of haystack in needle
-fun s:Count(haystack, needle)
-	let counter = 0
-	let index = stridx(a:haystack, a:needle)
-	while index != -1
-		let index = stridx(a:haystack, a:needle, index+1)
-		let counter += 1
-	endw
-	return counter
-endf
-
-" Builds a list of a list of each tab stop in the snippet containing:
-" 1.) The tab stop's line number.
-" 2.) The tab stop's column number
-"     (by getting the length of the string between the last "\n" and the
-"     tab stop).
-" 3.) The length of the text after the colon for the current tab stop
-"     (e.g. "${1:foo}" would return 3). If there is no text, -1 is returned.
-" 4.) If the "${#:}" construct is given, another list containing all
-"     the matches of "$#", to be replaced with the placeholder. This list is
-"     composed the same way as the parent; the first item is the line number,
-"     and the second is the column.
-fun s:BuildTabStops(snip, lnum, col, indent)
-	let snipPos = []
-	let i = 1
-	let withoutVars = substitute(a:snip, '$\d\+', '', 'g')
-	while stridx(a:snip, '${'.i) != -1
-		let beforeTabStop = matchstr(withoutVars, '^.*\ze${'.i.'\D')
-		let withoutOthers = substitute(withoutVars, '${\('.i.'\D\)\@!\d\+.\{-}}', '', 'g')
-
-		let j = i - 1
-		call add(snipPos, [0, 0, -1])
-		let snipPos[j][0] = a:lnum + s:Count(beforeTabStop, "\n")
-		let snipPos[j][1] = a:indent + len(matchstr(withoutOthers, '.*\(\n\|^\)\zs.*\ze${'.i.'\D'))
-		if snipPos[j][0] == a:lnum | let snipPos[j][1] += a:col | endif
-
-		" Get all $# matches in another list, if ${#:name} is given
-		if stridx(withoutVars, '${'.i.':') != -1
-			let snipPos[j][2] = len(matchstr(withoutVars, '${'.i.':\zs.\{-}\ze}'))
-			let dots = repeat('.', snipPos[j][2])
-			call add(snipPos[j], [])
-			let withoutOthers = substitute(a:snip, '${\d\+.\{-}}\|$'.i.'\@!\d\+', '', 'g')
-			while match(withoutOthers, '$'.i.'\(\D\|$\)') != -1
-				let beforeMark = matchstr(withoutOthers, '^.\{-}\ze'.dots.'$'.i.'\(\D\|$\)')
-				call add(snipPos[j][3], [0, 0])
-				let snipPos[j][3][-1][0] = a:lnum + s:Count(beforeMark, "\n")
-				let snipPos[j][3][-1][1] = a:indent + (snipPos[j][3][-1][0] > a:lnum
-				                           \ ? len(matchstr(beforeMark, '.*\n\zs.*'))
-				                           \ : a:col + len(beforeMark))
-				let withoutOthers = substitute(withoutOthers, '$'.i.'\ze\(\D\|$\)', '', '')
-			endw
-		endif
-		let i += 1
-	endw
-	return [snipPos, i - 1]
-endf
-
-fun snipMate#jumpTabStop(backwards)
-	let leftPlaceholder = exists('s:origWordLen')
-	                      \ && s:origWordLen != g:snipPos[s:curPos][2]
-	if leftPlaceholder && exists('s:oldEndCol')
-		let startPlaceholder = s:oldEndCol + 1
-	endif
-
-	if exists('s:update')
-		call s:UpdatePlaceholderTabStops()
-	else
-		call s:UpdateTabStops()
-	endif
-
-	" Don't reselect placeholder if it has been modified
-	if leftPlaceholder && g:snipPos[s:curPos][2] != -1
-		if exists('startPlaceholder')
-			let g:snipPos[s:curPos][1] = startPlaceholder
-		else
-			let g:snipPos[s:curPos][1] = col('.')
-			let g:snipPos[s:curPos][2] = 0
-		endif
-	endif
-
-	let s:curPos += a:backwards ? -1 : 1
-	" Loop over the snippet when going backwards from the beginning
-	if s:curPos < 0 | let s:curPos = s:snipLen - 1 | endif
-
-	if s:curPos == s:snipLen
-		let sMode = s:endCol == g:snipPos[s:curPos-1][1]+g:snipPos[s:curPos-1][2]
-		call s:RemoveSnippet()
-		return sMode ? "\<tab>" : TriggerSnippet()
-	endif
-
-	call cursor(g:snipPos[s:curPos][0], g:snipPos[s:curPos][1])
-
-	let s:endLine = g:snipPos[s:curPos][0]
-	let s:endCol = g:snipPos[s:curPos][1]
-	let s:prevLen = [line('$'), col('$')]
-
-	return g:snipPos[s:curPos][2] == -1 ? '' : s:SelectWord()
-endf
-
-fun s:UpdatePlaceholderTabStops()
-	let changeLen = s:origWordLen - g:snipPos[s:curPos][2]
-	unl s:startCol s:origWordLen s:update
-	if !exists('s:oldVars') | return | endif
-	" Update tab stops in snippet if text has been added via "$#"
-	" (e.g., in "${1:foo}bar$1${2}").
-	if changeLen != 0
-		let curLine = line('.')
-
-		for pos in g:snipPos
-			if pos == g:snipPos[s:curPos] | continue | endif
-			let changed = pos[0] == curLine && pos[1] > s:oldEndCol
-			let changedVars = 0
-			let endPlaceholder = pos[2] - 1 + pos[1]
-			" Subtract changeLen from each tab stop that was after any of
-			" the current tab stop's placeholders.
-			for [lnum, col] in s:oldVars
-				if lnum > pos[0] | break | endif
-				if pos[0] == lnum
-					if pos[1] > col || (pos[2] == -1 && pos[1] == col)
-						let changed += 1
-					elseif col < endPlaceholder
-						let changedVars += 1
-					endif
-				endif
-			endfor
-			let pos[1] -= changeLen * changed
-			let pos[2] -= changeLen * changedVars " Parse variables within placeholders
-                                                  " e.g., "${1:foo} ${2:$1bar}"
-
-			if pos[2] == -1 | continue | endif
-			" Do the same to any placeholders in the other tab stops.
-			for nPos in pos[3]
-				let changed = nPos[0] == curLine && nPos[1] > s:oldEndCol
-				for [lnum, col] in s:oldVars
-					if lnum > nPos[0] | break | endif
-					if nPos[0] == lnum && nPos[1] > col
-						let changed += 1
-					endif
-				endfor
-				let nPos[1] -= changeLen * changed
-			endfor
-		endfor
-	endif
-	unl s:endCol s:oldVars s:oldEndCol
-endf
-
-fun s:UpdateTabStops()
-	let changeLine = s:endLine - g:snipPos[s:curPos][0]
-	let changeCol = s:endCol - g:snipPos[s:curPos][1]
-	if exists('s:origWordLen')
-		let changeCol -= s:origWordLen
-		unl s:origWordLen
-	endif
-	let lnum = g:snipPos[s:curPos][0]
-	let col = g:snipPos[s:curPos][1]
-	" Update the line number of all proceeding tab stops if <cr> has
-	" been inserted.
-	if changeLine != 0
-		let changeLine -= 1
-		for pos in g:snipPos
-			if pos[0] >= lnum
-				if pos[0] == lnum | let pos[1] += changeCol | endif
-				let pos[0] += changeLine
-			endif
-			if pos[2] == -1 | continue | endif
-			for nPos in pos[3]
-				if nPos[0] >= lnum
-					if nPos[0] == lnum | let nPos[1] += changeCol | endif
-					let nPos[0] += changeLine
-				endif
-			endfor
-		endfor
-	elseif changeCol != 0
-		" Update the column of all proceeding tab stops if text has
-		" been inserted/deleted in the current line.
-		for pos in g:snipPos
-			if pos[1] >= col && pos[0] == lnum
-				let pos[1] += changeCol
-			endif
-			if pos[2] == -1 | continue | endif
-			for nPos in pos[3]
-				if nPos[0] > lnum | break | endif
-				if nPos[0] == lnum && nPos[1] >= col
-					let nPos[1] += changeCol
-				endif
-			endfor
-		endfor
-	endif
-endf
-
-fun s:SelectWord()
-	let s:origWordLen = g:snipPos[s:curPos][2]
-	let s:oldWord = strpart(getline('.'), g:snipPos[s:curPos][1] - 1,
-				\ s:origWordLen)
-	let s:prevLen[1] -= s:origWordLen
-	if !empty(g:snipPos[s:curPos][3])
-		let s:update = 1
-		let s:endCol = -1
-		let s:startCol = g:snipPos[s:curPos][1] - 1
-	endif
-	if !s:origWordLen | return '' | endif
-	let l = col('.') != 1 ? 'l' : ''
-	if &sel == 'exclusive'
-		return "\<esc>".l.'v'.s:origWordLen."l\<c-g>"
-	endif
-	return s:origWordLen == 1 ? "\<esc>".l.'gh'
-							\ : "\<esc>".l.'v'.(s:origWordLen - 1)."l\<c-g>"
-endf
-
-" This updates the snippet as you type when text needs to be inserted
-" into multiple places (e.g. in "${1:default text}foo$1bar$1",
-" "default text" would be highlighted, and if the user types something,
-" UpdateChangedSnip() would be called so that the text after "foo" & "bar"
-" are updated accordingly)
-"
-" It also automatically quits the snippet if the cursor is moved out of it
-" while in insert mode.
-fun s:UpdateChangedSnip(entering)
-	if exists('g:snipPos') && bufnr(0) != s:lastBuf
-		call s:RemoveSnippet()
-	elseif exists('s:update') " If modifying a placeholder
-		if !exists('s:oldVars') && s:curPos + 1 < s:snipLen
-			" Save the old snippet & word length before it's updated
-			" s:startCol must be saved too, in case text is added
-			" before the snippet (e.g. in "foo$1${2}bar${1:foo}").
-			let s:oldEndCol = s:startCol
-			let s:oldVars = deepcopy(g:snipPos[s:curPos][3])
-		endif
-		let col = col('.') - 1
-
-		if s:endCol != -1
-			let changeLen = col('$') - s:prevLen[1]
-			let s:endCol += changeLen
-		else " When being updated the first time, after leaving select mode
-			if a:entering | return | endif
-			let s:endCol = col - 1
-		endif
-
-		" If the cursor moves outside the snippet, quit it
-		if line('.') != g:snipPos[s:curPos][0] || col < s:startCol ||
-					\ col - 1 > s:endCol
-			unl! s:startCol s:origWordLen s:oldVars s:update
-			return s:RemoveSnippet()
-		endif
-
-		call s:UpdateVars()
-		let s:prevLen[1] = col('$')
-	elseif exists('g:snipPos')
-		if !a:entering && g:snipPos[s:curPos][2] != -1
-			let g:snipPos[s:curPos][2] = -2
-		endif
-
-		let col = col('.')
-		let lnum = line('.')
-		let changeLine = line('$') - s:prevLen[0]
-
-		if lnum == s:endLine
-			let s:endCol += col('$') - s:prevLen[1]
-			let s:prevLen = [line('$'), col('$')]
-		endif
-		if changeLine != 0
-			let s:endLine += changeLine
-			let s:endCol = col
-		endif
-
-		" Delete snippet if cursor moves out of it in insert mode
-		if (lnum == s:endLine && (col > s:endCol || col < g:snipPos[s:curPos][1]))
-			\ || lnum > s:endLine || lnum < g:snipPos[s:curPos][0]
-			call s:RemoveSnippet()
-		endif
-	endif
-endf
-
-" This updates the variables in a snippet when a placeholder has been edited.
-" (e.g., each "$1" in "${1:foo} $1bar $1bar")
-fun s:UpdateVars()
-	let newWordLen = s:endCol - s:startCol + 1
-	let newWord = strpart(getline('.'), s:startCol, newWordLen)
-	if newWord == s:oldWord || empty(g:snipPos[s:curPos][3])
-		return
-	endif
-
-	let changeLen = g:snipPos[s:curPos][2] - newWordLen
-	let curLine = line('.')
-	let startCol = col('.')
-	let oldStartSnip = s:startCol
-	let updateTabStops = changeLen != 0
-	let i = 0
-
-	for [lnum, col] in g:snipPos[s:curPos][3]
-		if updateTabStops
-			let start = s:startCol
-			if lnum == curLine && col <= start
-				let s:startCol -= changeLen
-				let s:endCol -= changeLen
-			endif
-			for nPos in g:snipPos[s:curPos][3][(i):]
-				" This list is in ascending order, so quit if we've gone too far.
-				if nPos[0] > lnum | break | endif
-				if nPos[0] == lnum && nPos[1] > col
-					let nPos[1] -= changeLen
-				endif
-			endfor
-			if lnum == curLine && col > start
-				let col -= changeLen
-				let g:snipPos[s:curPos][3][i][1] = col
-			endif
-			let i += 1
-		endif
-
-		" "Very nomagic" is used here to allow special characters.
-		call setline(lnum, substitute(getline(lnum), '\%'.col.'c\V'.
-						\ escape(s:oldWord, '\'), escape(newWord, '\&'), ''))
-	endfor
-	if oldStartSnip != s:startCol
-		call cursor(0, startCol + s:startCol - oldStartSnip)
-	endif
-
-	let s:oldWord = newWord
-	let g:snipPos[s:curPos][2] = newWordLen
-endf
-" vim:noet:sw=4:ts=4:ft=vim
--- a/vim/bundle/snipmate/doc/snipMate.txt	Mon Mar 26 10:21:27 2012 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,322 +0,0 @@
-*snipMate.txt*  Plugin for using TextMate-style snippets in Vim.
-
-snipMate                                       *snippet* *snippets* *snipMate*
-Last Change: December 27, 2009
-
-|snipMate-description|   Description
-|snipMate-syntax|        Snippet syntax
-|snipMate-usage|         Usage
-|snipMate-settings|      Settings
-|snipMate-features|      Features
-|snipMate-disadvantages| Disadvantages to TextMate
-|snipMate-contact|       Contact
-|snipMate-license|       License
-
-For Vim version 7.0 or later.
-This plugin only works if 'compatible' is not set.
-{Vi does not have any of these features.}
-
-==============================================================================
-DESCRIPTION                                             *snipMate-description*
-
-snipMate.vim implements some of TextMate's snippets features in Vim. A
-snippet is a piece of often-typed text that you can insert into your
-document using a trigger word followed by a <tab>.
-
-For instance, in a C file using the default installation of snipMate.vim, if
-you type "for<tab>" in insert mode, it will expand a typical for loop in C: >
-
- for (i = 0; i < count; i++) {
-
- }
-
-
-To go to the next item in the loop, simply <tab> over to it; if there is
-repeated code, such as the "i" variable in this example, you can simply
-start typing once it's highlighted and all the matches specified in the
-snippet will be updated. To go in reverse, use <shift-tab>.
-
-==============================================================================
-SYNTAX                                                        *snippet-syntax*
-
-Snippets can be defined in two ways. They can be in their own file, named
-after their trigger in 'snippets/<filetype>/<trigger>.snippet', or they can be
-defined together in a 'snippets/<filetype>.snippets' file. Note that dotted
-'filetype' syntax is supported -- e.g., you can use >
-
-	:set ft=html.eruby
-
-to activate snippets for both HTML and eRuby for the current file.
-
-The syntax for snippets in *.snippets files is the following: >
-
- snippet trigger
- 	expanded text
-	more expanded text
-
-Note that the first hard tab after the snippet trigger is required, and not
-expanded in the actual snippet. The syntax for *.snippet files is the same,
-only without the trigger declaration and starting indentation.
-
-Also note that snippets must be defined using hard tabs. They can be expanded
-to spaces later if desired (see |snipMate-indenting|).
-
-"#" is used as a line-comment character in *.snippets files; however, they can
-only be used outside of a snippet declaration. E.g.: >
-
- # this is a correct comment
- snippet trigger
- 	expanded text
- snippet another_trigger
- 	# this isn't a comment!
-	expanded text
-<
-This should hopefully be obvious with the included syntax highlighting.
-
-                                                               *snipMate-${#}*
-Tab stops ~
-
-By default, the cursor is placed at the end of a snippet. To specify where the
-cursor is to be placed next, use "${#}", where the # is the number of the tab
-stop. E.g., to place the cursor first on the id of a <div> tag, and then allow
-the user to press <tab> to go to the middle of it:
- >
- snippet div
- 	<div id="${1}">
-		${2}
-	</div>
-<
-                        *snipMate-placeholders* *snipMate-${#:}* *snipMate-$#*
-Placeholders ~
-
-Placeholder text can be supplied using "${#:text}", where # is the number of
-the tab stop. This text then can be copied throughout the snippet using "$#",
-given # is the same number as used before. So, to make a C for loop: >
-
- snippet for
- 	for (${2:i}; $2 < ${1:count}; $1++) {
-		${4}
-	}
-
-This will cause "count" to first be selected and change if the user starts
-typing. When <tab> is pressed, the "i" in ${2}'s position will be selected;
-all $2 variables will default to "i" and automatically be updated if the user
-starts typing.
-NOTE: "$#" syntax is used only for variables, not for tab stops as in TextMate.
-
-Variables within variables are also possible. For instance: >
-
- snippet opt
- 	<option value="${1:option}">${2:$1}</option>
-
-Will, as usual, cause "option" to first be selected and update all the $1
-variables if the user starts typing. Since one of these variables is inside of
-${2}, this text will then be used as a placeholder for the next tab stop,
-allowing the user to change it if he wishes.
-
-To copy a value throughout a snippet without supplying default text, simply
-use the "${#:}" construct without the text; e.g.: >
-
- snippet foo
- 	${1:}bar$1
-<                                                          *snipMate-commands*
-Interpolated Vim Script ~
-
-Snippets can also contain Vim script commands that are executed (via |eval()|)
-when the snippet is inserted. Commands are given inside backticks (`...`); for
-TextMates's functionality, use the |system()| function. E.g.: >
-
- snippet date
- 	`system("date +%Y-%m-%d")`
-
-will insert the current date, assuming you are on a Unix system. Note that you
-can also (and should) use |strftime()| for this example.
-
-Filename([{expr}] [, {defaultText}])             *snipMate-filename* *Filename()*
-
-Since the current filename is used often in snippets, a default function
-has been defined for it in snipMate.vim, appropriately called Filename().
-
-With no arguments, the default filename without an extension is returned;
-the first argument specifies what to place before or after the filename,
-and the second argument supplies the default text to be used if the file
-has not been named. "$1" in the first argument is replaced with the filename;
-if you only want the filename to be returned, the first argument can be left
-blank. Examples: >
-
- snippet filename
- 	`Filename()`
- snippet filename_with_default
- 	`Filename('', 'name')`
- snippet filename_foo
- 	`filename('$1_foo')`
-
-The first example returns the filename if it the file has been named, and an
-empty string if it hasn't. The second returns the filename if it's been named,
-and "name" if it hasn't. The third returns the filename followed by "_foo" if
-it has been named, and an empty string if it hasn't.
-
-                                                                   *multi_snip*
-To specify that a snippet can have multiple matches in a *.snippets file, use
-this syntax: >
-
- snippet trigger A description of snippet #1
- 	expand this text
- snippet trigger A description of snippet #2
- 	expand THIS text!
-
-In this example, when "trigger<tab>" is typed, a numbered menu containing all
-of the descriptions of the "trigger" will be shown; when the user presses the
-corresponding number, that snippet will then be expanded.
-
-To create a snippet with multiple matches using *.snippet files,
-simply place all the snippets in a subdirectory with the trigger name:
-'snippets/<filetype>/<trigger>/<name>.snippet'.
-
-==============================================================================
-USAGE                                                         *snipMate-usage*
-
-                                                 *'snippets'* *g:snippets_dir*
-Snippets are by default looked for any 'snippets' directory in your
-'runtimepath'. Typically, it is located at '~/.vim/snippets/' on *nix or
-'$HOME\vimfiles\snippets\' on Windows. To change that location or add another
-one, change the g:snippets_dir variable in your |.vimrc| to your preferred
-directory, or use the |ExtractSnips()|function. This will be used by the
-|globpath()| function, and so accepts the same syntax as it (e.g.,
-comma-separated paths).
-
-ExtractSnipsFile({directory}, {filetype})     *ExtractSnipsFile()* *.snippets*
-
-ExtractSnipsFile() extracts the specified *.snippets file for the given
-filetype. A .snippets file contains multiple snippet declarations for the
-filetype. It is further explained above, in |snippet-syntax|.
-
-ExtractSnips({directory}, {filetype})             *ExtractSnips()* *.snippet*
-
-ExtractSnips() extracts *.snippet files from the specified directory and
-defines them as snippets for the given filetype. The directory tree should
-look like this: 'snippets/<filetype>/<trigger>.snippet'. If the snippet has
-multiple matches, it should look like this:
-'snippets/<filetype>/<trigger>/<name>.snippet' (see |multi_snip|).
-
-ResetAllSnippets()                                       *ResetAllSnippets()*
-ResetAllSnippets() removes all snippets from memory. This is useful to put at
-the top of a snippet setup file for if you would like to |:source| it multiple
-times.
-
-ResetSnippets({filetype})                                   *ResetSnippets()*
-ResetSnippets() removes all snippets from memory for the given filetype.
-
-ReloadAllSnippets()                                     *ReloadAllSnippets()*
-ReloadAllSnippets() reloads all snippets for all filetypes. This is useful for
-testing and debugging.
-
-ReloadSnippets({filetype})                                 *ReloadSnippets()*
-ReloadSnippets() reloads all snippets for the given filetype.
-
-                                             *list-snippets* *i_CTRL-R_<Tab>*
-If you would like to see what snippets are available, simply type <c-r><tab>
-in the current buffer to show a list via |popupmenu-completion|.
-
-==============================================================================
-SETTINGS                                  *snipMate-settings* *g:snips_author*
-
-The g:snips_author string (similar to $TM_FULLNAME in TextMate) should be set
-to your name; it can then be used in snippets to automatically add it. E.g.: >
-
- let g:snips_author = 'Hubert Farnsworth'
- snippet name
- 	`g:snips_author`
-<
-                                     *snipMate-expandtab* *snipMate-indenting*
-If you would like your snippets to be expanded using spaces instead of tabs,
-just enable 'expandtab' and set 'softtabstop' to your preferred amount of
-spaces. If 'softtabstop' is not set, 'shiftwidth' is used instead.
-
-                                                              *snipMate-remap*
-snipMate does not come with a setting to customize the trigger key, but you
-can remap it easily in the two lines it's defined in the 'after' directory
-under 'plugin/snipMate.vim'. For instance, to change the trigger key
-to CTRL-J, just change this: >
-
- ino <tab> <c-r>=TriggerSnippet()<cr>
- snor <tab> <esc>i<right><c-r>=TriggerSnippet()<cr>
-
-to this: >
- ino <c-j> <c-r>=TriggerSnippet()<cr>
- snor <c-j> <esc>i<right><c-r>=TriggerSnippet()<cr>
-
-==============================================================================
-FEATURES                                                   *snipMate-features*
-
-snipMate.vim has the following features among others:
-  - The syntax of snippets is very similar to TextMate's, allowing
-    easy conversion.
-  - The position of the snippet is kept transparently (i.e. it does not use
-    markers/placeholders written to the buffer), which allows you to escape
-    out of an incomplete snippet, something particularly useful in Vim.
-  - Variables in snippets are updated as-you-type.
-  - Snippets can have multiple matches.
-  - Snippets can be out of order. For instance, in a do...while loop, the
-    condition can be added before the code.
-  - [New] File-based snippets are supported.
-  - [New] Triggers after non-word delimiters are expanded, e.g. "foo"
-    in "bar.foo".
-  - [New] <shift-tab> can now be used to jump tab stops in reverse order.
-
-==============================================================================
-DISADVANTAGES                                         *snipMate-disadvantages*
-
-snipMate.vim currently has the following disadvantages to TextMate's snippets:
-    - There is no $0; the order of tab stops must be explicitly stated.
-    - Placeholders within placeholders are not possible. E.g.: >
-
-      '<div${1: id="${2:some_id}}">${3}</div>'
-<
-      In TextMate this would first highlight ' id="some_id"', and if
-      you hit delete it would automatically skip ${2} and go to ${3}
-      on the next <tab>, but if you didn't delete it it would highlight
-      "some_id" first. You cannot do this in snipMate.vim.
-    - Regex cannot be performed on variables, such as "${1/.*/\U&}"
-    - Placeholders cannot span multiple lines.
-    - Activating snippets in different scopes of the same file is
-      not possible.
-
-Perhaps some of these features will be added in a later release.
-
-==============================================================================
-CONTACT                                   *snipMate-contact* *snipMate-author*
-
-To contact the author (Michael Sanders), please email:
- msanders42+snipmate <at> gmail <dot> com
-
-I greatly appreciate any suggestions or improvements offered for the script.
-
-==============================================================================
-LICENSE                                                     *snipMate-license*
-
-snipMate is released under the MIT license:
-
-Copyright 2009-2010 Michael Sanders. All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-The software is provided "as is", without warranty of any kind, express or
-implied, including but not limited to the warranties of merchantability,
-fitness for a particular purpose and noninfringement. In no event shall the
-authors or copyright holders be liable for any claim, damages or other
-liability, whether in an action of contract, tort or otherwise, arising from,
-out of or in connection with the software or the use or other dealings in the
-software.
-
-==============================================================================
-
-vim:tw=78:ts=8:ft=help:norl:
--- a/vim/bundle/snipmate/ftplugin/html_snip_helper.vim	Mon Mar 26 10:21:27 2012 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-" Helper function for (x)html snippets
-if exists('s:did_snip_helper') || &cp || !exists('loaded_snips')
-	finish
-endif
-let s:did_snip_helper = 1
-
-" Automatically closes tag if in xhtml
-fun! Close()
-	return stridx(&ft, 'xhtml') == -1 ? '' : ' /'
-endf
--- a/vim/bundle/snipmate/plugin-info.txt	Mon Mar 26 10:21:27 2012 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-{
-  "name" : "snipmate",
-  "version" : "dev",
-  "author" : "Michael Sanders <msanders42@gmail.com>",
-  "repository" : {"type": "git", "url": "git://github.com/msanders/snipmate.vim.git"},
-  "dependencies" : {},
-  "description" : "snipMate.vim aims to be a concise vim script that implements some of TextMate's snippets features in Vim."
-}
--- a/vim/bundle/snipmate/plugin/snipMate.vim	Mon Mar 26 10:21:27 2012 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,271 +0,0 @@
-" File:          snipMate.vim
-" Author:        Michael Sanders
-" Version:       0.84
-" Description:   snipMate.vim implements some of TextMate's snippets features in
-"                Vim. A snippet is a piece of often-typed text that you can
-"                insert into your document using a trigger word followed by a "<tab>".
-"
-"                For more help see snipMate.txt; you can do this by using:
-"                :helptags ~/.vim/doc
-"                :h snipMate.txt
-
-if exists('loaded_snips') || &cp || version < 700
-	finish
-endif
-let loaded_snips = 1
-if !exists('snips_author') | let snips_author = 'Me' | endif
-
-au BufRead,BufNewFile *.snippets\= set ft=snippet
-au FileType snippet setl noet fdm=indent
-
-let s:snippets = {} | let s:multi_snips = {}
-
-if !exists('snippets_dir')
-	let snippets_dir = substitute(globpath(&rtp, 'snippets/'), "\n", ',', 'g')
-endif
-
-fun! MakeSnip(scope, trigger, content, ...)
-	let multisnip = a:0 && a:1 != ''
-	let var = multisnip ? 's:multi_snips' : 's:snippets'
-	if !has_key({var}, a:scope) | let {var}[a:scope] = {} | endif
-	if !has_key({var}[a:scope], a:trigger)
-		let {var}[a:scope][a:trigger] = multisnip ? [[a:1, a:content]] : a:content
-	elseif multisnip | let {var}[a:scope][a:trigger] += [[a:1, a:content]]
-	else
-		echom 'Warning in snipMate.vim: Snippet '.a:trigger.' is already defined.'
-				\ .' See :h multi_snip for help on snippets with multiple matches.'
-	endif
-endf
-
-fun! ExtractSnips(dir, ft)
-	for path in split(globpath(a:dir, '*'), "\n")
-		if isdirectory(path)
-			let pathname = fnamemodify(path, ':t')
-			for snipFile in split(globpath(path, '*.snippet'), "\n")
-				call s:ProcessFile(snipFile, a:ft, pathname)
-			endfor
-		elseif fnamemodify(path, ':e') == 'snippet'
-			call s:ProcessFile(path, a:ft)
-		endif
-	endfor
-endf
-
-" Processes a single-snippet file; optionally add the name of the parent
-" directory for a snippet with multiple matches.
-fun s:ProcessFile(file, ft, ...)
-	let keyword = fnamemodify(a:file, ':t:r')
-	if keyword  == '' | return | endif
-	try
-		let text = join(readfile(a:file), "\n")
-	catch /E484/
-		echom "Error in snipMate.vim: couldn't read file: ".a:file
-	endtry
-	return a:0 ? MakeSnip(a:ft, a:1, text, keyword)
-			\  : MakeSnip(a:ft, keyword, text)
-endf
-
-fun! ExtractSnipsFile(file, ft)
-	if !filereadable(a:file) | return | endif
-	let text = readfile(a:file)
-	let inSnip = 0
-	for line in text + ["\n"]
-		if inSnip && (line[0] == "\t" || line == '')
-			let content .= strpart(line, 1)."\n"
-			continue
-		elseif inSnip
-			call MakeSnip(a:ft, trigger, content[:-2], name)
-			let inSnip = 0
-		endif
-
-		if line[:6] == 'snippet'
-			let inSnip = 1
-			let trigger = strpart(line, 8)
-			let name = ''
-			let space = stridx(trigger, ' ') + 1
-			if space " Process multi snip
-				let name = strpart(trigger, space)
-				let trigger = strpart(trigger, 0, space - 1)
-			endif
-			let content = ''
-		endif
-	endfor
-endf
-
-" Reset snippets for filetype.
-fun! ResetSnippets(ft)
-	let ft = a:ft == '' ? '_' : a:ft
-	for dict in [s:snippets, s:multi_snips, g:did_ft]
-		if has_key(dict, ft)
-			unlet dict[ft]
-		endif
-	endfor
-endf
-
-" Reset snippets for all filetypes.
-fun! ResetAllSnippets()
-	let s:snippets = {} | let s:multi_snips = {} | let g:did_ft = {}
-endf
-
-" Reload snippets for filetype.
-fun! ReloadSnippets(ft)
-	let ft = a:ft == '' ? '_' : a:ft
-	call ResetSnippets(ft)
-	call GetSnippets(g:snippets_dir, ft)
-endf
-
-" Reload snippets for all filetypes.
-fun! ReloadAllSnippets()
-	for ft in keys(g:did_ft)
-		call ReloadSnippets(ft)
-	endfor
-endf
-
-let g:did_ft = {}
-fun! GetSnippets(dir, filetypes)
-	for ft in split(a:filetypes, '\.')
-		if has_key(g:did_ft, ft) | continue | endif
-		call s:DefineSnips(a:dir, ft, ft)
-		if ft == 'objc' || ft == 'cpp' || ft == 'cs'
-			call s:DefineSnips(a:dir, 'c', ft)
-		elseif ft == 'xhtml'
-			call s:DefineSnips(a:dir, 'html', 'xhtml')
-		endif
-		let g:did_ft[ft] = 1
-	endfor
-endf
-
-" Define "aliasft" snippets for the filetype "realft".
-fun s:DefineSnips(dir, aliasft, realft)
-	for path in split(globpath(a:dir, a:aliasft.'/')."\n".
-					\ globpath(a:dir, a:aliasft.'-*/'), "\n")
-		call ExtractSnips(path, a:realft)
-	endfor
-	for path in split(globpath(a:dir, a:aliasft.'.snippets')."\n".
-					\ globpath(a:dir, a:aliasft.'-*.snippets'), "\n")
-		call ExtractSnipsFile(path, a:realft)
-	endfor
-endf
-
-fun! TriggerSnippet()
-	if exists('g:SuperTabMappingForward')
-		if g:SuperTabMappingForward == "<tab>"
-			let SuperTabKey = "\<c-n>"
-		elseif g:SuperTabMappingBackward == "<tab>"
-			let SuperTabKey = "\<c-p>"
-		endif
-	endif
-
-	if pumvisible() " Update snippet if completion is used, or deal with supertab
-		if exists('SuperTabKey')
-			call feedkeys(SuperTabKey) | return ''
-		endif
-		call feedkeys("\<esc>a", 'n') " Close completion menu
-		call feedkeys("\<tab>") | return ''
-	endif
-
-	if exists('g:snipPos') | return snipMate#jumpTabStop(0) | endif
-
-	let word = matchstr(getline('.'), '\S\+\%'.col('.').'c')
-	for scope in [bufnr('%')] + split(&ft, '\.') + ['_']
-		let [trigger, snippet] = s:GetSnippet(word, scope)
-		" If word is a trigger for a snippet, delete the trigger & expand
-		" the snippet.
-		if snippet != ''
-			let col = col('.') - len(trigger)
-			sil exe 's/\V'.escape(trigger, '/\.').'\%#//'
-			return snipMate#expandSnip(snippet, col)
-		endif
-	endfor
-
-	if exists('SuperTabKey')
-		call feedkeys(SuperTabKey)
-		return ''
-	endif
-	return "\<tab>"
-endf
-
-fun! BackwardsSnippet()
-	if exists('g:snipPos') | return snipMate#jumpTabStop(1) | endif
-
-	if exists('g:SuperTabMappingForward')
-		if g:SuperTabMappingBackward == "<s-tab>"
-			let SuperTabKey = "\<c-p>"
-		elseif g:SuperTabMappingForward == "<s-tab>"
-			let SuperTabKey = "\<c-n>"
-		endif
-	endif
-	if exists('SuperTabKey')
-		call feedkeys(SuperTabKey)
-		return ''
-	endif
-	return "\<s-tab>"
-endf
-
-" Check if word under cursor is snippet trigger; if it isn't, try checking if
-" the text after non-word characters is (e.g. check for "foo" in "bar.foo")
-fun s:GetSnippet(word, scope)
-	let word = a:word | let snippet = ''
-	while snippet == ''
-		if exists('s:snippets["'.a:scope.'"]["'.escape(word, '\"').'"]')
-			let snippet = s:snippets[a:scope][word]
-		elseif exists('s:multi_snips["'.a:scope.'"]["'.escape(word, '\"').'"]')
-			let snippet = s:ChooseSnippet(a:scope, word)
-			if snippet == '' | break | endif
-		else
-			if match(word, '\W') == -1 | break | endif
-			let word = substitute(word, '.\{-}\W', '', '')
-		endif
-	endw
-	if word == '' && a:word != '.' && stridx(a:word, '.') != -1
-		let [word, snippet] = s:GetSnippet('.', a:scope)
-	endif
-	return [word, snippet]
-endf
-
-fun s:ChooseSnippet(scope, trigger)
-	let snippet = []
-	let i = 1
-	for snip in s:multi_snips[a:scope][a:trigger]
-		let snippet += [i.'. '.snip[0]]
-		let i += 1
-	endfor
-	if i == 2 | return s:multi_snips[a:scope][a:trigger][0][1] | endif
-	let num = inputlist(snippet) - 1
-	return num == -1 ? '' : s:multi_snips[a:scope][a:trigger][num][1]
-endf
-
-fun! ShowAvailableSnips()
-	let line  = getline('.')
-	let col   = col('.')
-	let word  = matchstr(getline('.'), '\S\+\%'.col.'c')
-	let words = [word]
-	if stridx(word, '.')
-		let words += split(word, '\.', 1)
-	endif
-	let matchlen = 0
-	let matches = []
-	for scope in [bufnr('%')] + split(&ft, '\.') + ['_']
-		let triggers = has_key(s:snippets, scope) ? keys(s:snippets[scope]) : []
-		if has_key(s:multi_snips, scope)
-			let triggers += keys(s:multi_snips[scope])
-		endif
-		for trigger in triggers
-			for word in words
-				if word == ''
-					let matches += [trigger] " Show all matches if word is empty
-				elseif trigger =~ '^'.word
-					let matches += [trigger]
-					let len = len(word)
-					if len > matchlen | let matchlen = len | endif
-				endif
-			endfor
-		endfor
-	endfor
-
-	" This is to avoid a bug with Vim when using complete(col - matchlen, matches)
-	" (Issue#46 on the Google Code snipMate issue tracker).
-	call setline(line('.'), substitute(line, repeat('.', matchlen).'\%'.col.'c', '', ''))
-	call complete(col, matches)
-	return ''
-endf
-" vim:noet:sw=4:ts=4:ft=vim
--- a/vim/bundle/snipmate/syntax/snippet.vim	Mon Mar 26 10:21:27 2012 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-" Syntax highlighting for snippet files (used for snipMate.vim)
-" Hopefully this should make snippets a bit nicer to write!
-syn match snipComment '^#.*'
-syn match placeHolder '\${\d\+\(:.\{-}\)\=}' contains=snipCommand
-syn match tabStop '\$\d\+'
-syn match snipCommand '[^\\]`.\{-}`'
-syn match snippet '^snippet.*' transparent contains=multiSnipText,snipKeyword
-syn match multiSnipText '\S\+ \zs.*' contained
-syn match snipKeyword '^snippet'me=s+8 contained
-syn match snipError "^[^#s\t].*$"
-
-hi link snipComment   Comment
-hi link multiSnipText String
-hi link snipKeyword   Keyword
-hi link snipComment   Comment
-hi link placeHolder   Special
-hi link tabStop       Special
-hi link snipCommand   String
-hi link snipError     Error
--- a/vim/bundle/yankring/doc/yankring.txt	Mon Mar 26 10:21:27 2012 -0400
+++ b/vim/bundle/yankring/doc/yankring.txt	Tue Mar 27 11:38:35 2012 -0400
@@ -1,7 +1,7 @@
 *yankring.txt*      For Vim version 7.0. 
 
-Author:	        David Fishburn                             September 16, 2011
-Version:        12.0
+Author:	        David Fishburn                             February 5, 2011
+Version:        13.0
 
 For instructions on installing this file, type
 	:help add-local-help |add-local-help| inside Vim.
@@ -36,7 +36,8 @@
        5.14 YRMapsCreate......................: |YRMapsCreate|
        5.15 YRMapsDelete......................: |YRMapsDelete|
        5.16 YRSearch..........................: |YRSearch|
-       5.17 YRRunAfterMaps....................: |yankring-custom-maps|
+       5.17 YRCheckClipboard..................: |YRCheckClipboard|
+       5.18 YRRunAfterMaps....................: |YRRunAfterMaps|
     6. Tutorial...............................: |yankring-tutorial|
        6.1  YRShow............................: |YRShow-example|
        6.2  YRReplace.........................: |YRReplace-example|
@@ -261,9 +262,26 @@
         want to use the same text later on.  By default, the YankRing
         will detect when Vim regains focus and check if the clipboard
         has changed since it last checked.  If so, it will add the contents
-        of the clipboard to the YankRing.  To disable this feature 
+        of the clipboard to the YankRing.  This is accomplished by the 
+        use of the FocusGained Vim event for the GUI Vim.  For console 
+        Vims, the FocusGained event does not fire, so additional logic 
+        is added to deal with it.  To disable this feature 
         you can put the following in your |vimrc| >
             let g:yankring_clipboard_monitor = 0
+    yankring_manual_clipboard_check
+<       Default: 0
+        If running in console mode, Vim's FocusGained event will not
+        fire as we flip back and forth between windows.  This normally
+        instructs the YankRing to check for updates to the system
+        clipboard.  When this option is set, the YankRing will check
+        the clipboard under many different circumstances:
+            Adding a new entry to the YankRing 
+            Replacing a previous paste 
+            Showing the YankRing window
+        If the YankRing is setup to check the clipboard and the 
+        GUI is not running, this option will be enabled by default.
+        To disable this feature you can put the following in your |vimrc| >
+            let g:yankring_manual_clipboard_check = 0
     yankring_paste_check_default_buffer
 <       Default: 1
         If the default register has changed without the YankRing registering
@@ -767,8 +785,8 @@
             
 5.13 YRReplace                                   *YRReplace*
         The purpose of the YankRing is to gain access to previously yanked
-        (or deleted) elements.  This command will replace the previously 
-        paste  with a different entry from the yankring.
+        (or deleted) elements.  This command will replace the previous
+        paste with a different entry from the yankring.
         By default, I choose <C-P> (P for previous) to replace the last paste
         while moving backwards through the yankring.  <C-N> (N for next)
         replaces the last paste while moving forward through the yankring. 
@@ -776,6 +794,23 @@
         Examples:
             See the |yankring-tutorial| for examples.
 
+        On the Windows platform, I use ALT-< and ALT-> to move back and 
+        forwards through the yankring instead of C-P and C-N. ALT-< is
+        actually ALT-, since I do not press the Shift key to get the <.
+
+        To do this, I added the following to my .vimrc:
+            " Do not map the default <C-N> and <C-P> keys
+            " These two characters are the ALT-< and ALT->.
+            " To determine what character # these are go into insert mode
+            " in a new buffer.  Press CTRL-V then ALT and the > key.
+            " Leave insert mode, move the cursor onto the character
+            " and press ga.  This will display the decimal, hex and octal
+            " representation of the character.  In this case, they are
+            " 172 and 174.
+            if has('win32')
+                let g:yankring_replace_n_pkey = '<Char-172>'
+                let g:yankring_replace_n_nkey = '<Char-174>'
+            endif
             
 5.14 YRMapsCreate                                *YRMapsCreate*
         This public function is responsible for creating the maps which
@@ -796,6 +831,16 @@
         prompt you to enter which match you wish pasted.
         See also |YRSearch-example|.
 
+5.17 YRCheckClipboard                            *YRCheckClipboard*
+        Normally the GUI Vims will automatically (via autocmds) 
+        check for changes to the system clipboard and add any new
+        changes to the YankRing.  Most console Vim's do not fire
+        the required autocmds.  This command will perform the check
+        manually.
+
+5.18 YRRunAfterMaps                              *YRRunAfterMaps*
+        See the following section |yankring-custom-maps|.
+
 
 ==============================================================================
 6. Tutorial                                      *yankring-tutorial*
@@ -1170,13 +1215,55 @@
 ==============================================================================
 7. History                                       *yankring-history*
 
+  13.0: February 5, 2012
+         NF: [p, ]p, [P, ]P are now supported within the YankRing 
+             window (Alexandre Provencio).
+         NF: When using the console version of Vim the yankring was not
+             detecting the "+ register automatically as the FocusGained
+             event does not fire in console mode.  When new elements are
+             added or the YankRing is shown the clipboard will be
+             checked for new values (Giuseppe Rota).
+         NF: Added a new option, g:yankring_manual_clipboard_check which 
+             when enabled will manually check for clipboard changes at 
+             certain times within the YankRing.  This option is not used 
+             if the GUI is running as the FocusGained will perform checks 
+             at appropriate times (Erik Westrup).
+         BF: With clipboard=unnamed replacing the previous paste with a 
+             different value from the YankRing did not work in all cases 
+             (Chris Lott).
+         BF: Under certain conditions the YankRing would still check
+             the system clipboard even if g:yankring_clipboard_monitor == 0.
+             This can lead to delays when attempting to access the 
+             clipboard when running in console mode.  Starting Vim with
+             the -X switch removes the delay (Erik Westrup).
+         BF: Incorrect syntax setting cpoptions (Thilo Six).
+
+  12.0: October 15, 2011
+         NF: A console Vim does not necessarily react to a FocusGained event
+             which means as you switch Focus back and forth between a 
+             console Vim, the YankRing's feature to automatically gather 
+             changes to the system clipboard is not triggered.  Now special 
+             processing takes place in various spots when you are not running 
+             Vim with a GUI, to check for changes to the clipboard.  Those 
+             already running a GUI Vim, are unaffected by this change
+             (Giuseppe Rota).
+         NF: New command, YRCheckClipboard, which allows you to force 
+             the YankRing to check the system clipboard and if the 
+             value is not present already in the YankRing, it will add it.
+             This is typically done automatically, but certain console 
+             Vim's do not receive the necessary events for automation.
+         BF: Some additional changes were required for the "unnamedplus"
+             support.
+         BF: YRGetMultiple reported an error, though typically you would
+             use YRShow to paste the items.
+
   12.0: September 16, 2011
          NF: Added support for the clipboard option "unnamedplus" which was
              added after 7.3 (Hong Xu).
          NF: When displaying the YankRing using YRShow, a new command "R"
              has been added to display all of Vim's registers [0-9a-z].
          BF: YRMapsDelete did not remove the normal mode @ map, which 
-             interfers with recorded macros (Philippe Vaucher ).
+             interfers with recorded macros (Philippe Vaucher).
 
   11.0: August 09, 2010
          NF: Documented the global variables to customize the location
--- a/vim/bundle/yankring/plugin/yankring.vim	Mon Mar 26 10:21:27 2012 -0400
+++ b/vim/bundle/yankring/plugin/yankring.vim	Tue Mar 27 11:38:35 2012 -0400
@@ -1,15 +1,16 @@
 " yankring.vim - Yank / Delete Ring for Vim
 " ---------------------------------------------------------------
-" Version:  12.0
-" Authors:  David Fishburn <dfishburn.vim@gmail.com>
-" Last Modified: 2011 Jun 14
-" Script:   http://www.vim.org/scripts/script.php?script_id=1234
-" Based On: Mocked up version by Yegappan Lakshmanan
-"           http://groups.yahoo.com/group/vim/post?act=reply&messageNum=34406
-" License:  GPL (Gnu Public License)
+" Version:       13.0
+" Author:        David Fishburn <dfishburn dot vim at gmail dot com>
+" Maintainer:    David Fishburn <dfishburn dot vim at gmail dot com>
+" Last Modified: 2012 Feb 24
+" Script:        http://www.vim.org/scripts/script.php?script_id=1234
+" Based On:      Mocked up version by Yegappan Lakshmanan
+"                http://groups.yahoo.com/group/vim/post?act=reply&messageNum=34406
+" License:       GPL (Gnu Public License)
 " GetLatestVimScripts: 1234 1 :AutoInstall: yankring.vim
 
-if exists('loaded_yankring') || &cp
+if exists('loaded_yankring')
     finish
 endif
 
@@ -18,7 +19,11 @@
   finish
 endif
 
-let loaded_yankring = 120
+let loaded_yankring = 130
+
+" Turn on support for line continuations when creating the script
+let s:cpo_save = &cpo
+set cpo&vim
 
 let s:yr_has_voperator     = 0
 if v:version > 701 || ( v:version == 701 && has("patch205") )
@@ -222,6 +227,21 @@
     let g:yankring_clipboard_monitor = (has('clipboard')?1:0)
 endif
 
+if !exists('g:yankring_manual_clipboard_check')
+    if g:yankring_clipboard_monitor == 1 
+        if has("gui_running") 
+            " FocusGained event will take care of 
+            " monitoring the clipboard.
+            let g:yankring_manual_clipboard_check = 0
+        else 
+            " If the GUI is not running and the user wants to monitor the
+            " clipboard, we need to manually check for clipboard entries as
+            " the FocusGained event does not fire in console mode.
+            let g:yankring_manual_clipboard_check = 1
+        endif
+    endif
+endif
+
 if !exists('g:yankring_default_menu_mode')
     let g:yankring_default_menu_mode = 3
 endif
@@ -255,6 +275,7 @@
 let s:yr_winsize_chgd      = 0
 let s:yr_maps_created      = 0
 let s:yr_maps_created_zap  = 0
+let s:yr_last_motion       = ''
 
 " Enables or disables the yankring 
 function! s:YRToggle(...)
@@ -271,8 +292,10 @@
         return
     elseif new_state == 1
         call s:YRMapsCreate()
+        call s:YRWarningMsg('YR: The YankRing is now enabled')
     else
         call s:YRMapsDelete()
+        call s:YRWarningMsg('YR: The YankRing is now disabled')
     endif
 endfunction
  
@@ -321,6 +344,17 @@
 
 " Enables or disables the yankring 
 function! s:YRShow(...) 
+    if g:yankring_enabled == 0
+        call s:YRWarningMsg('YR: The YankRing is disabled, use YRToggle to re-enable')
+        return
+    endif
+
+    " If the GUI is not running, we need to manually check for clipboard 
+    " entries as the FocusGained event does not fire in console mode.
+    if g:yankring_manual_clipboard_check == 1
+        call s:YRCheckClipboard()
+    endif
+
     " If no parameter was provided assume the user wants to 
     " toggle the display.
     let toggle = 1
@@ -361,9 +395,12 @@
     " show the contents (or when it is refreshed).
     if g:yankring_paste_check_default_buffer == 1 
         let save_reg = 0
-        let register = ((&clipboard=~'unnamed')?'+':'"')
+        let register = ((&clipboard=~'\<unnamed\>')?'*':((&clipboard=~'\<unnamedplus\>' && has('unnamedplus'))?'+':'"'))
 
-        if &clipboard =~ 'unnamed' && getreg('+') != s:yr_prev_clipboard
+        if &clipboard =~ '\<unnamed\>' && getreg('*') != s:yr_prev_clipboard
+            let save_reg = 1
+        endif
+        if has('unnamedplus') && &clipboard =~ '\<unnamedplus\>' && getreg('+') != s:yr_prev_clipboard
             let save_reg = 1
         endif
         if register == '"' && getreg('"') != s:yr_prev_reg_unnamed
@@ -452,12 +489,16 @@
 " If no parameter is provided, this function becomes interactive.  It will
 " display the list (using YRShow) and allow the user to choose an element.
 function! s:YRGetElem(...) 
+    if g:yankring_manual_clipboard_check == 1
+        call s:YRCheckClipboard()
+    endif
+
     if s:yr_count == 0
         call s:YRWarningMsg('YR: yankring is empty')
         return -1
     endif
 
-    let default_buffer = ((&clipboard=~'unnamed')?'+':'"')
+    let default_buffer = ((&clipboard=~'\<unnamed\>')?'*':((&clipboard=~'\<unnamedplus\>' && has('unnamedplus'))?'+':'"'))
 
     let direction = 'p'
     if a:0 > 1
@@ -502,12 +543,12 @@
         return -1
     endif
 
-    let default_buffer = ((&clipboard=~'unnamed')?'+':'"')
+    let default_buffer = ((&clipboard=~'\<unnamed\>')?'*':((&clipboard=~'\<unnamedplus\>' && has('unnamedplus'))?'+':'"'))
     call setreg(default_buffer
                 \ , s:YRGetValElemNbr((elem), 'v')
                 \ , s:YRGetValElemNbr((elem), 't')
                 \ )
-    exec "normal! ".direction
+    exec 'normal! "'.default_buffer.direction
 
     " Set the previous action as a paste in case the user
     " press . to repeat
@@ -518,17 +559,19 @@
 
 " Starting the top of the ring it will paste x items from it
 function! s:YRGetMultiple(reverse_order, ...) 
+    if g:yankring_manual_clipboard_check == 1
+        call s:YRCheckClipboard()
+    endif
+
     if s:yr_count == 0
         call s:YRWarningMsg('YR: yankring is empty')
         return
     endif
 
-    " If the user provided a range, exit after that many
-    " have been displayed
-    let max  = 1
+    let max = 1
     if a:0 == 1
-        " If no yank command has been supplied, assume it is
-        " a full line yank
+        " If the user provided a range, exit after that many
+        " have been displayed
         let max = matchstr(a:1, '\d\+')
     endif
     if max > s:yr_count
@@ -540,10 +583,10 @@
     let increment = ((a:reverse_order==0)?(1):(-1))
     if a:reverse_order == 0
         let increment = 1
-        let elem = 0
+        let elem = 1
     else
         let increment = -1
-        let elem = (max - 1)
+        let elem = max
     endif
 
     if a:0 > 1
@@ -556,7 +599,6 @@
     else
         while max > 0
             " Paste the first item, and move on to the next.
-            " digits the element # is
             call s:YRGetElem(elem)
             let elem = elem + increment
             let max  = max - 1
@@ -661,7 +703,7 @@
 " There is no need physically unlet each variable.
 function! s:YRInit(...)
     let s:yr_next_idx              = 0
-    let s:yr_last_paste_idx        = 0
+    let s:yr_last_paste_idx        = 1
     let s:yr_count                 = 0
     let s:yr_history_last_upd      = 0
     let s:yr_history_list          = []
@@ -698,7 +740,6 @@
  
 
 " Clears the yankring by simply setting the # of items in it to 0.
-" There is no need physically unlet each variable.
 function! s:YRClear()
     call s:YRReset()
     call s:YRInit('DoNotClear')
@@ -715,7 +756,10 @@
     " so test for this condition and return the 
     " default register
     let user_register = ((v:register=='')?('"'):(v:register))
-    if &clipboard =~ 'unnamed' && user_register == '"'
+    if &clipboard =~ '\<unnamed\>' && user_register == '"'
+        let user_register = '*'
+    endif
+    if has('unnamedplus') && &clipboard =~ '\<unnamedplus\>' && user_register == '"'
         let user_register = '+'
     endif
     return user_register
@@ -737,7 +781,7 @@
     " If we are pushing something on to the yankring, add it to
     " the default buffer as well so the next item pasted will
     " be the item pushed
-    let default_buffer = ((&clipboard=~'unnamed')?'+':'"')
+    let default_buffer = ((&clipboard=~'\<unnamed\>')?'*':((&clipboard=~'\<unnamedplus\>' && has('unnamedplus'))?'+':'"'))
     call setreg(default_buffer, getreg(user_register), 
                 \ getregtype(user_register))
 
@@ -800,7 +844,7 @@
         return ""
     endif
 
-    let register = ((&clipboard=~'unnamed')?'+':register)
+    let register = ((&clipboard=~'\<unnamed\>')?'*':((&clipboard=~'\<unnamedplus\>' && has('unnamedplus'))?'+':register))
 
     " let s:yr_prev_changenr    = changenr()
     if register == '"'
@@ -819,8 +863,13 @@
                 \ , getregtype(register) 
                 \ )
 
-    if register =~ '[+*]'
-        let s:yr_prev_clipboard = @+
+    if g:yankring_clipboard_monitor == 1
+        if register == '+'
+            let s:yr_prev_clipboard = getreg('+')
+        endif
+        if register == '*'
+            let s:yr_prev_clipboard = getreg('*')
+        endif
     endif
 
     " Manage the numbered registers
@@ -833,14 +882,27 @@
     " If the yankring window is open, refresh it
     call s:YRWindowUpdate()
 
+    " Reset the past paste entry to the top of the ring.
+    " When the user hits replace last entry it should
+    " start from the top (not from the last previous 
+    " replace) after capturing a new value in the YankRing.
+    let s:yr_last_paste_idx = 1
+
     return ""
 endfunction
 
 
 " Adds this value to the yankring.
-function! YRRecord3() 
+function! YRRecord3(...) 
     let register = '"'
 
+    " if a:0 > 0
+    "     " If no yank command has been supplied, assume it is
+    "     " a full line yank
+    "     let motion = ((a:1 == '') ? motion : a:1)
+    "     echomsg "YRRecord3 motion:".motion
+    " endif
+
     " v:register can be blank in some (unknown) cases
     " if v:register == '' || v:register == '_'
     if v:register == '_'
@@ -848,7 +910,47 @@
         return ""
     endif
 
-    let register = ((&clipboard=~'unnamed')?'+':register)
+    let register = s:YRRegister()
+
+    if &clipboard =~ '\<unnamed\>' && register == '*'
+        " unnamed  A variant of "unnamed" flag which uses the clipboard
+        "          register '*' (|quote|) for all operations except yank.
+        "          Yank shall copy the text into register '*' when "unnamed"
+        "          is included.
+        " 
+        let register = '*'
+
+        " The + and * registers are not modified by yank operations.
+        " We do not know what operation triggered this event so do a
+        " simple check if the register values have changed.
+        " If not, check it against the " register.  Use which ever 
+        " one has changed.
+        if s:yr_prev_clipboard == '' || getreg(register) == s:yr_prev_clipboard
+            if getreg('"') != getreg(register)
+                let register = '"'
+            endif 
+        endif 
+    endif
+
+    if has('unnamedplus') && &clipboard =~ '\<unnamedplus\>' && register == '+'
+        " unnamedplus    A variant of "unnamed" flag which uses the clipboard
+        "         register '+' (|quoteplus|) instead of register '*' for all
+        "         operations except yank.  Yank shall copy the text into
+        "         register '+' and also into '*' when "unnamed" is included.
+        " 
+        let register = '+'
+
+        " The + and * registers are not modified by yank operations.
+        " We do not know what operation triggered this event so do a
+        " simple check if the register values have changed.
+        " If not, check it against the " register.  Use which ever 
+        " one has changed.
+        if s:yr_prev_clipboard == '' || getreg(register) == s:yr_prev_clipboard
+            if getreg('"') != getreg(register)
+                let register = '"'
+            endif 
+        endif 
+    endif
 
     if register == '"'
         " If the change has occurred via an omap, we must delay
@@ -870,8 +972,13 @@
                 \ , getregtype(register) 
                 \ )
 
-    if register =~ '[+*]'
-        let s:yr_prev_clipboard = @+
+    if g:yankring_clipboard_monitor == 1
+        if register == '+'
+            let s:yr_prev_clipboard = getreg('+')
+        endif
+        if register == '*'
+            let s:yr_prev_clipboard = getreg('*')
+        endif
     endif
 
     " Manage the numbered registers
@@ -884,6 +991,12 @@
     " If the yankring window is open, refresh it
     call s:YRWindowUpdate()
 
+    " Reset the past paste entry to the top of the ring.
+    " When the user hits replace last entry it should
+    " start from the top (not from the last previous 
+    " replace) after capturing a new value in the YankRing.
+    let s:yr_last_paste_idx = 1
+
     return ""
 endfunction
 
@@ -1159,7 +1272,7 @@
 function! s:YRYankRange(do_delete_selection, ...) range
 
     let user_register  = s:YRRegister()
-    let default_buffer = ((&clipboard=~'unnamed')?'+':'"')
+    let default_buffer = ((&clipboard=~'\<unnamed\>')?'*':((&clipboard=~'\<unnamedplus\>' && has('unnamedplus'))?'+':'"'))
 
     " Default command mode to normal mode 'n'
     let cmd_mode = 'n'
@@ -1203,6 +1316,10 @@
 " Paste from either the yankring or from a specified register
 " Optionally a count can be provided, so paste the same value 10 times 
 function! s:YRPaste(replace_last_paste_selection, nextvalue, direction, ...) 
+    if g:yankring_manual_clipboard_check == 1
+        call s:YRCheckClipboard()
+    endif
+
     " Disabling the yankring removes the default maps.
     " But there are some maps the user can create on their own, and 
     " these would most likely call this function.  So place an extra
@@ -1214,9 +1331,8 @@
         return
     endif
     
-
     let user_register  = s:YRRegister()
-    let default_buffer = ((&clipboard =~ 'unnamed')?'+':'"')
+    let default_buffer = ((&clipboard=~'\<unnamed\>')?'*':((&clipboard=~'\<unnamedplus\>' && has('unnamedplus'))?'+':'"'))
     let v_count        = v:count
 
     " Default command mode to normal mode 'n'
@@ -1256,7 +1372,7 @@
             " In this case, we have bypassed the yankring
             " If the user hits next or previous we want the
             " next item pasted to be the top of the yankring.
-            let s:yr_last_paste_idx = 0
+            let s:yr_last_paste_idx = 1
         endif
         let s:yr_paste_dir     = a:direction
         let s:yr_prev_vis_mode = ((cmd_mode=='n') ? 0 : 1)
@@ -1267,49 +1383,59 @@
     " If the user hits paste, compare the contents of the paste register
     " to the current entry in the yankring.  If they are different, lets
     " assume the user wants the contents of the paste register.
-    " So if they pressed [yt ] (yank to space) and hit paste, the yankring
-    " would not have the word in it, so assume they want the word pasted.
+    " The user could have:
+    "     let @" = 'test string'
+    " would not be in the yankring as no mapping triggered this action.
     if a:replace_last_paste_selection != 1 
-        if s:yr_count > 0 || (default_buffer == '+' && len(@+) == 0)
             " Only check the default buffer is the user wants us to.
             " This was necessary prior to version 4.0 since we did not 
             " capture as many items as 4.0 and above does. (A. Budden)
-            if g:yankring_paste_check_default_buffer == 1 && 
-                        \ getreg(default_buffer) != s:yr_prev_reg_unnamed
-                " The user has performed a yank / delete operation
-                " outside of the yankring maps.  First, add this 
-                " value to the yankring.
-                call YRRecord(default_buffer)
-                " Now, use the most recently yanked text, rather than the
-                " value from the yankring.
-                exec "normal! ".
-                            \ ((cmd_mode=='n') ? "" : "gv").
-                            \ ((v_count > 0)?(v_count):'').
-                            \ a:direction
-                let s:yr_paste_dir     = a:direction
-                let s:yr_prev_vis_mode = ((cmd_mode=='n') ? 0 : 1)
+            if g:yankring_paste_check_default_buffer == 1 
+                if ( default_buffer == '"' &&  getreg(default_buffer) != s:yr_prev_reg_unnamed )
+                    " There are only a couple of scenarios where this would happen
+                    " 1.  set clipboard = unnamed[plus]
+                    "     The user performs an action which changes the 
+                    "     unnamed register (i.e. x - delete character)
+                    " 2.  Any type of direct manipulation of the registers
+                    "     let @" = 'something'
+                    " 3.  Something changed the system clipboard outside of Vim
+                    if getreg('"') != s:yr_prev_reg_unnamed
+                        let default_buffer = '"'
+                    endif
 
-                " In this case, we have bypassed the yankring
-                " If the user hits next or previous we want the
-                " next item pasted to be the top of the yankring.
-                let s:yr_last_paste_idx = 0
-                return
+                    " The user has performed a yank / delete operation
+                    " outside of the yankring maps.  First, add this 
+                    " value to the yankring.
+                    call YRRecord(default_buffer)
+                elseif ( default_buffer != '"' && 
+                        \ len(getreg(default_buffer)) != 0 &&
+                        \ getreg(default_buffer) != s:yr_prev_clipboard
+                        \ )
+
+                    " The user has performed a yank / delete operation
+                    " outside of the yankring maps.  First, add this 
+                    " value to the yankring.
+                    call YRRecord(default_buffer)
+                endif
             endif
-        else
+    
             exec "normal! ".
                         \ ((cmd_mode=='n') ? "" : "gv").
                         \ ((v_count > 0)?(v_count):'').
                         \ a:direction
+                        "\ '"'.default_buffer.
             let s:yr_paste_dir     = a:direction
             let s:yr_prev_vis_mode = ((cmd_mode=='n') ? 0 : 1)
             return
-        endif
     endif
 
-    if s:yr_count == 0 || (default_buffer == '+' && len(@+) == 0)
-        " Nothing to paste
-        return
-    endif
+    " if s:yr_count > 0 || (
+    "             \ default_buffer != '"' && 
+    "             \ len(getreg(default_buffer)) == 0 
+    "             \ )
+    "     " Nothing to paste
+    "     return
+    " endif
 
     if a:replace_last_paste_selection == 1
         " Replacing the previous put
@@ -1327,7 +1453,8 @@
 
         " If a count was provided (ie 5<C-P>), multiply the 
         " nextvalue accordingly and position the next paste index
-        let which_elem = a:nextvalue * ((v_count > 0)?(v_count):1) * -1
+        " let which_elem = a:nextvalue * ((v_count > 0)?(v_count):1) * -1
+        let which_elem = matchstr(a:nextvalue, '-\?\d\+') * ((v_count > 0)?(v_count):1) * -1
         let s:yr_last_paste_idx = s:YRGetNextElem(
 		    \ s:yr_last_paste_idx, which_elem
 		    \ )
@@ -1347,6 +1474,7 @@
         " there was nothing to undo, the paste never happened.
         exec "normal! ".
                     \ ((s:yr_prev_vis_mode==0) ? "" : "gv").
+                    \ '"'.default_buffer.
                     \ s:yr_paste_dir
         call setreg(default_buffer, save_reg, save_reg_type)
         call s:YRSetPrevOP('', '', '', 'n')
@@ -1363,10 +1491,9 @@
                     \ )
         exec "normal! ".
                     \ ((cmd_mode=='n') ? "" : "gv").
-                    \ (
                     \ ((v_count > 0)?(v_count):'').
+                    \ '"'.default_buffer.
                     \ a:direction
-                    \ )
         call setreg(default_buffer, save_reg, save_reg_type)
         call s:YRSetPrevOP(
                     \ a:direction
@@ -1377,7 +1504,6 @@
         let s:yr_paste_dir     = a:direction
         let s:yr_prev_vis_mode = ((cmd_mode=='n') ? 0 : 1)
     endif
-
 endfunction
  
 
@@ -1435,6 +1561,7 @@
             " The InsertLeave event will handle the motions
             " that place us in insert mode and record the
             " changes when insert mode ends.
+            " let cmds .= a:sid. "yrrecord ".a:motion
             let cmds .= a:sid. "yrrecord"
         endif
     endif
@@ -1444,6 +1571,10 @@
     "     let cmds = 'normal! ' . cmds
     " endif
 
+    " YRRecord3() will use this value to determine what operation 
+    " the user just initiated.  
+    let s:yr_last_motion = cmds
+
     " echomsg "YRMapsE 5:".a:motion.":'".cmds."':".s:yr_maps_created_zap
     return cmds
  
@@ -2131,27 +2262,35 @@
     " other buffers.
     mapclear <buffer>
     " Create a mapping to act upon the yankring
-    nnoremap <buffer> <silent> <2-LeftMouse> :call <SID>YRWindowActionN('p' ,'n')<CR>
-    nnoremap <buffer> <silent> <CR>          :call <SID>YRWindowActionN('p' ,'n')<CR>
-    xnoremap <buffer> <silent> <CR>          :call <SID>YRWindowAction ('p' ,'v')<CR>
-    nnoremap <buffer> <silent> p             :call <SID>YRWindowActionN('p' ,'n')<CR>
-    xnoremap <buffer> <silent> p             :call <SID>YRWindowAction ('p' ,'v')<CR>
-    nnoremap <buffer> <silent> P             :call <SID>YRWindowActionN('P' ,'n')<CR>
-    xnoremap <buffer> <silent> P             :call <SID>YRWindowAction ('P' ,'v')<CR>
-    nnoremap <buffer> <silent> gp            :call <SID>YRWindowActionN('gp','n')<CR>
-    xnoremap <buffer> <silent> gp            :call <SID>YRWindowAction ('gp','v')<CR>
-    nnoremap <buffer> <silent> gP            :call <SID>YRWindowActionN('gP','n')<CR>
-    xnoremap <buffer> <silent> gP            :call <SID>YRWindowAction ('gP','v')<CR>
-    nnoremap <buffer> <silent> d             :call <SID>YRWindowActionN('d' ,'n')<CR>
-    xnoremap <buffer> <silent> d             :call <SID>YRWindowAction ('d' ,'v')<CR>
-    xnoremap <buffer> <silent> r             :call <SID>YRWindowAction ('r' ,'v')<CR>
-    nnoremap <buffer> <silent> s             :call <SID>YRWindowAction ('s' ,'n')<CR>
-    nnoremap <buffer> <silent> a             :call <SID>YRWindowAction ('a' ,'n')<CR>
-    nnoremap <buffer> <silent> c             :call <SID>YRWindowAction ('c' ,'n')<CR>
-    nnoremap <buffer> <silent> ?             :call <SID>YRWindowAction ('?' ,'n')<CR>
-    nnoremap <buffer> <silent> u             :call <SID>YRWindowAction ('u' ,'n')<CR>
-    nnoremap <buffer> <silent> q             :call <SID>YRWindowAction ('q' ,'n')<CR>
-    nnoremap <buffer> <silent> R             :call <SID>YRWindowAction ('R' ,'n')<CR>
+    nnoremap <buffer> <silent> <2-LeftMouse> :call <SID>YRWindowActionN('p'   , 'n')<CR>
+    nnoremap <buffer> <silent> <CR>          :call <SID>YRWindowActionN('p'   , 'n')<CR>
+    xnoremap <buffer> <silent> <CR>          :call <SID>YRWindowAction ('p'   , 'v')<CR>
+    nnoremap <buffer> <silent> p             :call <SID>YRWindowActionN('p'   , 'n')<CR>
+    nnoremap <buffer> <silent> [p            :call <SID>YRWindowActionN('[p'  , 'n')<CR>
+    nnoremap <buffer> <silent> ]p            :call <SID>YRWindowActionN(']p'  , 'n')<CR>
+    xnoremap <buffer> <silent> p             :call <SID>YRWindowAction ('p'   , 'v')<CR>
+    xnoremap <buffer> <silent> [p            :call <SID>YRWindowAction ('[p'  , 'v')<CR>
+    xnoremap <buffer> <silent> ]p            :call <SID>YRWindowAction (']p'  , 'v')<CR>
+    nnoremap <buffer> <silent> P             :call <SID>YRWindowActionN('P'   , 'n')<CR>
+    nnoremap <buffer> <silent> [P            :call <SID>YRWindowActionN('[P'  , 'n')<CR>
+    nnoremap <buffer> <silent> ]P            :call <SID>YRWindowActionN(']P'  , 'n')<CR>
+    xnoremap <buffer> <silent> P             :call <SID>YRWindowAction ('P'   , 'v')<CR>
+    xnoremap <buffer> <silent> [P            :call <SID>YRWindowAction ('[P'  , 'v')<CR>
+    xnoremap <buffer> <silent> ]P            :call <SID>YRWindowAction (']P'  , 'v')<CR>
+    nnoremap <buffer> <silent> gp            :call <SID>YRWindowActionN('gp'  , 'n')<CR>
+    xnoremap <buffer> <silent> gp            :call <SID>YRWindowAction ('gp'  , 'v')<CR>
+    nnoremap <buffer> <silent> gP            :call <SID>YRWindowActionN('gP'  , 'n')<CR>
+    xnoremap <buffer> <silent> gP            :call <SID>YRWindowAction ('gP'  , 'v')<CR>
+    nnoremap <buffer> <silent> d             :call <SID>YRWindowActionN('d'   , 'n')<CR>
+    xnoremap <buffer> <silent> d             :call <SID>YRWindowAction ('d'   , 'v')<CR>
+    xnoremap <buffer> <silent> r             :call <SID>YRWindowAction ('r'   , 'v')<CR>
+    nnoremap <buffer> <silent> s             :call <SID>YRWindowAction ('s'   , 'n')<CR>
+    nnoremap <buffer> <silent> a             :call <SID>YRWindowAction ('a'   , 'n')<CR>
+    nnoremap <buffer> <silent> c             :call <SID>YRWindowAction ('c'   , 'n')<CR>
+    nnoremap <buffer> <silent> ?             :call <SID>YRWindowAction ('?'   , 'n')<CR>
+    nnoremap <buffer> <silent> u             :call <SID>YRWindowAction ('u'   , 'n')<CR>
+    nnoremap <buffer> <silent> q             :call <SID>YRWindowAction ('q'   , 'n')<CR>
+    nnoremap <buffer> <silent> R             :call <SID>YRWindowAction ('R'   , 'n')<CR>
     nnoremap <buffer> <silent> <space>     \|:silent exec 'vertical resize '.
                 \ (
                 \ g:yankring_window_use_horiz!=1 && winwidth('.') > g:yankring_window_width
@@ -2219,7 +2358,7 @@
 endfunction
 
 function! s:YRWindowAction(op, cmd_mode) range
-    let default_buffer = ((&clipboard=~'unnamed')?'+':'"')
+    let default_buffer = ((&clipboard=~'\<unnamed\>')?'*':((&clipboard=~'\<unnamedplus\>' && has('unnamedplus'))?'+':'"'))
     let opcode     = a:op
     let lines      = []
     let v_count    = v:count
@@ -2412,26 +2551,61 @@
 endfunction
       
 function! s:YRFocusGained()
+    " FocusGained is not available in general by console vim.
+    " There are some terminal windows which support it though.
+    " This thread on vim_use covers some of it:
+    "     http://groups.google.com/group/vim_use/browse_thread/thread/8dd3fb054ee922c6/59bee226473a9eea?lnk=gst&q=console+FocusGained#59bee226473a9eea
+    "     http://groups.google.com/group/vim_dev/browse_thread/thread/ba58fb493a3cf4ba/dc1a22ba1e92579d?lnk=gst&q=terminal+FocusGained#dc1a22ba1e92579d
+    " Does not work:
+    "     urxvt terminal
+    " Works:
+    "     GTK2 GUI, on Fedora 11, both as gvim and as vim in a GNOME Terminal
+    "
+    " Simple test, create the following autocmd and gain and loose focus in
+    " the terminal:
+    "     autocmd FocusLost * echomsg "focus lost" 
+    "     autocmd FocusGained * echomsg "focus gained" 
+    call s:YRCheckClipboard()
+
+    " If the yankring window is open, refresh it
+    call s:YRWindowUpdate()
+endfunction
+      
+function! s:YRCheckClipboard()
     if g:yankring_clipboard_monitor == 1
         " If the clipboard has changed record it inside the yankring
-        " echomsg "YRFocusGained[".len(@+)."][".@+.']['.s:yr_prev_clipboard.']'
-        if len(@+) > 0 && @+ != s:yr_prev_clipboard
-            let elem    = s:YRMRUElemFormat( 
-                        \   getreg('+')
-                        \ , getregtype('+') 
-                        \ )
-            let found   = s:YRMRUHas('s:yr_history_list', elem)
+        " echomsg "YRCheckClipboard[".len(@*)."][".@*.']['.s:yr_prev_clipboard.']'
+        if has('unnamedplus') && &clipboard =~ '\<unnamedplus\>'
+            if len(@+) > 0 && @+ != s:yr_prev_clipboard
+                let elem    = s:YRMRUElemFormat( 
+                            \   getreg('+')
+                            \ , getregtype('+') 
+                            \ )
+                let found   = s:YRMRUHas('s:yr_history_list', elem)
 
-            " Only add the item to the "top" of the ring if it is
-            " not in the ring already.
-            if found == -1
-                call YRRecord("+")
-                " silent! call YRRecord("+")
+                " Only add the item to the "top" of the ring if it is
+                " not in the ring already.
+                if found == -1
+                    call YRRecord3("+")
+                endif
+                let s:yr_prev_clipboard = @+
+            endif
+        else
+            if len(@*) > 0 && @* != s:yr_prev_clipboard
+                let elem    = s:YRMRUElemFormat( 
+                            \   getreg('*')
+                            \ , getregtype('*') 
+                            \ )
+                let found   = s:YRMRUHas('s:yr_history_list', elem)
+
+                " Only add the item to the "top" of the ring if it is
+                " not in the ring already.
+                if found == -1
+                    call YRRecord3("*")
+                endif
+                let s:yr_prev_clipboard = @*
             endif
         endif
-
-        " If the yankring window is open, refresh it
-        call s:YRWindowUpdate()
     endif
 endfunction
 
@@ -2486,35 +2660,41 @@
 
 
 " Public commands
-command!                           YRClear        call s:YRClear()
-command!                  -nargs=0 YRMapsCreate   call s:YRMapsCreate()
-command!                  -nargs=0 YRMapsDelete   call s:YRMapsDelete()
-command! -range -bang     -nargs=? YRDeleteRange  <line1>,<line2>call s:YRYankRange(<bang>1, <args>)
-command!                  -nargs=* YRGetElem      call s:YRGetElem(<args>)
-command!        -bang     -nargs=? YRGetMultiple  call s:YRGetMultiple(<bang>0, <args>)
-command! -count -register -nargs=* YRPaste        call s:YRPaste(0,1,<args>)
-command!                  -nargs=? YRPop          <line1>,<line2>call s:YRPop(<args>)
-command!        -register -nargs=? YRPush         call s:YRPush(<args>)
-command! -count -register -nargs=* YRReplace      call s:YRPaste(1,<args>)
-command!                  -nargs=? YRSearch       call s:YRSearch(<q-args>)
-command!                  -nargs=? YRShow         call s:YRShow(<args>)
-command!                  -nargs=? YRToggle       call s:YRToggle(<args>)
-command! -count -register -nargs=* YRYankCount    call s:YRYankCount(<args>)
-command! -range -bang     -nargs=? YRYankRange    <line1>,<line2>call s:YRYankRange(<bang>0, <args>)
+command!                           YRClear          call s:YRClear()
+command!                  -nargs=0 YRMapsCreate     call s:YRMapsCreate()
+command!                  -nargs=0 YRMapsDelete     call s:YRMapsDelete()
+command! -range -bang     -nargs=? YRDeleteRange    <line1>,<line2>call s:YRYankRange(<bang>1, <args>)
+command!                  -nargs=* YRGetElem        call s:YRGetElem(<args>)
+command!        -bang     -nargs=? YRGetMultiple    call s:YRGetMultiple(<bang>0, <args>)
+command! -count -register -nargs=* YRPaste          call s:YRPaste(0,1,<args>)
+command!                  -nargs=? YRPop            <line1>,<line2>call s:YRPop(<args>)
+command!        -register -nargs=? YRPush           call s:YRPush(<args>)
+command!                  -nargs=* YRReplace        call s:YRPaste(1,<f-args>)
+command!                  -nargs=? YRSearch         call s:YRSearch(<q-args>)
+command!                  -nargs=? YRShow           call s:YRShow(<args>)
+command!                  -nargs=? YRToggle         call s:YRToggle(<args>)
+command!                  -nargs=? YRCheckClipboard call s:YRCheckClipboard(<args>)
+command! -count -register -nargs=* YRYankCount      call s:YRYankCount(<args>)
+command! -range -bang     -nargs=? YRYankRange      <line1>,<line2>call s:YRYankRange(<bang>0, <args>)
 " command! -range -bang     -nargs=0 YRMapsMacro    <line1>,<line2>call s:YRMapsMacro(<bang>0, <args>)
 
 " Menus 
-if has("gui_running") && has("menu") && g:yankring_default_menu_mode != 0
+" 0: Turns the menu off.
+if has("menu") && g:yankring_default_menu_mode != 0
     if g:yankring_default_menu_mode == 1
+        " 1: Turns the 'Yankring' menu on with no menu shortcut.
         let menuRoot = 'YankRing'
         let menuPriority = ''
     elseif g:yankring_default_menu_mode == 2
+        " 2: Turns the 'Yankring 'menu on with <alt>-y as the shortcut.
         let menuRoot = '&YankRing'
         let menuPriority = ''
     elseif g:yankring_default_menu_mode == 3 
+        " 3: Turns the 'Plugin -> YankRing' menu on with <alt>-y as the shortcut.
         let menuRoot = exists("g:yankring_menu_root") ? g:yankring_menu_root : '&Plugin.&YankRing'
         let menuPriority = exists("g:yankring_menu_priority") ? yankring_menu_priority : ''
     else
+        " 3: Turns the 'Plugin -> YankRing' menu on with <alt>-y as the shortcut.
         let menuRoot = '&Plugin.&YankRing'
         let menuPriority = ''
     endif
@@ -2527,10 +2707,11 @@
 
     exec 'noremenu  <script> '.menuPriority.' '.menuRoot.'.YankRing\ Window  :YRShow<CR>'
     exec 'noremenu  <script> '.menuPriority.' '.menuRoot.'.YankRing\ Search  :YRSearch<CR>'
-    exec 'noremenu  <script> '.menuPriority.' '.menuRoot.'.Replace\ with\ Previous<TAB>'.leader.'<C-P> :YRReplace ''-1'', ''P''<CR>'
-    exec 'noremenu  <script> '.menuPriority.' '.menuRoot.'.Replace\ with\ Next<TAB>'.leader.'<C-N> :YRReplace ''1'', ''P''<CR>'
+    exec 'noremenu  <script> '.menuPriority.' '.menuRoot.'.Replace\ with\ Previous<TAB>'.leader.g:yankring_replace_n_pkey.' :YRReplace -1, ''P''<CR>'
+    exec 'noremenu  <script> '.menuPriority.' '.menuRoot.'.Replace\ with\ Next<TAB>'.leader.g:yankring_replace_n_pkey.' :YRReplace 1, ''P''<CR>'
     exec 'noremenu  <script> '.menuPriority.' '.menuRoot.'.Clear  :YRClear<CR>'
     exec 'noremenu  <script> '.menuPriority.' '.menuRoot.'.Toggle :YRToggle<CR>'
+    exec 'noremenu  <script> '.menuPriority.' '.menuRoot.'.Check\ Clipboard :YRCheckClipboard<CR>'
 endif
 
 if g:yankring_enabled == 1
@@ -2539,6 +2720,9 @@
 endif
 
 call s:YRInit()
-call s:YRHistoryRead()
+call s:YRCheckClipboard()
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
 
 " vim:fdm=marker:nowrap:ts=4:expandtab: