Commits

Antun Krasic  committed 106eea3

update

  • Participants
  • Parent commits 72946e2

Comments (0)

Files changed (16)

File README.markdown

 ```
 
 
+Keybindings
+----------------------
+**Window management**
+```
+leader + w - split and focus on the new vertical window
+leader + x - split and focus on the new horizontal window
+<C-w> + w  - Jump to next window
+<C-w> + h  - Jump left window
+<C-w> + j - Jump to window below
+<C-w> + k - Jump to window up
+<C-w> + l - Jump to window right
+```
+
+**Session Management**
+```
+<leader>sl - List sessions
+<leader>ss - Save session
+```
 
+**Fuzzy plugin**
+```
+<C-a> - Fuzzy File Search
+<C-e> - Fuzzy Buffer Search
+```
+
+**NerdTree**
+```
+<leader>l | <F2> - NERDTree toggle
+<leader>e - NERDTree Find
+```
 Get it!
 --------------------
 ______________________________

File vim/autoload/buf_utils.vim

+" buf_identifier is either a buf_nr or a filename
+" If any window shows the buffer move to the buffer
+" If not show it in current window (by c-w s c^ you can always
+" reshow the last buffer
+"
+" Example: buf_utils#GotoBuf("/tmp/tfile.txt", {'create': 1})
+" returns: The command which was used to switch to the buffer
+fun! buf_utils#GotoBuf(buf_identifier, opts)
+  let buf_nr = bufnr(a:buf_identifier)
+  if buf_nr == -1 && ( get(a:opts, 'create', 0) || has_key(a:opts, 'create_cmd'))
+    exec get(a:opts,'create_cmd','e').' '.fnameescape(a:buf_identifier)
+    return "e"
+  else
+    let win_nr = bufwinnr(buf_nr)
+    if win_nr == -1
+      exec 'b '.buf_nr
+      return "b"
+    else
+      exec win_nr.'wincmd w'
+      return "w"
+    endif
+    wincmd w"
+  endif
+endf

File vim/autoload/cached_file_contents.vim

+" cached_file_contents.vim
+" @License:     GPL (see http://www.gnu.org/licenses/gpl.txt)
+" @Last Change: 2010-01-03.
+" @Revision:    0.3.0
+
+"exec vam#DefineAndBind('s:c','g:cache_dir_options','{}')
+if !exists('g:cache_dir_options') | let g:cache_dir_options = {} | endif | let s:c = g:cache_dir_options 
+
+let s:c['cache_dir'] = get(s:c, 'cache_dir', expand('$HOME').'/.vim-cache')
+let s:c['scanned_files'] = get(s:c, 'scanned_files', {})
+let s:scanned_files = s:c['scanned_files']
+
+
+let s:define_cache_file = "let this_dir = s:c['cache_dir'].'/cached-file-contents' | let cache_file = expand(this_dir.'/'.substitute(string([func_as_string, a:file]),'[[\\]{}:/\\,''\"# ]\\+','_','g'))"
+
+" read a file, run function to extract contents and cache the result returned
+" by that function in memory. Optionally the result can be cached on disk as
+" because VimL can be slow!
+"
+" file     : the file to be read
+" func: { 'func': function which will be called by funcref#Call
+"       , 'version' : if this version changes cache will be invalidate automatically
+"       , 'ftime_check': optional, default 1. if set to 0 cache isn't updated when file changes and file is in cache
+"       }
+"
+" default: what to return if file doesn't exist
+" think twice about adding lines. This function is called many times.
+function! cached_file_contents#CachedFileContents(file, func, ...) abort
+  let ignore_ftime = a:0 > 0 ? a:1 : 0
+  " using string for default so that is evaluated when needed only
+  let use_file_cache = get(a:func, 'use_file_cache', 0)
+
+  " simple kind of normalization. necessary when using file caching
+  " this seems to be slower:
+  " let file = fnamemodify(a:file, ':p') " simple kind of normalization. necessary when using file caching
+  " / = assume its an absolute path
+  " let file = a:file[0] == '/' ? a:file : expand(a:file, ':p')
+  let file = a:file[0] == '/' ? a:file : fnamemodify(a:file, ':p') " simple kind of normalization. necessary when using file caching
+  let func_as_string = string(a:func['func'])
+
+  if (!has_key(s:scanned_files, func_as_string))
+    let s:scanned_files[func_as_string] = {}
+  endif
+  let dict = s:scanned_files[func_as_string]
+  if use_file_cache && !has_key(dict, a:file)
+    exec s:define_cache_file
+    if filereadable(cache_file)
+      let dict[file] = eval(readfile(cache_file,'b')[0])
+    endif
+  endif
+  if has_key(dict, a:file)
+    let d = dict[a:file]
+    if use_file_cache
+          \ && (ignore_ftime || getftime(a:file) <= d['ftime'])
+          \ && d['version'] == a:func['version']
+      return dict[a:file]['scan_result']
+    endif
+  endif
+  let scan_result = funcref#Call(a:func['func'], [a:file] )
+  let  dict[a:file] = {"ftime": getftime(a:file), 'version': a:func['version'], "scan_result": scan_result }
+  if use_file_cache
+    if !exists('cache_file') | exec s:define_cache_file | endif
+    if !isdirectory(this_dir) | call mkdir(this_dir,'p',0700) | endif
+    call writefile([string(dict[a:file])], cache_file)
+  endif
+  return scan_result
+endfunction
+
+fun! cached_file_contents#ClearScanCache()
+  let s:c['scanned_files'] = {}
+
+  " Don't run rm -fr. Ask user to run it. It cache_dir may have been set to
+  " $HOME ! (should nevere be the case but who knows
+  echoe "run manually in your shell:  rm -fr ".shellescape(s:c['cache_dir'])."/*"
+endf
+
+fun! cached_file_contents#Test()
+
+  " usually you use a global option so that the function can be reused
+  let my_interpreting_func  = {'func' : funcref#Function('return len(readfile(ARGS[0]))'), 'version': 2, 'use_file_cache':1}
+  let my_interpreting_func2 = {'func' : funcref#Function('return ARGS[0]')               , 'version': 2, 'use_file_cache':1}
+
+  let tmp = tempname()
+  call writefile(['some text','2nd line'], tmp)
+
+  let r = [ cached_file_contents#CachedFileContents(tmp, my_interpreting_func)
+        \ , cached_file_contents#CachedFileContents(tmp, my_interpreting_func2) ]
+   if r != [2, tmp]
+    throw "test failed 1, got ".string(r)
+  endif
+  unlet r
+
+  sleep 3
+
+  " now let's change contents
+  call writefile(['some text','2nd line','3rd line'], tmp)
+
+  let r = cached_file_contents#CachedFileContents(tmp, my_interpreting_func)
+  if 3 != r
+    throw "test failed 2, got ".string(r)
+  endif
+
+  echo "test passed"
+endf

File vim/autoload/env_reload.vim

+" in sh/bash you can type export to get a list of environment variables
+" This function assigns those env vars to Vim.
+" Does not delete env vars yet
+" Example: env_reload#ReloadEnv(system("sh -c 'export'")
+fun! env_reload#ReloadEnv(bash_export_command_output)
+  for i in split(a:bash_export_command_output,"\n")
+    let m = matchlist(i, 'export \([^=]\+\)="\(.*\)"')
+    if empty(m) | continue | endif
+    " don't care about quoted values right now.
+    exec 'let $'.m[1].'='.string(m[2])
+  endfor
+endf

File vim/autoload/funcref.vim

+" funcref.vim
+" @License:     GPL (see http://www.gnu.org/licenses/gpl.txt)
+" @Last Change: 2010-01-03.
+" @Revision:    0.1.0
+
+" documentation see doc/funcref.txt
+
+" usage:
+"  funcref#Function("filename#Function")
+"  optionally pass arguments:
+"  funcref#Function("filename#Function",{'args': [2]})
+"  optionally define self:
+"  funcref#Function("filename#Function",{'self': object})
+function! funcref#Function(name,...)
+  let d = a:0 > 0 ? a:1 : {}
+  let d['faked_function_reference'] = a:name
+  return d
+endfunction
+
+" args : same as used for call(f,[args], self)
+" f must be either
+"   - a string which can be evaled (use "return 'value'" to return a value)
+"   - a Vim function reference created by function('..')
+"   - a faked function reference created by funcref#Function(..)
+"
+" the last "self" argument can be overriden by the function reference
+" You can pass arguments in a closure like style
+function! funcref#Call(...)
+  let args = copy(a:000)
+
+  " add parameters:
+  if (len(args) < 2)
+    call add(args, [])
+  endif
+
+
+  let isDict = type(args[0]) == type({})
+
+  " prepend parameters which were passed by faked function reference:
+  if isDict &&  has_key(args[0], 'args')
+    let args[1] = args[0]['args']+args[1]
+  endif
+
+  " always pass self. this way you can call functions from dictionaries not
+  " refering to self
+  if (len(args) < 3)
+    call add(args, {})
+  endif
+
+  " the funcref overrides self:
+  if isDict && has_key(args[0], 'self')
+    let args[2] = args[0]['self']
+  endif
+
+  if type(a:1) == 2
+    " funcref: function must have been laoded
+    return call(function('call'), args)
+  elseif isDict && has_key(args[0], 'faked_function_reference')
+    let Fun = args[0]['faked_function_reference']
+    if type(Fun) == type('')
+        \ && (Fun[:len('return ')-1] == 'return ' 
+              \ || Fun[:len('call ')-1] == 'call '
+              \ || Fun[:len('if ')-1] == 'if '
+              \ || Fun[:len('let ')-1] == 'let '
+              \ || Fun[:len('echo ')-1] == 'echo '
+              \ || Fun[:len('exec ')-1] == 'exec '
+              \ || Fun[:len('debug ')-1] == 'debug ')
+      " it doesn't make sense to list all vim commands here
+      " So if you want to execute another action consider using 
+      " funcref#Function('exec  '.string('aw')) or such
+
+      " function is a String, call exec
+      let ARGS = args[1]
+      let SELF = args[2]
+      exec Fun
+    else 
+      " pseudo function, let's load it..
+      if type(Fun) == 1
+        if !exists('*'.Fun)
+          " lazily load function
+          let file = substitute(substitute(Fun,'#[^#]*$','',''),'#','/','g')
+          exec 'runtime /autoload/'.file.'.vim'
+        endif
+        let Fun2 = function(Fun)
+      else
+        let Fun2 = Fun
+      endif
+      let args[0] = Fun
+      return call(function('call'), args)
+    endif
+  else
+    " no function, return the value
+    return args[0]
+  endif
+endfunction

File vim/autoload/glob.vim

+exec vam#DefineAndBind('s:c','g:glob_like', '{}')
+
+" ignore vcs stuff, Don't think you want those..
+let s:c['regex_ignore_directory'] = '\<\%([_.]darcs\|\.git\|.svn\|.hg\|.cvs\|.bzr\)\>'
+let s:c['glob_cache'] = get(s:c, 'glob_cache', {})
+let s:glob_cache = s:c['glob_cache']
+
+fun! glob#Glob(pattern, ...)
+  let pattern = a:pattern
+  if pattern[0] == '~'
+    let pattern = $HOME.pattern[1:]
+  endif
+  let opts = a:0 > 0 ? a:1 : {}
+  " never cache current directory. You're very likely to edit files in it.
+
+  let c = getcwd()
+  let cachable = get(opts, 'cachable', 0) && pattern[:len(c)-1] != c
+  if cachable && has_key(s:glob_cache, pattern)
+    return s:glob_cache[pattern]
+  endif
+
+  " FIXME: don't recurse into \.git directory (thus reimplement glob in vimL!)
+  let r = filter(split(glob(pattern),"\n"),'v:val !~ '.string(s:c['regex_ignore_directory']))
+  if cachable | let s:glob_cache[pattern]  = r | endif
+  return r
+endf
+

File vim/autoload/snipMate.vim

+" config which can be overridden (shared lines)
+if !exists('g:snipMate')
+  let g:snipMate = {}
+endif
+let s:c = g:snipMate
+
+try
+	call tlib#input#List('mi', '', [])
+catch /.*/
+	echoe "you're missing tlib. See install instructions at ".expand('<sfile>:h:h').'/README.rst'
+endtry
+
+" match $ which doesn't follow a \
+let s:d = '\%([\\]\@<!\$\)'
+
+
+" disable write cache in files
+" some people get errors about writing the cache files. Probably there is no
+" pay off having slow disks anyway. So disabling the cache by default
+let s:c.cache_parsed_snippets_on_disk = get(s:c, 'cache_parsed_snippets_on_disk', 0)
+let s:c.read_snippets_cached = get(s:c, 'read_snippets_cached', {'func' : function('snipMate#ReadSnippetsFile'), 'version': 3, 'use_file_cache': s:c.cache_parsed_snippets_on_disk})
+
+" if filetype is objc, cpp, cs or cu also append snippets from scope 'c'
+" you can add multiple by separating scopes by ',', see s:AddScopeAliases
+" TODO add documentation to doc/*
+let s:c.scope_aliases = get(s:c, 'scope_aliases', {})
+let s:c.scope_aliases.objc = get(s:c.scope_aliases, 'objc', 'c')
+let s:c.scope_aliases.cpp = get(s:c.scope_aliases, 'cpp', 'c')
+let s:c.scope_aliases.cu = get(s:c.scope_aliases, 'cu', 'c')
+let s:c.scope_aliases.xhtml = get(s:c.scope_aliases, 'xhtml', 'html')
+let s:c.scope_aliases.html = get(s:c.scope_aliases, 'html', 'javascript')
+let s:c.scope_aliases.php = get(s:c.scope_aliases, 'php', 'php,html,javascript')
+let s:c.scope_aliases.ur = get(s:c.scope_aliases, 'ur', 'html,javascript')
+let s:c.scope_aliases.mxml = get(s:c.scope_aliases, 'mxml', 'actionscript')
+let s:c.scope_aliases.eruby = get(s:c.scope_aliases, 'eruby', 'eruby-rails,html')
+
+" set this to "\<tab>" to make snipmate not swallow tab (make sure to not have
+" expandtab set). Remember that you can always enter tabs by <c-v> <tab> then
+" you don't need this
+let s:c['no_match_completion_feedkeys_chars'] = get(s:c, 'no_match_completion_feedkeys_chars', "\t")
+
+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
+
+let s:state_proto = {}
+
+fun! s:state_proto.remove()
+	unlet! b:snip_state
+	" Remove all buffer-local autocommands in the snipmate_changes group
+	au! snipmate_changes * <buffer>
+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, ''.s:d .'\d\+\|'.s: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 b:snip_state = copy(s:state_proto)
+	let [b:snip_state.stops, b:snip_state.stop_count] = s:BuildTabStops(snippet, lnum, col - indent, indent)
+
+	if b:snip_state.stop_count
+		aug snipmate_changes
+			au CursorMovedI,InsertEnter <buffer> call b:snip_state.update_changes()
+		aug END
+		call b:snip_state.set_stop(0)
+
+		return b:snip_state.select_word()
+	else
+		unlet b:snip_state
+		" 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
+
+" Update state information to correspond to the given tab stop
+function! s:state_proto.set_stop(stop)
+	let self.stop_no   = a:stop
+	let self.cur_stop  = self.stops[self.stop_no]
+	let self.end_col   = self.cur_stop[1] + self.cur_stop[2]
+	let self.start_col = self.cur_stop[1]
+	call cursor(self.cur_stop[0], self.cur_stop[1])
+	let self.prev_len  = col('$')
+	let self.has_vars  = exists('self.cur_stop[3]')
+	let self.old_vars  = self.has_vars ? deepcopy(self.cur_stop[3]) : []
+endfunction
+
+" Prepare snippet to be processed by s:BuildTabStops
+fun! s:ProcessSnippet(snip)
+	let snippet = a:snip
+
+	if exists('g:snipmate_content_visual')
+		let visual = g:snipmate_content_visual | unlet g:snipmate_content_visual
+	else
+		let visual = ''
+	endif
+	let snippet = substitute(snippet,'{VISUAL}', escape(visual,'%\'), 'g')
+
+	" Evaluate eval (`...`) expressions.
+	" Backquotes prefixed with a backslash "\" are ignored.
+	" And backslash can be escaped by doubling it.
+	" Using a loop here instead of a regex fixes a bug with nested "\=".
+	if stridx(snippet, '`') != -1
+		let new = []
+		let snip = split(snippet, '\%(\\\@<!\%(\\\\\)*\)\@<=`', 1)
+		let isexp = 0
+		for i in snip
+			if isexp
+				call add(new, substitute(eval(i), "\n\\%$", '', ''))
+			else
+				call add(new, i)
+			endif
+			let isexp = !isexp
+		endfor
+		let snippet = join(new, '')
+		let snippet = substitute(snippet, "\r", "\n", 'g')
+		let snippet = substitute(snippet, '\\`', "`", '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, s:d.'{\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 snippet =~ s:d.'{'.i
+		let s = matchstr(snippet, s:d.'{'.i.':\zs.\{-}\ze}')
+		if s != ''
+			let snippet = substitute(snippet, s:d.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).
+" 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 a:snip =~ s:d.'{'.i
+		let beforeTabStop = matchstr(withoutVars, '^.*\ze'.s:d .'{'.i.'\D')
+		let withoutOthers = substitute(withoutVars, ''.s:d .'{\('.i.'\D\)\@!\d\+.\{-}}', '', 'g')
+
+		let j = i - 1
+		call add(snipPos, [0, 0, 0])
+		let snipPos[j][0] = a:lnum + s:Count(beforeTabStop, "\n")
+		let snipPos[j][1] = a:indent + len(matchstr(withoutOthers, '.*\(\n\|^\)\zs.*\ze'.s:d .'{'.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 withoutVars =~ ''.s:d .'{'.i.':'
+			let snipPos[j][2] = len(matchstr(withoutVars, ''.s:d .'{'.i.':\zs.\{-}\ze}'))
+			let dots = repeat('.', snipPos[j][2])
+			call add(snipPos[j], [])
+			let withoutOthers = substitute(a:snip, ''.s:d .'{\d\+.\{-}}\|'.s:d .''.i.'\@!\d\+', '', 'g')
+			while match(withoutOthers, ''.s:d .''.i.'\(\D\|$\)') != -1
+				let beforeMark = matchstr(withoutOthers, '^.\{-}\ze'.dots.''.s:d .''.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, ''.s:d .''.i.'\ze\(\D\|$\)', '', '')
+			endw
+		endif
+		let i += 1
+	endw
+	return [snipPos, i - 1]
+endf
+
+function! s:state_proto.jump_stop(backwards)
+	" Update changes just in case
+	" This seems to be only needed because insert completion does not trigger
+	" the CursorMovedI event
+	call self.update_changes()
+
+	" Update stop and var locations
+	call self.update_stops()
+
+	" Store the changed col/length of the current stop
+	let self.cur_stop[1] = self.start_col
+	let self.cur_stop[2] = self.end_col - self.start_col
+
+	let self.stop_no += a:backwards ? -1 : 1
+	" Loop over the snippet when going backwards from the beginning
+	if self.stop_no < 0 | let self.stop_no = self.stop_count - 1 | endif
+
+	if self.stop_no == self.stop_count
+		call self.remove()
+		return -1
+	endif
+
+	call self.set_stop(self.stop_no)
+	return self.select_word()
+endfunction
+
+" Updates tab stops/vars
+function! s:state_proto.update_stops()
+	let changeLen = self.end_col - self.cur_stop[2] - self.start_col
+	" 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 self.stops
+			if pos == self.cur_stop | continue | endif
+			let changed = pos[0] == curLine && pos[1] > self.start_col
+			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 self.old_vars
+				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
+			" Parse variables within placeholders, e.g., "${1:foo} ${2:$1bar}"
+			let pos[2] += changeLen * changedVars
+
+			" Do the same to any placeholders in the other tab stops.
+			if exists('pos[3]')
+				for nPos in pos[3]
+					let changed = nPos[0] == curLine && nPos[1] > self.start_col
+					for [lnum, col] in self.old_vars
+						if lnum > nPos[0] | break | endif
+						if nPos[0] == lnum && nPos[1] > col
+							let changed += 1
+						endif
+					endfor
+					let nPos[1] += changeLen * changed
+				endfor
+			endif
+		endfor
+	endif
+endfunction
+
+" Select the placeholder for the current tab stop
+function! s:state_proto.select_word()
+	let len = self.cur_stop[2]
+	if !len | return '' | endif
+	let l = col('.') != 1 ? 'l' : ''
+	if &sel == 'exclusive'
+		return "\<esc>".l.'v'.len."l\<c-g>"
+	endif
+	return len == 1 ? "\<esc>".l.'gh' : "\<esc>".l.'v'.(len - 1)."l\<c-g>"
+endfunction
+
+" Update the snippet as text is typed. The self.update_vars() function does
+" the actual work.
+" If the cursor moves outside of a placeholder, call self.remove()
+function! s:state_proto.update_changes()
+	let change_len = col('$') - self.prev_len
+	let self.end_col += change_len
+
+	let col = col('.')
+	if line('.') != self.cur_stop[0] || col < self.start_col || col > self.end_col
+		call self.remove()
+	endif
+
+	if self.has_vars
+		call self.update_vars(change_len)
+	endif
+
+	let self.prev_len = col('$')
+endfunction
+
+" Actually update the vars for any changed text
+function! s:state_proto.update_vars(change)
+	let newWordLen = self.end_col - self.start_col
+	let newWord = strpart(getline('.'), self.start_col - 1, newWordLen)
+	let changeLen = a:change
+	let curLine = line('.')
+	let oldStartSnip = self.start_col
+	let updateTabStops = changeLen != 0
+	let i = 0
+
+	for [lnum, col] in self.cur_stop[3]
+		if updateTabStops
+			let start = self.start_col
+			if lnum == curLine && col <= start
+				let self.start_col += changeLen
+				let self.end_col += changeLen
+			endif
+			for nPos in self.cur_stop[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 self.cur_stop[3][i][1] = col
+			endif
+			let i += 1
+		endif
+
+		let theline = getline(lnum)
+		" subtract -1 to go from column byte index to string byte index
+		" subtract another -1 to exclude the col'th element
+		call setline(lnum, theline[0:(col-2)] . newWord . theline[(col+self.end_col-self.start_col-a:change-1):])
+	endfor
+
+	" Reposition the cursor in case a var updates on the same line but before
+	" the current tabstop
+	if oldStartSnip != self.start_col
+		call cursor(0, col('.') + self.start_col - oldStartSnip)
+	endif
+endfunction
+
+" should be moved to utils or such?
+fun! snipMate#SetByPath(dict, path, value)
+	let d = a:dict
+	for p in a:path[:-2]
+		if !has_key(d,p) | let d[p] = {} | endif
+		let d = d[p]
+	endfor
+	let d[a:path[-1]] = a:value
+endf
+
+" reads a .snippets file
+" returns list of
+" ['triggername', 'name', 'contents']
+" if triggername is not set 'default' is assumed
+fun! snipMate#ReadSnippetsFile(file)
+	let result = []
+	if !filereadable(a:file) | return result | endif
+	let r_guard = '^guard\s\+\zs.*'
+	let inSnip = 0
+	let guard = 1
+	for line in readfile(a:file) + ["\n"]
+		if inSnip == 2 && line =~ r_guard
+			let guard = matchstr(line, r_guard)
+		elseif inSnip && (line[0] == "\t" || line == '')
+			let content .= strpart(line, 1)."\n"
+			continue
+		elseif inSnip
+			call add(result, [trigger, name == '' ? 'default' : name, content[:-2], guard])
+			let inSnip = 0
+			let guard = "1"
+		endif
+
+		if inSnip == 2
+			let inSnip = 1
+		endif
+		if line[:6] == 'snippet'
+			" 2 signals first line
+			let inSnip = 2
+			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
+	return result
+endf
+
+" adds scope aliases to list.
+" returns new list
+" the aliases of aliases are added recursively
+fun! s:AddScopeAliases(list)
+  let did = {}
+  let scope_aliases = get(s:c,'scope_aliases', {})
+  let new = a:list
+  let new2 =  []
+  while !empty(new)
+	for i in new
+	  if !has_key(did, i)
+		let did[i] = 1
+		call extend(new2, split(get(scope_aliases,i,''),','))
+	  endif
+	endfor
+	let new = new2
+	let new2 = []
+  endwhile
+  return keys(did)
+endf
+
+" don't ask me wy searching for trigger { is soo slow.
+fun! s:Glob(dir,  file)
+	let f = a:dir.a:file
+	if a:dir =~ '\*' || isdirectory(a:dir)
+		" vim's glob() is somewhat unreliable since it uses the
+		" user's current shell which may accept different patterns
+		" (POSIX vs. zsh vs. bash vs. ...). On my system, that
+		" leads to glob() sometimes returning files that don't
+		" exist, so filter the returned list to make sure that the
+		" files really exist in the filesystem.
+		let res = split(glob(escape(f,"{}")), "\n")
+
+		if !empty(res)
+			return filter(res, 'filereadable(v:val)')
+		else
+			return []
+		endif
+	else
+		return filereadable(f) ? [f] : []
+	endif
+endf
+
+" returns dict of
+" { path: { 'type': one of 'snippet' 'snippets',
+"           'exists': 1 or 0
+"           " for single snippet files:
+"           'name': name of snippet
+"           'trigger': trigger of snippet
+"         }
+" }
+" use trigger = '*' to match all snippet files
+" use mustExist = 1 to return existing files only
+"
+"     mustExist = 0 is used by OpenSnippetFiles
+fun! snipMate#GetSnippetFiles(mustExist, scopes, trigger)
+  let paths = funcref#Call(s:c.snippet_dirs)
+
+  let result = {}
+  let scopes = s:AddScopeAliases(a:scopes)
+
+  " collect existing files
+  for scope in scopes
+
+	for r in paths
+	  let rtp_last = fnamemodify(r,':t')
+
+	  " .snippets files (many snippets per file).
+	  let glob_p = r.'/snippets/'.scope.'.snippets'
+	  for snippetsF in split(glob(glob_p),"\n")
+		let scope = fnamemodify(snippetsF,':t:r')
+		let result[snippetsF] = {'exists': 1, 'type': 'snippets', 'name_prefix': rtp_last.' '.scope }
+	  endfor
+
+	  if !a:mustExist && !has_key(result, glob_p)
+		" name_prefix not used
+		let result[glob_p] = {'exists': 0, 'type': 'snippets'}
+	  endif
+
+	  let glob_p = r.'/snippets/'.scope.'/*.snippets'
+	  for snippetsF in split(glob(glob_p),"\n")
+		let result[snippetsF] = {'exists': 1, 'type': 'snippets', 'name_prefix' : rtp_last.' '.fnamemodify(snippetsF,':t:r')}
+	  endfor
+
+	  " == one file per snippet: ==
+
+	  " without name snippets/<filetype>/<trigger>.snippet
+	  for f in s:Glob(r.'/snippets/'.scope,'/'.a:trigger.'.snippet')
+		let trigger = fnamemodify(f,':t:r')
+		let result[f] = {'exists': 1, 'type': 'snippet', 'name': 'default', 'trigger': trigger, 'name_prefix' : rtp_last.' '.scope}
+	  endfor
+	  " add /snippets/trigger/*.snippet files (TODO)
+
+	  " with name (multi-snip) snippets/<filetype>/<trigger>/<name>.snippet
+	  for f in s:Glob(r.'/snippets/'.scope.'/'.a:trigger,'/*.snippet')
+		let name = fnamemodify(f,':t:r')
+		let trigger = fnamemodify(f,':h:t')
+		let result[f] = {'exists': 1, 'type': 'snippet', 'name': name, 'trigger': trigger, 'name_prefix' : rtp_last.' '.scope}
+	  endfor
+	endfor
+  endfor
+  return result
+endf
+
+fun! snipMate#EvalGuard(guard)
+	" left: everything left of expansion 
+	" word: the expanded word
+	" are guaranteed to be in scpe
+
+	if a:guard == '1' | return 1 | endif
+	let word = s:c.word
+	" eval is evil, but backticks are allowed anyway.
+	let left = getline('.')[:col('.')-3 - len(word)]
+	exec 'return '.a:guard
+endf
+
+" default triggers based on paths
+fun! snipMate#DefaultPool(scopes, trigger, result)
+	let triggerR = substitute(a:trigger,'*','.*','g')
+	for [f,opts] in items(snipMate#GetSnippetFiles(1, a:scopes, a:trigger))
+		if opts.type == 'snippets'
+			for [trigger, name, contents, guard] in cached_file_contents#CachedFileContents(f, s:c.read_snippets_cached, 0)
+				if trigger !~ escape(triggerR,'~') | continue | endif
+				if snipMate#EvalGuard(guard)
+					call snipMate#SetByPath(a:result, [trigger, opts.name_prefix.' '.name], contents)
+				endif
+			endfor
+		elseif opts.type == 'snippet'
+			call snipMate#SetByPath(a:result, [opts.trigger, opts.name_prefix.' '.opts.name], funcref#Function('return readfile('.string(f).')'))
+		else
+			throw "unexpected"
+		endif
+	endfor
+endf
+
+" return a dict of snippets found in runtimepath matching trigger
+" scopes: list of scopes. usually this is the filetype. eg ['c','cpp']
+" trigger may contain glob patterns. Thus use '*' to get all triggers
+"
+fun! snipMate#GetSnippets(scopes, trigger)
+	let result = {}
+	let triggerR = escape(substitute(a:trigger,'*','.*','g'), '~') " escape '~' for use as regexp
+	" let scopes = s:AddScopeAliases(a:scopes)
+
+	for F in values(g:snipMateSources)
+	  call funcref#Call(F, [a:scopes, a:trigger, result])
+	endfor
+	return result
+endf
+
+" adds leading tab
+" and replaces leading spaces by tabs
+" see ftplugin/snippet.vim
+fun! snipMate#RetabSnip() range
+  let leadingTab = expand('%:e') == 'snippets'
+
+  let lines = getline(a:firstline, a:lastline)
+
+  " remove leading "\t"
+  let allIndented = 1
+  for l in lines
+	if l[0] != '\t' | let allIndented = 0 | endif
+  endfor
+
+  " retab
+  if allIndented
+	call map(lines, 'v:val[1:]')
+  endif
+
+  let leadingSp = filter(map(copy(lines),'matchstr(v:val,"^\\s*") '),'v:val !=""')
+  if !empty(leadingSp)
+	" lines containing leading spaces found
+	let smallestInd =  len(sort(leadingSp)[-1])
+	let ind = input('retab, spaces per tab: ', smallestInd)
+	for i in range(0, len(lines)-1)
+	  let ml = matchlist(lines[i], '^\(\s*\)\(.*\)')
+	  let lines[i] = repeat("\t", len(ml[1]) / ind)
+				 \ . repeat( " ", len(ml[1]) % ind)
+				 \ . ml[2]
+	endfor
+  endif
+  " readd tab
+  let tab = leadingTab ? "\t" : ""
+  for i in range(0,len(lines)-1)
+	call setline(a:firstline + i, tab.lines[i])
+  endfor
+endf
+
+fun! snipMate#OpenSnippetFiles()
+  let dict = snipMate#GetSnippetFiles(0, snipMate#ScopesByFile(), '*')
+  " sort by files wether they exist - put existing files first
+  let exists = []
+  let notExists = []
+  for [file, v] in items(dict)
+	let v['file'] = file
+	if v['exists']
+	  call add(exists, v)
+	else
+	  call add(notExists, v)
+	endif
+  endfor
+  let all = exists + notExists
+  let show = map(copy(all),'(v:val["exists"] ? "exists:" : "does not exist yet:")." ".v:val["file"]')
+  let select = tlib#input#List('mi', 'select files to be opened in splits', show)
+  for idx in select
+	exec 'sp '.all[idx - 1]['file']
+  endfor
+endf
+
+fun! snipMate#ScopesByFile()
+	" duplicates are removed in AddScopeAliases
+	return filter(funcref#Call(s:c.get_scopes), "v:val != ''")
+endf
+
+" used by both: completion and insert snippet
+fun! snipMate#GetSnippetsForWordBelowCursor(word, suffix, break_on_first_match)
+	" Setup lookups: '1.2.3' becomes [1.2.3] + [3, 2.3]
+	let parts = split(a:word, '\W\zs')
+	if len(parts) > 2
+		let parts = parts[-2:] " max 2 additional items, this might become a setting
+	endif
+	let lookups = [a:word.a:suffix]
+	let lookup = ''
+	for w in reverse(parts)
+		let lookup = w . lookup
+		if index(lookups, lookup) == -1
+			call add(lookups, lookup.a:suffix)
+		endif
+	endfor
+
+	" allow matching '.'
+	if a:word =~ '\.$'
+		call add(lookups, '.'.a:suffix)
+	endif
+
+	call filter(lookups, 'v:val != ""')
+	" echo lookups
+
+	let matching_snippets = []
+	let snippet = ''
+	" prefer longest word
+	for word in lookups
+		let s:c.word = word
+		" echomsg string(lookups).' current: '.word
+		for [k,snippetD] in items(funcref#Call(s:c['get_snippets'], [snipMate#ScopesByFile(), word]))
+			if a:suffix == ''
+				" hack: require exact match
+				if k !=# word | continue | endif
+			endif
+			call add(matching_snippets, [k, snippetD])
+			if a:break_on_first_match | break| endif
+		endfor
+	endfor
+	return matching_snippets
+endf
+
+" snippets: dict containing snippets by name
+" usually this is just {'default' : snippet_contents }
+fun! s:ChooseSnippet(snippets)
+	let snippet = []
+	let keys = keys(a:snippets)
+	let i = 1
+	for snip in keys
+		let snippet += [i.'. '.snip]
+		let i += 1
+	endfor
+	if len(snippet) == 1
+		" there's only a single snippet, choose it
+		let idx = 0
+	else
+		let idx = tlib#input#List('si','select snippet by name',snippet) -1
+		if idx == -1
+			return ''
+		endif
+	endif
+	" if a:snippets[..] is a String Call returns it
+	" If it's a function or a function string the result is returned
+	return funcref#Call(a:snippets[keys(a:snippets)[idx]])
+endf
+
+fun! snipMate#ShowAvailableSnips()
+	let col   = col('.')
+	let word  = matchstr(getline('.'), '\S\+\%'.col.'c')
+
+	let snippets = map(snipMate#GetSnippetsForWordBelowCursor(word, '*', 0),'v:val[0]')
+	let matches = filter(snippets, "v:val =~# '\\V\\^" . escape(word, '\') . "'")
+
+	" Pretty hacky, but really can't have the tab swallowed!
+	if len(matches) == 0
+		call feedkeys(s:c['no_match_completion_feedkeys_chars'], 'n')
+		return ""
+	endif
+
+	call complete(col - len(word), sort(matches))
+	return ''
+endf
+
+
+" user interface implementation {{{1
+
+fun! snipMate#TriggerSnippet()
+	if exists('g:SuperTabMappingForward')
+		if g:SuperTabMappingForward == "<tab>"
+			let SuperTabPlug = maparg('<Plug>SuperTabForward', 'i')
+			if SuperTabPlug == ""
+				let SuperTabKey = "\<c-n>"
+			else
+				exec "let SuperTabKey = \"" . escape(SuperTabPlug, '<') . "\""
+			endif
+		elseif g:SuperTabMappingBackward == "<tab>"
+			let SuperTabPlug = maparg('<Plug>SuperTabBackward', 'i')
+			if SuperTabPlug == ""
+				let SuperTabKey = "\<c-p>"
+			else
+				exec "let SuperTabKey = \"" . escape(SuperTabPlug, '<') . "\""
+			endif
+		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('b:snip_state')
+		let jump = b:snip_state.jump_stop(0)
+		if type(jump) == 1 " returned a string
+			return jump
+		endif
+	endif
+
+	let word = matchstr(getline('.'), '\S\+\%'.col('.').'c')
+	let list = snipMate#GetSnippetsForWordBelowCursor(word, '',  1)
+	if empty(list)
+		let snippet = ''
+	else
+		let [trigger, snippetD] = list[0]
+
+		let s = s:ChooseSnippet(snippetD)
+		if type(s) == type([])
+			let snippet = join(s, "\n")
+		else
+			let snippet = s
+		end
+
+		" Before expanding snippet, create new undo point |i_CTRL-G|
+		let &undolevels = &undolevels
+		let col = col('.') - len(trigger)
+		sil exe 's/\V'.escape(trigger, '/\.').'\%#//'
+		return snipMate#expandSnip(snippet, col)
+	endif
+
+	" should allow other plugins to register hooks instead (duplicate code)
+	if exists('SuperTabKey')
+		call feedkeys(SuperTabKey)
+		return ''
+	endif
+	return word == ''
+	  \ ? "\<tab>"
+	  \ : "\<c-r>=snipMate#ShowAvailableSnips()\<cr>"
+endf
+
+
+fun! snipMate#BackwardsSnippet()
+	if exists('b:snip_state') | return b:snip_state.jump_stop(1) | endif
+
+	if exists('g:SuperTabMappingForward')
+		if g:SuperTabMappingForward == "<s-tab>"
+			let SuperTabPlug = maparg('<Plug>SuperTabForward', 'i')
+			if SuperTabPlug == ""
+				let SuperTabKey = "\<c-n>"
+			else
+				exec "let SuperTabKey = \"" . escape(SuperTabPlug, '<') . "\""
+			endif
+		elseif g:SuperTabMappingBackward == "<s-tab>"
+			let SuperTabPlug = maparg('<Plug>SuperTabBackward', 'i')
+			if SuperTabPlug == ""
+				let SuperTabKey = "\<c-p>"
+			else
+				exec "let SuperTabKey = \"" . escape(SuperTabPlug, '<') . "\""
+			endif
+		endif
+	endif
+	" should allow other plugins to register hooks instead (duplicate code)
+	if exists('SuperTabKey')
+		call feedkeys(SuperTabKey)
+		return ''
+	endif
+	return "\<s-tab>"
+endf
+
+
+" vim:noet:sw=4:ts=4:ft=vim

File vim/autoload/tiny_cmd.vim

+" vim suffers:
+
+exec vam#DefineAndBind('s:c','g:vim_tiny_cmd', '{}')
+
+fun! tiny_cmd#Put(a)
+  let new = get(s:c,'next',0) +1
+  let s:c['next'] = new
+  let s:c[new] = a:a
+  return new
+endf
+
+fun! tiny_cmd#Get(nr)
+  return s:c[a:nr]
+endf
+
+" Get and remove item
+fun! tiny_cmd#Pop(nr)
+  let r = s:c[a:nr] | unlet s:c[a:nr] | return r
+endf

File vim/autoload/tovl/scratch_buffer.vim

+" old code
+
+augroup TOVLWrite
+augroup end
+
+" =========== scratch buffer =========================================
+" a scratch buffer is a temporary buffer where the user can enter some text
+" It can be used to get commit messages, edit configuration options and so on
+
+function! tovl#scratch_buffer#KeepIntactLineNr()
+  let i = 0
+  while getline(i)!= b:keepIntact && i < line('$')
+    let i = i+1
+  endwhile
+  if i > line('$')
+    return -1
+  else
+    return i
+  endif
+endfunction
+
+" opens a buffer and runs an action when the buffer is written
+" keys: 
+"  name :   the name of the buffer
+"  onWrite : will be called on write
+"            onWrite is responsible for setlocal nomodified to indicate that
+"            saving has been successful
+"  help  : callback returning additional information lines
+"  getContent : callback returning lines
+"  cmds    : extra commands to be run (optional)
+"            (maybe you prefer adding them the default way afer the
+"            ScratchBuffer call. They'll be rerun on GetContents
+"  sp_cmd  : the command to use to create the new buffer. Defaults to :e
+"  buftype : ...
+"  modifiable : 1 / 0 defaults to 1
+function! tovl#scratch_buffer#ScratchBuffer(opts)
+  let a:opts['name'] = get(a:opts,'name', 'strach_buffer_without_name')
+  exec get(a:opts, 'sp_cmd', 'e').' '.escape(a:opts['name'],' ')
+  let b:settings = a:opts
+  let b:settings['modifiable'] = get(a:opts,'modifiable', 1)
+  setlocal buftype=acwrite
+  command! -buffer -nargs=0 Help call tovl#scratch_buffer#Help()
+
+  " setup write notification
+  au TOVLWrite BufWriteCmd <buffer> call tovl#scratch_buffer#Write()
+
+  if has_key(a:opts,'getContent')
+    command! -buffer -nargs=0 GetContents call tovl#scratch_buffer#GetContents()
+    GetContents
+    if !b:settings['modifiable']
+      setlocal nomodifiable
+    endif
+  endif
+  "let u=&undolevels
+  "setlocal undolevels=-1
+  "exec 'setlocal undolevels='.u
+
+  " mark buffer as not modified
+  setlocal nomodified
+
+  au BufReadCmd <buffer> GetContents
+
+  " run addittional commands
+  for cmd in get(a:opts,'cmds',[])
+    exec cmd
+  endfor
+  silent echo get(a:opts,'echo_help', "type :Help for help")
+endfunction
+
+" =========== utility functions ======================================
+
+function! tovl#scratch_buffer#Write()
+  if has_key(b:settings, 'onWrite')
+    call funcref#Call(b:settings['onWrite'])
+  else
+    echo "don't know how to write. Option hasn't been passed"
+  endif
+endfunction
+
+function! tovl#scratch_buffer#GetContents()
+  setlocal modifiable
+  " empty buffer
+  %g!//d
+  call append(0, funcref#Call(b:settings['getContent']))
+  if !b:settings['modifiable']
+    setlocal nomodifiable
+  endif
+  for cmd in get(b:settings,'cmds',[])
+    exec cmd
+  endfor
+endfunction
+
+function! tovl#scratch_buffer#Help()
+  let help = ["use :e! to reload contents, ZZ or :w(q) to write and quit"
+          \ ,""
+          \ ,"Help for this scratch buffer:"
+          \ ,"=======================================================","",""]
+    \ + funcref#Call(get(b:settings, 'help', []))
+  call tovl#scratch_buffer#ScratchBuffer({
+        \ 'name' : "return Help of ".b:settings['name'],
+        \ 'getContent' : help
+        \ })
+endfunction

File vim/autoload/tovl/ui/filter_list.vim

+" OLD CODE !
+" I should contribute the multiple filter feature to tlib
+
+" filter list displays a list of items
+" you can white / black filter them by regular expressions (similar to the
+" tlib TToC command
+" However you can edit the filters afterwards and select the cols which should
+" be shown
+
+fun! tovl#ui#filter_list#ListTest()
+  call tovl#ui#filter_list#ListView({
+	\ 'aligned' : 1,
+	\ 'Continuation' : funcref#Function('echo string(ARGS[0])'),
+	\ 'items' : [ {"aa" : "a\nAAAAAAAAAAA", 'bb' : "bbbbbbbbbbbbb\nB" }, 
+		   \  {"aa" : "2a\n2AAAAAAAAAAAA", "bb" : "2 bbbbbbbbbbbbb\n2B"},
+		   \  {"aa" : "XXX", "bb" : "YY"} ],
+	\ })
+
+endfun
+
+fun! s:Intersection(a, b)
+  return filter(copy(a:a), 'index(a:b, v:val) >= 0')
+endf
+
+fun! tovl#ui#filter_list#ListTestGotoLineCurrentBuf()
+  let nr=1
+  let lines = []
+  for l in getline(0,line('$'))
+    call add(lines, {'nr': nr, 'line' :l})
+    let nr = nr +1
+  endfor
+  call tovl#ui#filter_list#ListView({
+	\ 'aligned' : 0,
+	\ 'keys' : ['nr','line'],
+	\ 'number' : 1,
+	\ 'selectByIdOrFilter' : 1,
+	\ 'Continuation' : funcref#Function('exec ARGS[0]["nr"]'),
+	\ 'items' : lines,
+	\ })
+endfun
+
+" opens a new filtered list
+" keys of opts parameters:
+" Continuation: This function will be called with the selected items
+" items: { key : (string or dict) }
+"        items willl be modified. use copy(youritems) as argument to prevent
+"        this. An item is either a string or a dict 
+"        (eg {'file' : .., 'line': ... , 'msg' : .. )
+" keys: list of keys to be shown (optional)
+" filter: list of inital filters which must be applied
+" contains [ { filter: .. , keep : .. }, ] see FilterItems() below
+" aligned: default 0
+" sp_cmd: the command to be used to create the new buffer (default ':e')
+" init : 0 / 1 (default 1): wether to show the view right now
+" number: 0 /1 (default 1): number items ?
+" selectByIdOrFilter: 1: start in getchar() loop so that the user can select
+"                        the item even faster
+"                     auto: only do this if all items fit on screen
+"                     (recommend)
+" cmds: extra cmds to be run
+" cursorAt : at which item to put the cursor?
+"
+" If you don't like the default view you can override UpdateDisplay
+"
+" Usage examples of this list control:
+" - db results
+" - replacement of the quickfix window
+" - select a buffer etc
+fun! tovl#ui#filter_list#ListView(opts)
+  " ActivateAddons theonevimlib
+  let d = {}
+  let d.items = a:opts.items
+  let d.cursorAt = get(a:opts, 'cursorAt', 0)
+  let d.aligned = get(a:opts, 'aligned', 0)
+  let d.sep = '  '
+  let d.filter = get(a:opts, 'filter', [])
+  " using sp because of bd! (FIXME)
+  let d.sp_cmd = get(a:opts, 'sp_cmd', 'sp')
+  let d.allKeys = {}
+  let d.closeOnContinuation = get(a:opts,'closeOnContinuation',1)
+  " don't recommend OnSingleMatch, use OnSingleMatchCR instead
+  let d.continueOnSingleMatch = get(a:opts, 'continueOnSingleMatch',0)
+  let d.continueOnSingleMatchCR = get(a:opts, 'continueOnSingleMatchCR',1)
+  let d.selectByIdOrFilter = get(a:opts, 'selectByIdOrFilter', 0)
+  let d.linesToItems = {}
+  let d.number = get(a:opts, 'number', 1)
+  let d.cmds = get(a:opts, 'cmds', [])
+  let d.syn_cmds = get(a:opts, 'syn_cmds', [])
+
+  if has_key(a:opts,'keys') | let d.keys = a:opts.keys | endif
+  if has_key(a:opts,'Continuation') | let d.Continuation = a:opts.Continuation | endif
+
+  " cache already filtered items in case we want to view really long results
+  " contains [ { filter : { regex: .. , keep : .. } , items : .. , cursorAt :}, 
+  "            { filter : { ... } , items: .. , cursorAt : }
+  let d.cached = []
+  " id of buffer
+  let d.buffer = -1
+  let d.modeText = ''
+
+  fun d.HelpText()
+    return [ "you've entered the the help of the powerful filtered view buffer",
+	   \ "",
+	   \ "type f to start filtering items by regex",
+	   \ "type F to start dropping items by regex",
+	   \ "k / K will ask you for the key to apply the filter to first",
+	   \ "apply the filter by <cr> and press <cr> again to select item",
+	   \ "",
+	   \ "use :ShowAppliedFilters to list active filters",
+	   \ "use :ToggleAlignment to toggle alignment",
+	   \ "",
+	   \ "TODO: Implement sorting, implement interface to change keys (displayed columns)"
+	   \ ]
+  endfun
+
+  " create new scratch buffer
+  " preprocess items calculating line count and maxwidth for all items
+  fun d.NewBufferAndInit()
+    let self.bufferId = bufnr(bufname('%'))
+    for idx in range(0,len(self.items)-1)
+      if type(self.items[idx]) != 4
+	" no dict yet, make it one
+	let self.items[idx] = {'string_line' : self.items[idx]}
+      endif
+      let new = {}
+      for [k,v] in items(self.items[idx])
+	let lines = split(v,"\n")
+	let self.items[idx][k] = { 'text' : v, 'rows' : len(lines), 'cols' : max(map(copy(lines),'len(v:val)')), 'lines' : lines }
+	let self.allKeys[k] = 1
+        unlet k v
+      endfor
+    endfor
+    call tovl#scratch_buffer#ScratchBuffer({
+	  \ 'help' : funcref#Function(self.HelpText,{ 'self' : self }),
+	  \ 'sp_cmd' : self.sp_cmd,
+	  \ 'cmds' : self.cmds
+	  \ })
+    " I assume we have some kind of formatting anyway. Thus breaking lines is bad!
+    set nowrap
+    setlocal cursorline
+    let b:filtered_view = self
+    command! -buffer -nargs=0 ToggleAlignment call b:filtered_view.ToggleAlignment()
+    command! -buffer -nargs=0 ShowAppliedFilters call b:filtered_view.ShowAppliedFilters()
+    command! -buffer -nargs=0 RemoveFilters call b:filtered_view.RemoveFilters()
+    noremap <buffer> f :call b:filtered_view.FilterFromKeyboard(1,'')<cr>
+    " noremap <buffer> f :call b:filtered_view.FilterFromKeyboard(1)<cr>
+    noremap <buffer> F :call b:filtered_view.FilterFromKeyboard(0,'')<cr>
+    if has_key(self,'Continuation')
+      nnoremap <buffer> <cr> :call b:filtered_view.Continue()<cr>
+    endif
+    "noremap <buffer> k
+    "noremap <buffer> K
+
+    let [items, cursorAt] = self.FilteredItems()
+    " len(items) is an approximation because one item can have multiple
+    " lines.. However adding the lines first to check takes too much time
+    if self.selectByIdOrFilter == 1 || (self.selectByIdOrFilter == 'auto' && winheight('%') > len(items) )
+      call self.SelectByIdOrFilter()
+    else
+      " user should choose how to proceed
+      call self.UpdateDisplay()
+    endif
+  endfun
+
+  " user interface
+  fun d.ToggleAlignment()
+    let self.aligned = !self.aligned
+    call self.UpdateDisplay()
+  endfun
+  fun d.ShowAppliedFilters()
+    for i in self.filter | echo string(i) | endfor
+  endfun
+  fun d.RemoveFilters()
+    let self.filter = []
+    call self.UpdateDisplay()
+  endfun
+  fun d.Continue()
+    let item = self.CurrentItem()
+    call self.DoContinue(item)
+  endfun
+  fun d.DoContinue(v)
+    if self.closeOnContinuation | bw! | endif
+    call funcref#Call(self.Continuation,[a:v])
+  endfun
+
+  fun d.MapToOriginal(v)
+    if has_key(a:v, 'string_line')
+      return a:v.string_line.text
+    else
+      let d = {}
+      for [k,v] in items(a:v)
+	let d[k] = v.text
+	unlet k v
+      endfor
+      return d
+    endif
+  endfun
+
+  fun d.CurrentItem()
+    let idx=line('.')-len(self.headerLines)
+    while idx >= 0
+      if has_key(self.linesToItems, idx)
+	return self.MapToOriginal(self.FilteredItems()[0][self.linesToItems[idx]])
+      else
+	let idx = idx -1
+      endif
+    endwhile
+    throw "internal error, couldn't determine selected item!"
+  endfun
+
+  " updates the filter cache and returns the final filtered items
+  fun d.FilteredItems()
+    " update cache
+    let idx = 0
+    let [items, cursorAt] = [self.items, self.cursorAt]
+    for idx in range(0, len(self.filter)-1)
+      if idx +1 > len(self.cached) || self.cached[idx]['filter'] != self.filter[idx]
+	let self.cached = self.cached[:idx-1]
+	let [items, cursorAt] = self.FilterItem(copy(items), self.filter[idx], cursorAt)
+	call add(self.cached, { 'cursorAt' : cursorAt, 'items' : items, 'filter' : self.filter[idx]})
+      else
+        let ci = self.cached[idx]
+	let [items, cursorAt] = [ci['items'], ci['cursorAt']]
+      endif
+    endfor
+    return [items, cursorAt]
+  endfun
+
+  " calling this will return a set of lines which are expected to be the new
+  " buffer contents. The self.linesToItems dict is updated
+  fun d.UpdateDisplay()
+
+    if empty(self.filter)
+      let self.statusline= 'no filter applied, :Help for help'
+    else
+      let self.statusline = len(self.filter).' '.string(self.filter[-1])
+    endif
+
+    let self.linesToItems = {}
+    let [items, cursorAt] = self.FilteredItems()
+    "let num_width = printf('%.0f', trunc(log10(len(items))+1))
+    let num_width = 4
+    if self.aligned
+      " get column width.. (probably will not work with unicde characters.. I
+      " don't have a better solution)
+      let maxlens={}
+      for i in items
+	for [k,v] in items(i)
+	  if get(maxlens,k,0) < v.cols
+	    let maxlens[k] = v.cols
+	  endif
+	endfor
+      endfor
+    endif
+
+    " format lines
+    let self.headerLines = [self.modeText]
+    let lines = copy(self.headerLines)
+    let lines_count = 0
+    if self.number
+      let fmt_startA = '%'.num_width.'s)'
+      let fmt_startB = '%'.num_width.'s'
+    else
+      let fmt_startA = '' | let fmt_startB = ''
+    endif
+    let cursorAtLine = 1 " sane default
+    for idx in range(0,len(items)-1)
+      let self.linesToItems[lines_count + 1] = idx
+      let i = items[idx]
+      let keys = has_key(self,'keys')
+	    \ ? s:Intersection(self.keys, keys(i))
+	    \ : keys(i)
+      let fmt = ''
+      let args =  [i]
+      let cols = []
+      for k in keys
+	let fmt .= self.sep.'%-'.(self.aligned ? maxlens[k] : i[k]['cols']).'s'
+	call add(cols, i[k])
+      endfor
+      for row in range(0, max([1] + map(copy(cols),'v:val["rows"]'))-1)
+	let fmt_args = row == 0 ? [fmt_startA.fmt] :  [fmt_startB.fmt]
+	if self.number
+	  call add(fmt_args, row == 0 ? idx : '')
+	endif
+	for c in cols
+	  call add(fmt_args, c.rows <= row ? '' : c.lines[row])
+	endfor
+	call add(lines, call('printf', fmt_args))
+	let lines_count += 1
+      endfor
+      if idx == cursorAt
+        let cursorAtLine = lines_count
+      endif
+    endfor
+    " update stauts line to show last applied filter
+    " disabled cause it causes trouble on :wincmd w
+    " setlocal statusline=%!b:filtered_view.statusline
+
+    " syntax
+    syn clear
+    for s in self.syn_cmds | exec s | endfor
+    let id = 0
+    " highlight filter regex in buffer as well
+    let syn_ids = [ 'Underlined', 'Todo', 'Error', 'Type', 'Statement' ]
+    for f in self.filter
+      if !f.keep || !has_key(f, 'regex') | continue | endif
+      if f.regex != ''
+        try
+	exec 'syn match '.syn_ids[id % len(syn_ids)].' '.string(f.regex)
+        catch /.*/
+          " ignore errors such as \ without following characters. Thus just
+          " ignore and wait for the next character
+        endtry
+      endif
+      let id = id +1
+    endfor
+    if len(lines) > winheight('%')
+      call extend(lines, self.headerLines)
+    endif
+    normal ggdG
+    call append(0, lines)
+    " place cursor
+    exec (cursorAtLine+1)
+    " move cursor into the middle of the window
+    normal zz
+  endf
+
+  " filter = keys :
+  "  filter = string to be executed containing Val
+  "  keep = 1  keep on match 
+  "       = 0  drop on match
+  "  key (optional)
+  "  cursorAt: at which item to put the cursor
+  "            if that item is deleted it will be placed at the item above
+  " optional: key of dict if dict
+  fun d.FilterItem(items, filter, cursorAt)
+    let filter = 'Val =~ '.string(a:filter.regex)
+    let keep = a:filter.keep
+    let cursorAt = a:cursorAt
+
+    for idx in reverse(range(0, len(a:items)-1))
+      let i = a:items[idx]
+      if has_key(a:filter,'key')
+	let key = a:filter.key
+	if has_key(i, key)
+	  " key given, only filter by this column
+	  let Val = i[key]['text']
+	  exec 'let any = '.filter
+	else
+	  let any = 0
+	endif
+      else
+	let any = 0
+	" no key given, try all
+	for x in values(i)
+	  let Val = x['text']
+	  exec 'let any =  '.filter
+	  if any | break | endif
+	endfor
+      endif
+      if any != keep
+	call remove(a:items, idx)
+        if idx <= cursorAt
+          let cursorAt = cursorAt -1
+        endif
+      endif
+    endfor
+    return [a:items, cursorAt]
+  endfun
+
+  " if the user enters a number select by index else start filtering..
+  fun d.SelectByIdOrFilter()
+    let idx=''
+    let items = self.FilteredItems()[0]
+    try
+      let self.modeText = '[0-9]* : select by index| <esc>: escape getchar() loop, any char: start filtering'
+      call self.UpdateDisplay() | redraw
+      while 1
+	let c=getchar()
+	if index([13,10],c) >= 0
+	  return self.DoContinue(self.MapToOriginal(items[idx]))
+	elseif index([27], c) >=0
+	  " esc, abort
+	  return
+	else
+	  if type(c) == 0
+	    let c = nr2char(c)
+	  endif
+	  if c == "\<bs>" || index(map(range(0,10),'v:val.""'),c) >= 0
+	    if c == "\<bs>"
+	      let idx = idx[:-2]
+	    else
+	      let idx .= c
+	    endif
+	    if idx < len(items) && idx.'0' > len(items) || idx == 0 && len(items) < 10
+	      " only match
+	      return self.DoContinue(self.MapToOriginal(items[idx]))
+	    endif
+	  else
+	    return self.FilterFromKeyboard(1,c)
+	  endif
+	endif
+      endwhile
+    finally
+      let self.modeText = ''
+    endtry
+  endfun
+
+  " gets a regular expresion filter by keybaord and updates the display while
+  " you're typing. The regex ist shown in the statusline
+  fun d.FilterFromKeyboard(keep, start, ...)
+    let self.modeText = 'press ESC to exit getchar() loop'
+    call self.UpdateDisplay() | redraw
+
+    try
+      let key_text = a:0 > 0 ? 'key : '.a:1 : ''
+      let filter_bak = self.filter
+      let filter = copy(self.filter)
+      let start = a:start
+      let filter_new = ''
+      while 1
+	if start != ''
+	  " use c= last char to force updating display etc
+	  let filter_new = start[:-2]
+	  let c = start[-1:]
+	  let start = ''
+	else
+	  let c=getchar()
+	endif 
+	if index([13,10],c) >= 0
+	  " c-j or return, accept new filter
+	  let items = self.FilteredItems()
+	  if len(items) == 1 && has_key(self, 'Continuation') && self.continueOnSingleMatchCR
+	    call self.DoContinue(self.MapToOriginal(items[0]))
+	  endif
+	  return
+	elseif index([27], c) >=0
+	  " esc, abort
+	  let self.filter = filter_bak
+	  call self.UpdateDisplay()
+	  return
+	else
+	  if type(c) == 0
+	    let c = nr2char(c)
+	  endif
+	  if c == "\<bs>"
+	    let filter_new = filter_new[:-2]
+	  else
+	    let filter_new .= c
+	  endif
+	  let d = {'keep' : a:keep, 'regex' : filter_new }
+	  if a:0 > 0
+	    let d['key'] = a:1
+	  endif
+	  let self.filter = copy(filter_bak)
+	  call add(self.filter, d)
+	  let items = self.FilteredItems()
+	  if len(items) == 1 && has_key(self, 'Continuation') && self.continueOnSingleMatch
+	    call self.DoContinue(self.MapToOriginal(items[0]))
+	    return
+	  endif
+	  call self.UpdateDisplay() | redraw
+	endif
+      endwhile
+    finally
+      let self.modeText = ''
+    endtry
+  endfun
+
+  if get(a:opts,'init',1)
+    call d.NewBufferAndInit()
+  endif
+endfun

File vim/colors/Monokai.vim

+" Vim color file
+" Converted from Textmate theme Monokai using Coloration v0.3.2 (http://github.com/sickill/coloration)
+
+set background=dark
+highlight clear
+
+if exists("syntax_on")
+  syntax reset
+endif
+
+let g:colors_name = "Monokai"
+
+hi Cursor ctermfg=235 ctermbg=231 cterm=NONE guifg=#272822 guibg=#f8f8f0 gui=NONE
+hi Visual ctermfg=NONE ctermbg=59 cterm=NONE guifg=NONE guibg=#49483e gui=NONE
+hi CursorLine ctermfg=NONE ctermbg=237 cterm=NONE guifg=NONE guibg=#3c3d37 gui=NONE
+hi CursorColumn ctermfg=NONE ctermbg=237 cterm=NONE guifg=NONE guibg=#3c3d37 gui=NONE
+hi ColorColumn ctermfg=NONE ctermbg=237 cterm=NONE guifg=NONE guibg=#3c3d37 gui=NONE
+hi LineNr ctermfg=102 ctermbg=237 cterm=NONE guifg=#90908a guibg=#3c3d37 gui=NONE
+hi VertSplit ctermfg=241 ctermbg=241 cterm=NONE guifg=#64645e guibg=#64645e gui=NONE
+hi MatchParen ctermfg=197 ctermbg=NONE cterm=underline guifg=#f92672 guibg=NONE gui=underline
+hi StatusLine ctermfg=231 ctermbg=241 cterm=bold guifg=#f8f8f2 guibg=#64645e gui=bold
+hi StatusLineNC ctermfg=231 ctermbg=241 cterm=NONE guifg=#f8f8f2 guibg=#64645e gui=NONE
+hi Pmenu ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
+hi PmenuSel ctermfg=NONE ctermbg=59 cterm=NONE guifg=NONE guibg=#49483e gui=NONE
+hi IncSearch ctermfg=235 ctermbg=186 cterm=NONE guifg=#272822 guibg=#e6db74 gui=NONE
+hi Search ctermfg=NONE ctermbg=NONE cterm=underline guifg=NONE guibg=NONE gui=underline
+hi Directory ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
+hi Folded ctermfg=242 ctermbg=235 cterm=NONE guifg=#75715e guibg=#272822 gui=NONE
+
+hi Normal ctermfg=231 ctermbg=235 cterm=NONE guifg=#f8f8f2 guibg=#272822 gui=NONE
+hi Boolean ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
+hi Character ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
+hi Comment ctermfg=242 ctermbg=NONE cterm=NONE guifg=#75715e guibg=NONE gui=NONE
+hi Conditional ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
+hi Constant ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
+hi Define ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
+hi DiffAdd ctermfg=231 ctermbg=64 cterm=bold guifg=#f8f8f2 guibg=#46830c gui=bold
+hi DiffDelete ctermfg=88 ctermbg=NONE cterm=NONE guifg=#8b0807 guibg=NONE gui=NONE
+hi DiffChange ctermfg=231 ctermbg=23 cterm=NONE guifg=#f8f8f2 guibg=#243955 gui=NONE
+hi DiffText ctermfg=231 ctermbg=24 cterm=bold guifg=#f8f8f2 guibg=#204a87 gui=bold
+hi ErrorMsg ctermfg=231 ctermbg=197 cterm=NONE guifg=#f8f8f0 guibg=#f92672 gui=NONE
+hi WarningMsg ctermfg=231 ctermbg=197 cterm=NONE guifg=#f8f8f0 guibg=#f92672 gui=NONE
+hi Float ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
+hi Function ctermfg=148 ctermbg=NONE cterm=NONE guifg=#a6e22e guibg=NONE gui=NONE
+hi Identifier ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=italic
+hi Keyword ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
+hi Label ctermfg=186 ctermbg=NONE cterm=NONE guifg=#e6db74 guibg=NONE gui=NONE
+hi NonText ctermfg=59 ctermbg=236 cterm=NONE guifg=#49483e guibg=#31322c gui=NONE
+hi Number ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
+hi Operator ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
+hi PreProc ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
+hi Special ctermfg=231 ctermbg=NONE cterm=NONE guifg=#f8f8f2 guibg=NONE gui=NONE
+hi SpecialKey ctermfg=59 ctermbg=237 cterm=NONE guifg=#49483e guibg=#3c3d37 gui=NONE
+hi Statement ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
+hi StorageClass ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=italic
+hi String ctermfg=186 ctermbg=NONE cterm=NONE guifg=#e6db74 guibg=NONE gui=NONE
+hi Tag ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
+hi Title ctermfg=231 ctermbg=NONE cterm=bold guifg=#f8f8f2 guibg=NONE gui=bold
+hi Todo ctermfg=95 ctermbg=NONE cterm=inverse,bold guifg=#75715e guibg=NONE gui=inverse,bold
+hi Type ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
+hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline guifg=NONE guibg=NONE gui=underline
+hi rubyClass ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
+hi rubyFunction ctermfg=148 ctermbg=NONE cterm=NONE guifg=#a6e22e guibg=NONE gui=NONE
+hi rubyInterpolationDelimiter ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
+hi rubySymbol ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
+hi rubyConstant ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=italic
+hi rubyStringDelimiter ctermfg=186 ctermbg=NONE cterm=NONE guifg=#e6db74 guibg=NONE gui=NONE
+hi rubyBlockParameter ctermfg=208 ctermbg=NONE cterm=NONE guifg=#fd971f guibg=NONE gui=italic
+hi rubyInstanceVariable ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
+hi rubyInclude ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
+hi rubyGlobalVariable ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
+hi rubyRegexp ctermfg=186 ctermbg=NONE cterm=NONE guifg=#e6db74 guibg=NONE gui=NONE
+hi rubyRegexpDelimiter ctermfg=186 ctermbg=NONE cterm=NONE guifg=#e6db74 guibg=NONE gui=NONE
+hi rubyEscape ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
+hi rubyControl ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
+hi rubyClassVariable ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
+hi rubyOperator ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
+hi rubyException ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
+hi rubyPseudoVariable ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
+hi rubyRailsUserClass ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=italic
+hi rubyRailsARAssociationMethod ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE
+hi rubyRailsARMethod ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE
+hi rubyRailsRenderMethod ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE
+hi rubyRailsMethod ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE
+hi erubyDelimiter ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
+hi erubyComment ctermfg=95 ctermbg=NONE cterm=NONE guifg=#75715e guibg=NONE gui=NONE
+hi erubyRailsMethod ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE
+hi htmlTag ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
+hi htmlEndTag ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
+hi htmlTagName ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
+hi htmlArg ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
+hi htmlSpecialChar ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
+hi javaScriptFunction ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=italic
+hi javaScriptRailsFunction ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE
+hi javaScriptBraces ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
+hi yamlKey ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
+hi yamlAnchor ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
+hi yamlAlias ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
+hi yamlDocumentHeader ctermfg=186 ctermbg=NONE cterm=NONE guifg=#e6db74 guibg=NONE gui=NONE
+hi cssURL ctermfg=208 ctermbg=NONE cterm=NONE guifg=#fd971f guibg=NONE gui=italic
+hi cssFunctionName ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE
+hi cssColor ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
+hi cssPseudoClassId ctermfg=148 ctermbg=NONE cterm=NONE guifg=#a6e22e guibg=NONE gui=NONE
+hi cssClassName ctermfg=148 ctermbg=NONE cterm=NONE guifg=#a6e22e guibg=NONE gui=NONE
+hi cssValueLength ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
+hi cssCommonAttr ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE
+hi cssBraces ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE

File vim/plugin/snipMate.vim

+" File:          snipMate.vim
+" Author:        Michael Sanders
+" Version:       0.85
+" 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
+" save and reset 'cpo'
+let s:save_cpo = &cpo
+set cpo&vim
+
+try
+	call funcref#Function('')
+catch /.*/
+	echoe "you're missing vim-addon-mw-utils. See install instructions at ".expand('<sfile>:h:h').'/README.rst'
+endtry
+
+if (!exists('g:snipMateSources'))
+  let g:snipMateSources = {}
+  " default source: get snippets based on runtimepath:
+  let g:snipMateSources['default'] = funcref#Function('snipMate#DefaultPool')
+endif
+
+au BufRead,BufNewFile *.snippet set ft=snippet
+au FileType snippet setl noet nospell
+
+au BufRead,BufNewFile *.snippets set ft=snippets
+au FileType snippets setl noet nospell fdm=expr fde=getline(v:lnum)!~'^\\t\\\\|^$'?'>1':1
+
+inoremap <silent> <Plug>snipMateNextOrTrigger  <C-R>=snipMate#TriggerSnippet()<CR>
+snoremap <silent> <Plug>snipMateNextOrTrigger  <Esc>a<C-R>=snipMate#TriggerSnippet()<CR>
+inoremap <silent> <Plug>snipMateBack           <C-R>=snipMate#BackwardsSnippet()<CR>
+snoremap <silent> <Plug>snipMateBack           <Esc>a<C-R>=snipMate#BackwardsSnippet()<CR>
+inoremap <silent> <Plug>snipMateShow           <C-R>=snipMate#ShowAvailableSnips()<CR>
+" FIXME: <Plug>snipMateVisual pollutes register(s)
+xnoremap <silent> <Plug>snipMateVisual         s<C-O>:let g:snipmate_content_visual=getreg('1')<CR>
+
+" config which can be overridden (shared lines)
+if !exists('g:snipMate')
+  let g:snipMate = {}
+endif
+let s:snipMate = g:snipMate
+
+let s:snipMate['get_snippets'] = get(s:snipMate, 'get_snippets', funcref#Function("snipMate#GetSnippets"))
+
+" old snippets_dir: function returning list of paths which is used to read
+" snippets. You can replace it with your own implementation. Defaults to all
+" directories in &rtp/snippets/*
+let s:snipMate['snippet_dirs'] = get(s:snipMate, 'snippet_dirs', funcref#Function('return split(&runtimepath,",")'))
+
+" _ is default scope added always
+"
+" &ft honors multiple filetypes and syntax such as in set ft=html.javascript syntax=FOO
+let s:snipMate['get_scopes'] = get(s:snipMate, 'get_scopes', funcref#Function('return split(&ft,"\\.")+[&syntax, "_"]'))
+
+if !exists('snippets_dir')
+	let snippets_dir = substitute(globpath(&rtp, 'snippets/'), "\n", ',', 'g')
+endif
+
+" 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
+
+" dummy for compatibility - will be removed
+" moving to autoload to improve loading speed and debugging
+fun! TriggerSnippet()
+	echoe "replace TriggerSnippet by snipMate#TriggerSnippet, please!"
+	return snipMate#TriggerSnippet()
+endf
+fun! BackwardSnippet()
+	echoe "replace BackwardSnippet by snipMate#BackwardsSnippet, please!"
+	return snipMate#BackwardsSnippet()
+endf
+
+" restore 'cpo'
+let &cpo = s:save_cpo
+
+" vim:noet:sw=4:ts=4:ft=vim

File vim/plugin/snipMateInterface.vim

+" some useful commands
+command! SnipMateOpenSnippetFiles call snipMate#OpenSnippetFiles()

File vim/syntax/snippet.vim

+" Syntax highlighting for .snippet files (used for snipMate.vim)
+" Hopefully this should make snippets a bit nicer to write!
+syn match placeHolder '\${\d\+\(:.\{-}\)\=}' contains=snipCommand
+syn match tabStop '\$\d\+'
+syn match snipEscape '\\\\\|\\`'
+syn match snipCommand '\%(\\\@<!\%(\\\\\)*\)\@<=`.\{-}\%(\\\@<!\%(\\\\\)*\)\@<=`'
+
+hi link placeHolder   Special
+hi link tabStop       Special
+hi link snipEscape    SpecialChar
+hi link snipCommand   String

File vim/syntax/snippets.vim

+" Syntax highlighting for .snippets 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 snipEscape '\\\\\|\\`'
+syn match snipCommand '\%(\\\@<!\%(\\\\\)*\)\@<=`.\{-}\%(\\\@<!\%(\\\\\)*\)\@<=`'
+syn match snippet '^snippet.*' contains=multiSnipText,snipKeyword
+syn match snippet '^guard\s\+.*' contains=multiSnipText,snipKeyword
+syn match multiSnipText '\S\+ \zs.*' contained
+syn match snipKeyword '^snippet'me=s+8 contained
+syn match snipError "^[^#s\t].*$"
+
+hi link snippet       Identifier
+hi link snipComment   Comment
+hi link multiSnipText String
+hi link snipKeyword   Keyword
+hi link snipEscape    SpecialChar
+hi link snipComment   Comment
+hi link placeHolder   Special
+hi link tabStop       Special
+hi link snipCommand   String
+hi link snipError     Error
 " Set Color Scheme  and background
 "
 	set background=dark
-	colorscheme mustang	
+	colorscheme Monokai