This commit is contained in:
Barak Michener 2024-05-18 18:50:38 -07:00
parent f0510126ba
commit 7a7c647c22
212 changed files with 30625 additions and 30625 deletions

View file

@ -0,0 +1,61 @@
" vim-airline companion theme of Ubaryd
" (https://github.com/Donearm/Ubaryd)
" Normal mode
let s:N1 = [ '#141413' , '#b3b3b3' , 232 , 252 ] " blackestgravel & bleaksand
let s:N2 = [ '#b3b3b3' , '#414141' , 252, 238 ] " bleaksand & deepgravel
let s:N3 = [ '#e0e0e0' , '#363636' , 254, 237 ] " toffee & darkgravel
let s:N4 = [ '#363946' , 237 ] " gravel
" Insert mode
let s:I1 = [ '#1a1a18' , '#fade3e' , 232 , 221 ] " blackestgravel & warmcorn
let s:I2 = [ '#c7b386' , '#45413b' , 252 , 238 ] " bleaksand & deepgravel
let s:I3 = [ '#f4cf86' , '#242321' , 222 , 235 ] " lighttannedskin & darkgravel
" Visual mode
let s:V1 = [ '#1c1b1a' , '#9a4820' , 233 , 88 ] " blackgravel & warmadobe
let s:V2 = [ '#000000' , '#88633f' , 16 , 95 ] " coal & cappuccino
let s:V3 = [ '#88633f' , '#c7b386' , 95 , 252 ] " cappuccino & bleaksand
let s:V4 = [ '#c14c3d' , 160 ] " tannedumbrella
" Replace mode
let s:RE = [ '#c7915b' , 173 ] " nut
" Paste mode
let s:PA = [ '#f9ef6d' , 154 ] " bleaklemon
let s:file = [ '#ff7400' , '' , 196 , '' , '' ]
let s:IA = [ '#767986', '#363946', 244, 237, '' ]
let g:airline#themes#barak#palette = {}
let g:airline#themes#barak#palette.inactive = {
\ 'airline_a' : [ s:N2[1] , s:N3[1] , s:N2[3] , s:N3[3] , '' ] }
let g:airline#themes#barak#palette.accents = {
\ 'red': [ '#ff7400' , '' , 196 , '' , '' ],
\ }
let g:airline#themes#barak#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3, s:file)
let g:airline#themes#barak#palette.normal_modified = {
\ 'airline_a' : [ s:N2[0] , s:N4[0] , s:N2[2] , s:N4[1] , '' ] ,
\ 'airline_c' : [ s:V1[1] , s:N2[1] , s:V1[3] , s:N2[3] , '' ] }
let g:airline#themes#barak#palette.insert = airline#themes#generate_color_map(s:I1, s:I2, s:I3, s:file)
let g:airline#themes#barak#palette.insert_modified = {
\ 'airline_c' : [ s:V2[1] , s:N2[1] , s:V2[3] , s:N2[3] , '' ] }
let g:airline#themes#barak#palette.insert_paste = {
\ 'airline_a' : [ s:I1[0] , s:PA[0] , s:I1[2] , s:PA[1] , '' ] }
let g:airline#themes#barak#palette.replace = copy(airline#themes#barak#palette.insert)
let g:airline#themes#barak#palette.replace.airline_a = [ s:I1[0] , s:RE[0] , s:I1[2] , s:RE[1] , '' ]
let g:airline#themes#barak#palette.replace_modified = g:airline#themes#barak#palette.insert_modified
let g:airline#themes#barak#palette.visual = airline#themes#generate_color_map(s:V1, s:V2, s:V3, s:file)
let g:airline#themes#barak#palette.visual_modified = {
\ 'airline_c' : [ s:V3[0] , s:V4[0] , s:V3[2] , s:V4[1] , '' ] }
let g:airline#themes#barak#palette.inactive = airline#themes#generate_color_map(s:IA, s:IA, s:IA, s:file)

1954
dot_vim/autoload/genutils.vim Executable file

File diff suppressed because it is too large Load diff

472
dot_vim/autoload/lookupfile.vim Executable file
View file

@ -0,0 +1,472 @@
" lookupfile.vim: See plugin/lookupfile.vim
" Make sure line-continuations won't cause any problem. This will be restored
" at the end
let s:save_cpo = &cpo
set cpo&vim
" Some onetime initialization of variables
if !exists('s:myBufNum')
let s:windowName = '[Lookup File]'
let s:myBufNum = -1
let s:popupIsHidden = 0
endif
let g:lookupfile#lastPattern = ""
let g:lookupfile#lastResults = []
let g:lookupfile#lastStatsMsg = []
let g:lookupfile#recentFiles = []
function! lookupfile#OpenWindow(bang, initPat)
let origWinnr = winnr()
let _isf = &isfname
let _splitbelow = &splitbelow
set nosplitbelow
try
if s:myBufNum == -1
" Temporarily modify isfname to avoid treating the name as a pattern.
set isfname-=\
set isfname-=[
if exists('+shellslash')
call genutils#OpenWinNoEa("1sp \\\\". escape(s:windowName, ' '))
else
call genutils#OpenWinNoEa("1sp \\". escape(s:windowName, ' '))
endif
let s:myBufNum = bufnr('%')
else
let winnr = bufwinnr(s:myBufNum)
if winnr == -1
call genutils#OpenWinNoEa('1sb '. s:myBufNum)
else
let wasVisible = 1
exec winnr 'wincmd w'
endif
endif
finally
let &isfname = _isf
let &splitbelow = _splitbelow
endtry
call s:SetupBuf()
let initPat = ''
if a:bang != ''
let initPat = ''
elseif a:initPat != ''
let initPat = a:initPat
elseif g:lookupfile#lastPattern != '' && g:LookupFile_PreserveLastPattern
let initPat = g:lookupfile#lastPattern
endif
$
if getline('.') !=# initPat
silent! put=''
call setline('.', initPat)
endif
startinsert!
if !g:LookupFile_OnCursorMovedI
" This is a hack to bring up the popup immediately, while reopening the
" window, just for a better response.
aug LookupFileCursorHoldImm
au!
au CursorMovedI <buffer> nested exec 'doautocmd LookupFile CursorHoldI' |
\ au! LookupFileCursorHoldImm
aug END
endif
call s:LookupFileSet()
aug LookupFileReset
au!
au CursorMovedI <buffer> call <SID>LookupFileSet()
au CursorMoved <buffer> call <SID>LookupFileSet()
au WinEnter <buffer> call <SID>LookupFileSet()
au TabEnter <buffer> call <SID>LookupFileSet()
au WinEnter * call <SID>LookupFileReset(0)
au TabEnter * call <SID>LookupFileReset(0)
au CursorMoved * call <SID>LookupFileReset(0)
" Better be safe than sorry.
au BufHidden <buffer> call <SID>LookupFileReset(1)
aug END
endfunction
function! lookupfile#CloseWindow()
if bufnr('%') != s:myBufNum
return
endif
call s:LookupFileReset(1)
close
endfunction
function! lookupfile#ClearCache()
let g:lookupfile#lastPattern = ""
let g:lookupfile#lastResults = []
endfunction
function! s:LookupFileSet()
if bufnr('%') != s:myBufNum || exists('s:_backspace')
return
endif
let s:_backspace = &backspace
set backspace=start
let s:_completeopt = &completeopt
set completeopt+=menuone
let s:_updatetime = &updatetime
let &updatetime = g:LookupFile_UpdateTime
endfunction
function! s:LookupFileReset(force)
if a:force
aug LookupFileReset
au!
aug END
endif
" Ignore the event while in the same buffer.
if exists('s:_backspace') && (a:force || (bufnr('%') != s:myBufNum))
let &backspace = s:_backspace
let &completeopt = s:_completeopt
let &updatetime = s:_updatetime
unlet s:_backspace s:_completeopt s:_updatetime
endif
endfunction
function! s:HidePopup()
let s:popupIsHidden = 1
return "\<C-E>"
endfunction
function! lookupfile#IsPopupHidden()
return s:popupIsHidden
endfunction
function! s:SetupBuf()
call genutils#SetupScratchBuffer()
resize 1
setlocal wrap
setlocal bufhidden=hide
setlocal winfixheight
setlocal wrapmargin=0
setlocal textwidth=0
setlocal completefunc=lookupfile#Complete
syn clear
set ft=lookupfile
" Setup maps to open the file.
inoremap <silent> <buffer> <expr> <C-E> <SID>HidePopup()
inoremap <silent> <buffer> <expr> <CR> <SID>AcceptFile(0, "\<CR>")
inoremap <silent> <buffer> <expr> <C-O> <SID>AcceptFile(1, "\<C-O>")
" This prevents the "Whole line completion" from getting triggered with <BS>,
" however this might make the dropdown kind of flash.
inoremap <buffer> <expr> <BS> pumvisible()?"\<C-E>\<BS>":"\<BS>"
inoremap <buffer> <expr> <S-BS> pumvisible()?"\<C-E>\<BS>":"\<BS>"
" Make <C-Y> behave just like <CR>
imap <buffer> <C-Y> <CR>
if g:LookupFile_EscCancelsPopup
inoremap <buffer> <expr> <Esc> pumvisible()?"\<C-E>\<C-C>":"\<Esc>"
endif
inoremap <buffer> <expr> <silent> <Down> <SID>GetCommand(1, 1, "\<C-N>",
\ "\"\\<Lt>C-N>\"")
inoremap <buffer> <expr> <silent> <Up> <SID>GetCommand(1, 1, "\<C-P>",
\ "\"\\<Lt>C-P>\"")
inoremap <buffer> <expr> <silent> <PageDown> <SID>GetCommand(1, 0,
\ "\<PageDown>", '')
inoremap <buffer> <expr> <silent> <PageUp> <SID>GetCommand(1, 0,
\ "\<PageUp>", '')
nnoremap <silent> <buffer> o :OpenFile<CR>
nnoremap <silent> <buffer> O :OpenFile!<CR>
command! -buffer -nargs=0 -bang OpenFile
\ :call <SID>OpenCurFile('<bang>' != '')
command! -buffer -nargs=0 -bang AddPattern :call <SID>AddPattern()
nnoremap <buffer> <silent> <Plug>LookupFile :call lookupfile#CloseWindow()<CR>
inoremap <buffer> <silent> <Plug>LookupFile <C-E><C-C>:call lookupfile#CloseWindow()<CR>
aug LookupFile
au!
if g:LookupFile_ShowFiller
exec 'au' (g:LookupFile_OnCursorMovedI ? 'CursorMovedI' : 'CursorHoldI')
\ '<buffer> call <SID>ShowFiller()'
endif
exec 'au' (g:LookupFile_OnCursorMovedI ? 'CursorMovedI' : 'CursorHoldI')
\ '<buffer> call lookupfile#LookupFile(0)'
aug END
endfunction
function! s:GetCommand(withPopupTrigger, withSkipPat, actCmd, innerCmd)
let cmd = ''
if a:withPopupTrigger && !pumvisible()
let cmd .= "\<C-X>\<C-U>"
endif
let cmd .= a:actCmd. "\<C-R>=(getline('.') == lookupfile#lastPattern) ? ".
\ a:innerCmd." : ''\<CR>"
return cmd
endfunction
function! s:AddPattern()
if g:LookupFile_PreservePatternHistory
silent! put! =g:lookupfile#lastPattern
$
endif
endfunction
function! s:AcceptFile(splitWin, key)
if s:popupIsHidden
return a:key
endif
if !pumvisible()
call lookupfile#LookupFile(0, 1)
endif
let acceptCmd = ''
if type(g:LookupFile_LookupAcceptFunc) == 2 ||
\ (type(g:LookupFile_LookupAcceptFunc) == 1 &&
\ substitute(g:LookupFile_LookupAcceptFunc, '\s', '', 'g') != '')
let acceptCmd = call(g:LookupFile_LookupAcceptFunc, [a:splitWin, a:key])
else
let acceptCmd = lookupfile#AcceptFile(a:splitWin, a:key)
endif
return (!pumvisible() ? "\<C-X>\<C-U>" : '').acceptCmd
endfunction
function! s:IsValid(fileName)
if bufnr('%') != s:myBufNum || a:fileName == ''
return 0
endif
if !filereadable(a:fileName) && !isdirectory(a:fileName)
if g:LookupFile_AllowNewFiles
" Check if the parent directory exists, then we can create a new buffer
" (Ido feature)
let parent = fnamemodify(a:fileName, ':h')
if parent == '' || (parent != '' && !isdirectory(parent))
return 1
endif
endif
return 0
endif
return 1
endfunction
function! lookupfile#AcceptFile(splitWin, key)
if len(g:lookupfile#lastResults) == 0 && !s:IsValid(getline('.'))
return "\<C-O>:echohl ErrorMsg | echo 'No such file or directory' | echohl NONE\<CR>"
endif
" Skip the first match, which is essentially the same as pattern.
let nextCmd = "\<C-N>\<C-R>=(getline('.') == lookupfile#lastPattern)?\"\\<C-N>\":''\<CR>"
let acceptCmd = "\<C-Y>\<Esc>:AddPattern\<CR>:OpenFile".(a:splitWin?'!':'').
\ "\<CR>"
if getline('.') ==# g:lookupfile#lastPattern
if len(g:lookupfile#lastResults) == 0
" FIXME: shouldn't this be an error?
let acceptCmd = acceptCmd
elseif len(g:lookupfile#lastResults) == 1 || g:LookupFile_AlwaysAcceptFirst
" If there is only one file, we will also select it (if not already
" selected)
let acceptCmd = nextCmd.acceptCmd
else
let acceptCmd = nextCmd
endif
endif
return acceptCmd
endfunction
function! s:OpenCurFile(splitWin)
let fileName = getline('.')
if fileName =~ '^\s*$'
return
endif
if !s:IsValid(fileName)
echohl ErrorMsg | echo 'No such file or directory' | echohl NONE
endif
if type(g:LookupFile_LookupNotifyFunc) == 2 ||
\ (type(g:LookupFile_LookupNotifyFunc) == 1 &&
\ substitute(g:LookupFile_LookupNotifyFunc, '\s', '', 'g') != '')
call call(g:LookupFile_LookupNotifyFunc, [])
endif
call lookupfile#CloseWindow()
" Update the recent files list.
if g:LookupFile_RecentFileListSize > 0
let curPos = index(g:lookupfile#recentFiles, fileName)
call add(g:lookupfile#recentFiles, fileName)
if curPos != -1
call remove(g:lookupfile#recentFiles, curPos)
elseif len(g:lookupfile#recentFiles) > g:LookupFile_RecentFileListSize
let g:lookupfile#recentFiles = g:lookupfile#recentFiles[
\ -g:LookupFile_RecentFileListSize :]
endif
endif
let bufnr = genutils#FindBufferForName(fileName)
let winnr = bufwinnr(bufnr)
if winnr == -1 && g:LookupFile_SearchForBufsInTabs
for i in range(tabpagenr('$'))
if index(tabpagebuflist(i+1), bufnr) != -1
" Switch to the tab and set winnr.
exec 'tabnext' (i+1)
let winnr = bufwinnr(bufnr)
endif
endfor
endif
if winnr != -1
exec winnr.'wincmd w'
else
let splitOpen = 0
if &switchbuf ==# 'split' || a:splitWin
let splitOpen = 1
endif
" First try opening as a buffer, if it fails, we will open as a file.
try
if bufnr == -1
throw ''
endif
exec (splitOpen?'s':'').'buffer' bufnr
catch /^Vim\%((\a\+)\)\=:E325/
" Ignore, this anyway means the file was found.
catch
try
exec (splitOpen?'split':'edit') fileName
catch /^Vim\%((\a\+)\)\=:E325/
" Ignore, this anyway means the file was found.
endtry
endtry
endif
endfunction
function! s:ShowFiller()
return lookupfile#LookupFile(1)
endfunction
function! lookupfile#Complete(findstart, base)
if a:findstart
return 0
else
call lookupfile#LookupFile(0, 1, a:base)
return g:lookupfile#lastStatsMsg+g:lookupfile#lastResults
endif
endfunction
function! lookupfile#LookupFile(showingFiller, ...)
let generateMode = (a:0 == 0 ? 0 : a:1)
if generateMode
let pattern = (a:0 > 1) ? a:2 : getline('.')
else
let pattern = getline('.')
" The normal completion behavior is to stop completion when cursor is moved.
if col('.') == 1 || (col('.') != col('$'))
return ''
endif
endif
if pattern == '' || (pattern ==# g:lookupfile#lastPattern && pumvisible())
return ''
endif
if s:popupIsHidden && g:lookupfile#lastPattern ==# pattern
return ''
endif
let s:popupIsHidden = 0
let statusMsg = ''
if pattern == ' '
if len(g:lookupfile#recentFiles) == 0
let statusMsg = '<<< No recent files >>>'
let files = []
else
let statusMsg = '<<< Showing '.len(g:lookupfile#recentFiles).' recent files >>>'
let files = reverse(copy(g:lookupfile#recentFiles))
endif
elseif strlen(pattern) < g:LookupFile_MinPatLength
let statusMsg = '<<< Type at least '.g:LookupFile_MinPatLength.
\ ' characters >>>'
let files = []
" We ignore filler when we have the result in hand.
elseif g:lookupfile#lastPattern ==# pattern
" This helps at every startup as we start with the previous pattern.
let files = g:lookupfile#lastResults
elseif a:showingFiller
" Just show a filler and return. We could return this as the only match, but
" unless 'completeopt' has "menuone", menu doesn't get shown.
let statusMsg = '<<< Looking up files... hit ^C to break >>>'
let files = []
else
if type(g:LookupFile_LookupFunc) == 2 ||
\ (type(g:LookupFile_LookupFunc) == 1 &&
\ substitute(g:LookupFile_LookupFunc, '\s', '', 'g') != '')
let files = call(g:LookupFile_LookupFunc, [pattern])
else
let _tags = &tags
try
let &tags = eval(g:LookupFile_TagExpr)
let taglist = taglist(g:LookupFile_TagsExpandCamelCase ?
\ lookupfile#ExpandCamelCase(pattern) : pattern)
catch
echohl ErrorMsg | echo "Exception: " . v:exception | echohl NONE
return ''
finally
let &tags = _tags
endtry
" Show the matches for what is typed so far.
if g:LookupFile_UsingSpecializedTags
let files = map(taglist, '{'.
\ '"word": fnamemodify(v:val["filename"], ":p"), '.
\ '"abbr": v:val["name"], '.
\ '"menu": fnamemodify(v:val["filename"], ":h"), '.
\ '"dup": 1, '.
\ '}')
else
let files = map(taglist, 'fnamemodify(v:val["filename"], ":p")')
endif
endif
let pat = g:LookupFile_FileFilter
if pat != ''
call filter(files, '(type(v:val) == 4) ? v:val["word"] !~ pat : v:val !~ pat')
endif
if g:LookupFile_SortMethod ==# 'alpha'
" When UsingSpecializedTags, sort by the actual name (Timothy, Guo
" (firemeteor dot guo at gmail dot com)).
if type(get(files, 0)) == 4
call sort(files, "s:CmpByName")
else
call sort(files)
endif
endif
let g:lookupfile#lastPattern = pattern
let g:lookupfile#lastResults = files
endif
if statusMsg == ''
if len(files) > 0
let statusMsg = '<<< '.len(files).' Matching >>>'
else
let statusMsg = '<<< None Matching >>>'
endif
endif
let msgLine = [{'word': pattern, 'abbr': statusMsg, 'menu': pattern}]
let g:lookupfile#lastStatsMsg = msgLine
if !generateMode
call complete(1, msgLine+files)
endif
return ''
endfunction
function! lookupfile#ExpandCamelCase(str)
let pat = a:str
" Check if there are at least two consecutive uppercase letters to turn on
" the CamelCase expansion.
if match(a:str, '\u\u') != -1
let pat = '\C'.substitute(a:str, '\u\+',
\ '\=substitute(submatch(0), ".", '."'".'&\\U*'."'".', "g")', 'g')
let @*=pat
endif
return pat
endfunction
function! s:CmpByName(i1, i2)
let ileft = a:i1["abbr"]
let iright = a:i2["abbr"]
return ileft == iright ? 0 : ileft > iright ? 1 : -1
endfunc
" Restore cpo.
let &cpo = s:save_cpo
unlet s:save_cpo
" vim6:fdm=marker et sw=2

View file

@ -0,0 +1,215 @@
" File: cocoacomplete.vim (part of the cocoa.vim plugin)
" Author: Michael Sanders (msanders42 [at] gmail [dot] com)
" Last Updated: June 30, 2009
" Description: An omni-completion plugin for Cocoa/Objective-C.
let s:lib_dir = fnameescape($HOME.'/.vim/lib/')
let s:cocoa_indexes = s:lib_dir.'cocoa_indexes/'
if !isdirectory(s:cocoa_indexes)
echom 'Error in cocoacomplete.vim: could not find ~/.vim/lib/cocoa_indexes directory'
endif
fun! objc#cocoacomplete#Complete(findstart, base)
if a:findstart
" Column where completion starts:
return match(getline('.'), '\k\+\%'.col('.').'c')
else
let matches = []
let complete_type = s:GetCompleteType(line('.'), col('.') - 1)
if complete_type == 'methods'
call s:Complete(a:base, ['alloc', 'init', 'retain', 'release',
\ 'autorelease', 'retainCount',
\ 'description', 'class', 'superclass',
\ 'self', 'zone', 'isProxy', 'hash'])
let obj_pos = s:GetObjPos(line('.'), col('.'))
call extend(matches, s:CompleteMethod(line('.'), obj_pos, a:base))
elseif complete_type == 'types' || complete_type == 'returntypes'
let opt_types = complete_type == 'returntypes' ? ['IBAction'] : []
call s:Complete(a:base, opt_types + ['void', 'id', 'BOOL', 'int',
\ 'double', 'float', 'char'])
call extend(matches, s:CompleteCocoa(a:base, 'classes', 'types',
\ 'notifications'))
elseif complete_type != ''
if complete_type =~ 'function_params$'
let complete_type = substitute(complete_type, 'function_params$', '', '')
let functions = s:CompleteFunction(a:base)
endif
" Mimic vim's dot syntax for other complete types (see :h ft).
let word = a:base == '' ? 'NS' : a:base
let args = [word] + split(complete_type, '\.')
call extend(matches, call('s:CompleteCocoa', args))
" List functions after the other items in the menu.
if exists('functions') | call extend(matches, functions) | endif
endif
return matches
endif
endf
fun s:GetCompleteType(lnum, col)
let scopelist = map(synstack(a:lnum, a:col), 'synIDattr(v:val, "name")')
if empty(scopelist) | return 'types' | endif
let current_scope = scopelist[-1]
let beforeCursor = strpart(getline(a:lnum), 0, a:col)
" Completing a function name:
if getline(a:lnum) =~ '\%'.(a:col + 1).'c\s*('
return 'functions'
elseif current_scope == 'objcSuperclass'
return 'classes'
" Inside brackets "[ ... ]":
elseif index(scopelist, 'objcMessage') != -1
return beforeCursor =~ '\[\k*$' ? 'classes' : 'methods'
" Inside parentheses "( ... )":
elseif current_scope == 'cParen'
" Inside parentheses for method definition:
if beforeCursor =~ '^\s*[-+]\s*([^{;]*'
return beforeCursor =~ '^\s*[-+]\s*([^)]*$' ? 'returntypes' : 'types'
" Inside function, loop, or conditional:
else
return 'classes.types.constants.function_params'
endif
" Inside braces "{ ... }" or after equals "=":
elseif current_scope == 'cBlock' || current_scope == 'objcAssign' || current_scope == ''
let type = current_scope == 'cBlock' ? 'types.constants.' : ''
let type = 'classes.'.type.'function_params'
if beforeCursor =~ 'IBOutlet' | return 'classes' | endif
return beforeCursor =~ '\v(^|[{};=\])]|return)\s*\k*$'? type : 'methods'
" Directly inside "@implementation ... @end" or "@interface ... @end"
elseif current_scope == 'objcImp' || current_scope == 'objcHeader'
" TODO: Complete delegate/subclass methods
endif
return ''
endf
" Adds item to the completion menu if they match the base.
fun s:Complete(base, items)
for item in a:items
if item =~ '^'.a:base | call complete_add(item) | endif
endfor
endf
" Returns position of "foo" in "[foo bar]" or "[baz bar: [foo bar]]".
fun s:GetObjPos(lnum, col)
let beforeCursor = strpart(getline(a:lnum), 0, a:col)
return match(beforeCursor, '\v.*(^|[\[=;])\s*\[*\zs[A-Za-z0-9_@]+') + 1
endf
" Completes a method given the position of the object and the method
" being completed.
fun s:CompleteMethod(lnum, col, method)
let class = s:GetCocoaClass(a:lnum, a:col)
if class == ''
let object = matchstr(getline(a:lnum), '\%'.a:col.'c\k\+')
let class = s:GetDeclWord(object)
if class == '' | return [] | endif
endif
let method = s:GetMethodName(a:lnum, a:col, a:method)
let matches = split(system(s:lib_dir.'get_methods.sh '.class.
\ '|grep "^'.method.'"'), "\n")
if exists('g:loaded_snips') " Use snipMate if it's installed
call objc#pum_snippet#Map()
else " Otherwise, only complete the method name.
call map(matches, 'substitute(v:val, ''\v:\zs.{-}\ze(\w+:|$)'', " ", "g")')
endif
" If dealing with a partial method name, only complete past it. E.g., in
" "[NSString stringWithCharacters:baz l|]" (where | is the cursor),
" only return "length", not "stringWithCharacters:length:".
if stridx(method, ':') != -1
let method = substitute(method, a:method.'$', '\\\\zs&', '')
call map(matches, 'matchstr(v:val, "'.method.'.*")')
endif
return matches
endf
" Returns the Cocoa class at a given position if it exists, or
" an empty string "" if it doesn't.
fun s:GetCocoaClass(lnum, col)
let class = matchstr(getline(a:lnum), '\%'.a:col.'c[A-Za-z0-9_"@]\+')
if class =~ '^@"' | return 'NSString' | endif " Treat @"..." as an NSString
let v:errmsg = ''
sil! hi cocoaClass
if v:errmsg == '' && synIDattr(synID(a:lnum, a:col, 0), 'name') == 'cocoaClass'
return class " If cocoaClass is defined, try using that.
endif
return system('grep ^'.class.' '.s:cocoa_indexes.'classes.txt') != ''
\ ? class : '' " Use grep as a fallback.
endf
" Returns the word before a variable declaration.
fun s:GetDeclWord(var)
let startpos = [line('.'), col('.')]
let line_found = searchdecl(a:var) != 0 ? 0 : line('.')
call cursor(startpos)
let matchstr = '\v(IBOutlet\s+)=\zs\k+\s*\ze\**\s*'
" If the declaration was not found in the implementation file, check
" the header.
if !line_found && expand('%:e') == 'm'
let header_path = expand('%:p:r').'.h'
if filereadable(header_path)
for line in readfile(header_path)
if line =~ '^\s*\(IBOutlet\)\=\s*\k*\s*\ze\**\s*'.a:var.'\s*'
return matchstr(line, matchstr)
endif
endfor
return ''
endif
endif
return matchstr(getline(line_found), matchstr.a:var)
endf
fun s:SearchList(list, regex)
for line in a:list
if line =~ a:regex
return line
endif
endfor
return ''
endf
" Returns the method name, ready to be searched by grep.
" The "base" word needs to be passed in separately, because
" Vim apparently removes it from the line during completions.
fun s:GetMethodName(lnum, col, base)
let line = getline(a:lnum)
let col = matchend(line, '\%'.a:col.'c\S\+\s\+') + 1 " Skip past class name.
if line =~ '\%'.col.'c\k\+:'
let base = a:base == '' ? '' : ' '.a:base
let method = matchstr(line, '\%'.col.'c.\{-}\ze]').base
return substitute(method, '\v\k+:\zs.{-}\ze(\s*\k+:|'.base.'$)', '[^:]*', 'g')
else
return a:base
endif
endf
" Completes Cocoa functions, using snippets for the parameters if possible.
fun s:CompleteFunction(word)
let files = s:cocoa_indexes.'functions.txt' " TODO: Add C functions.
let matches = split(system('zgrep -h "^'.a:word.'" '.files), "\n")
if exists('g:loaded_snips') " Use snipMate if it's installed
call objc#pum_snippet#Map()
else " Otherwise, just complete the function name
call map(matches, "{'word':matchstr(v:val, '^\\k\\+'), 'abbr':v:val}")
endif
return matches
endf
" Completes word for Cocoa "classes", "types", "notifications", or "constants".
" (supplied as the optional parameters).
fun s:CompleteCocoa(word, file, ...)
let files = ''
for file in [a:file] + a:000
let files .= ' '.s:cocoa_indexes.file.'.txt'
endfor
return split(system('grep -ho "^'.a:word.'[A-Za-z0-9_]*" '.files), "\n")
endf
" vim:noet:sw=4:ts=4:ft=vim

View file

@ -0,0 +1,160 @@
" File: objc#man.vim (part of the cocoa.vim plugin)
" Author: Michael Sanders (msanders42 [at] gmail [dot] com)
" Description: Allows you to look up Cocoa API docs in Vim.
" Last Updated: June 30, 2009
" NOTE: See http://mymacinations.com/2008/02/06/changing-the-systems-default-settings-for-html-files-safe/
" for removing the annoying security alert in Leopard.
" Return all matches in for ":CocoaDoc <tab>" sorted by length.
fun objc#man#Completion(ArgLead, CmdLine, CursorPos)
return system('grep -ho "^'.a:ArgLead.'\w*" ~/.vim/lib/cocoa_indexes/*.txt'.
\ "| perl -e 'print sort {length $a <=> length $b} <>'")
endf
let s:docsets = []
for path in ['/Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset',
\ '/Developer/Platforms/iPhoneOS.platform/Developer/Documentation/DocSets/com.apple.adc.documentation.AppleiPhone3_0.iPhoneLibrary.docset']
if isdirectory(path)
call add(s:docsets, path)
endif
endfor
let s:docset_cmd = '/Developer/usr/bin/docsetutil search -skip-text -query '
fun s:OpenFile(file)
if a:file =~ '/.*/man/'
exe ':!'.substitute(&kp, '^man -s', 'man', '').' '.a:file
else
" /usr/bin/open strips the #fragments in file:// URLs, which we need,
" so I'm using applescript instead.
call system('osascript -e ''open location "file://'.a:file.'"'' &')
endif
endf
fun objc#man#ShowDoc(...)
let word = a:0 ? a:1 : matchstr(getline('.'), '\<\w*\%'.col('.').'c\w\+:\=')
" Look up the whole method if it takes multiple arguments.
if !a:0 && word[len(word) - 1] == ':'
let word = s:GetMethodName()
endif
if word == ''
if !a:0 " Mimic K if using it as such
echoh ErrorMsg
echo 'E349: No identifier under cursor'
echoh None
endif
return
endif
let references = {}
" First check Cocoa docs for word using docsetutil
for docset in s:docsets
let response = split(system(s:docset_cmd.word.' '.docset), "\n")
let docset .= '/Contents/Resources/Documents/' " Actual path of files
for line in response
" Format string is: " Language/type/class/word path"
let path = matchstr(line, '\S*$')
if path[0] != '/' | let path = docset.path | endif
if has_key(references, path) | continue | endif " Ignore duplicate entries
let [lang, type, class] = split(matchstr(line, '^ \zs*\S*'), '/')[:2]
" If no class if given use type instead
if class == '-' | let class = type | endif
let references[path] = {'lang': lang, 'class': class}
endfor
endfor
" Then try man
let man = system('man -S2:3 -aW '.word)
if man !~ '^No manual entry'
for path in split(man, "\n")
if !has_key(references, path)
let references[path] = {'lang': 'C', 'class': 'man'}
endif
endfor
endif
if len(references) == 1
return s:OpenFile(keys(references)[0])
elseif !empty(references)
echoh ModeMsg | echo word | echoh None
return s:ChooseFrom(references)
else
echoh WarningMsg
echo "Can't find documentation for ".word
echoh None
endif
endf
fun s:ChooseFrom(references)
let type_abbr = {'cl' : 'Class', 'intf' : 'Protocol', 'cat' : 'Category',
\ 'intfm' : 'Method', 'instm' : 'Method', 'econst' : 'Enum',
\ 'tdef' : 'Typedef', 'macro' : 'Macro', 'data' : 'Data',
\ 'func' : 'Function'}
let inputlist = []
" Don't display "Objective-C" if all items are objc
let show_lang = !AllKeysEqual(values(a:references), 'lang', 'Objective-C')
let i = 1
for ref in values(a:references)
let class = ref.class
if has_key(type_abbr, class) | let class = type_abbr[class] | endif
call add(inputlist, i.'. '.(show_lang ? ref['lang'].' ' : '').class)
let i += 1
endfor
let num = inputlist(inputlist)
return num ? s:OpenFile(keys(a:references)[num - 1]) : -1
endf
fun AllKeysEqual(list, key, item)
for item in a:list
if item[a:key] != a:item
return 0
endif
endfor
return 1
endf
fun s:GetMethodName()
let pos = [line('.'), col('.')]
let startpos = searchpos('\v^\s*-.{-}\w+:|\[\s*\w+\s+\w+:|\]\s*\w+:', 'cbW')
" Method declaration (- (foo) bar:)
if getline(startpos[0]) =~ '^\s*-.\{-}\w\+:'
let endpos = searchpos('{', 'W')
" Message inside brackets ([foo bar: baz])
else
let endpos = searchpairpos('\[', '', '\]', 'W')
endif
call cursor(pos)
if startpos[0] == 0 || endpos[0] == 0 | return '' | endif
let lines = getline(startpos[0], endpos[0])
let lines[0] = strpart(lines[0], startpos[1] - 1)
let lines[-1] = strpart(lines[-1], 0, endpos[1])
" Ignore outer brackets
let message = substitute(join(lines), '^\[\|\]$', '', '')
" Ignore nested messages [...]
let message = substitute(message, '\[.\{-}\]', '', 'g')
" Ignore strings (could contain colons)
let message = substitute(message, '".\{-}"', '', 'g')
" Ignore @selector(...)
let message = substitute(message, '@selector(.\{-})', '', 'g')
return s:MatchAll(message, '\w\+:')
endf
fun s:MatchAll(haystack, needle)
let matches = matchstr(a:haystack, a:needle)
let index = matchend(a:haystack, a:needle)
while index != -1
let matches .= matchstr(a:haystack, a:needle, index + 1)
let index = matchend(a:haystack, a:needle, index + 1)
endw
return matches
endf
" vim:noet:sw=4:ts=4:ft=vim

View file

@ -0,0 +1,124 @@
" File: objc#method_builder.vim (part of the cocoa.vim plugin)
" Author: Michael Sanders (msanders42 [at] gmail [dot] com)
" Description: Builds an empty implementation (*.m) file given a header (*.h)
" file. When called with no arguments (simply ":BuildMethods"),
" it looks for the corresponding header file of the current *.m
" file (e.g. "foo.m" -> "foo.h").
" Last Updated: June 03, 2009
" - make sure you're not in a comment
" TODO: Relative pathnames
fun objc#method_builder#Completion(ArgLead, CmdLine, CursorPos)
let dir = stridx(a:ArgLead, '/') == -1 ? getcwd() : fnamemodify(a:ArgLead, ':h')
let search = fnamemodify(a:ArgLead, ':t')
let files = split(glob(dir.'/'.search.'*.h')
\ ."\n".glob(dir.'/'.search.'*/'), "\n")
call map(files, 'fnameescape(fnamemodify(v:val, ":."))')
return files
endf
fun s:Error(msg)
echoh ErrorMsg | echo a:msg | echoh None
return -1
endf
fun s:GetDeclarations(file)
let header = readfile(a:file)
let template = []
let in_comment = 0
let in_header = 0
let looking_for_semi = 0
for line in header
if in_comment
if stridx(line, '*/') != -1 | let in_comment = 0 | endif
continue " Ignore declarations inside multi-line comments
elseif stridx(line, '/*') != -1
let in_comment = 1 | continue
endif
if stridx(line, '@interface') != -1
let in_header = 1
let template += ['@implementation'.matchstr(line, '@interface\zs\s\+\w\+'), '']
continue
elseif in_header && stridx(line, '@end') != -1
let in_header = 0
call add(template, '@end')
break " Only process one @interface at a time, for now.
endif
if !in_header | continue | endif
let first_char = strpart(line, 0, 1)
if first_char == '-' || first_char == '+' || looking_for_semi
let semi_pos = stridx(line, ';')
let looking_for_semi = semi_pos == -1
if looking_for_semi
call add(template, line)
else
call add(template, strpart(line, 0, semi_pos))
let template += ['{', "\t", '}', '']
endif
endif
endfor
return template
endf
fun objc#method_builder#Build(header)
let headerfile = a:header == '' ? expand('%:p:r').'.h' : a:header
if expand('%:e') != 'm'
return s:Error('Not in an implementation file.')
elseif !filereadable(headerfile)
return s:Error('Could not read header file.')
endif
let declarations = s:GetDeclarations(headerfile)
if empty(declarations)
return s:Error('Header file has no method declarations!')
endif
let len = len(declarations)
let last_change = line('.')
if search('\V'.substitute(declarations[0], '\s\+', '\\s\\+', ''))
if !searchpair('@implementation', '', '@end', 'W')
return s:Error('Missing @end declaration.')
endif
let i = 2 " Skip past the @implementation line & blank line
let len -= 1 " Skip past @end declaration
let lnum = line('.') - 1
else
let i = 0
let lnum = line('.')
endif
let start_line = lnum
while i < len
let is_method = declarations[i][0] =~ '@\|+\|-'
if !is_method || !search('\V'.substitute(escape(declarations[i], '\'),
\ 'void\|IBAction', '\\(void\\|IBAction\\)', 'g'), 'n')
call append(lnum, declarations[i])
let lnum += 1
if is_method | let last_change = lnum | endif
else " Skip method declaration if it is already declared.
if declarations[i][0] == '@'
let i += 1
else
while declarations[i] != '}' && i < len
let i += 1
endw
let i += 1
endif
endif
let i += 1
endw
call cursor(last_change, 1)
if lnum == start_line
echoh WarningMsg
let class = matchstr(declarations[0], '@implementation\s\+\zs.*')
echo 'The methods for the "'.class.'" class have already been declared.'
echoh None
endif
endf
" vim:noet:sw=4:ts=4:ft=vim

View file

@ -0,0 +1,115 @@
" File: objc#method_list.vim (part of the cocoa.vim plugin)
" Author: Michael Sanders (msanders42 [at] gmail [dot] com)
" Description: Opens a split window containing the methods of the current file.
" Last Updated: July 13, 2009
au WinLeave Method\ List call<SID>LeaveMethodList()
au WinEnter Method\ List call objc#method_list#Activate(0)
fun objc#method_list#Activate(update)
let s:opt = {'is':&is, 'hls': &hls} " Save current options.
let s:last_search = @/
set is nohls
" If methodlist has already been opened, reactivate it.
if exists('s:mlist_buffer') && bufexists(s:mlist_buffer)
let mlist_win = bufwinnr(s:mlist_buffer)
if mlist_win == -1
sil exe 'belowright sbuf '.s:mlist_buffer
if a:update | call s:UpdateMethodList() | endif
elseif winbufnr(2) == -1
quit " If no other windows are open, close the method list automatically.
else " If method list is out of focus, bring it back into focus.
exe mlist_win.'winc w'
endif
else " Otherwise, create the method list.
call s:CreateMethodList()
call s:UpdateMethodList()
endif
endf
fun s:CreateMethodList()
botright new
let s:sortPref = 0
let s:mlist_buffer = bufnr('%')
sil file Method\ List
setl bt=nofile bh=wipe noswf nobl nonu nowrap syn=objc
syn match objcPragmark '^[^-+@].*$'
hi objcPragmark gui=italic term=underline
nn <silent> <buffer> <cr> :cal<SID>SelectMethod()<cr>
nn <buffer> q <c-w>q
nn <buffer> p <c-w>p
nm <buffer> l p
nm <buffer> <2-leftmouse> <cr>
endf
" Returns the lines of all the matches in a dictionary
fun s:GetAllMatches(needle)
let startpos = [line('.'), col('.')]
call cursor(1, 1)
let results = {}
let line = search(a:needle, 'Wc')
let key = matchstr(getline(line), a:needle)
if !s:InComment(line, 1) && key != ''
let results[key] = line
endif
while 1
let line = search(a:needle, 'W')
if !line | break | endif
let key = matchstr(getline(line), a:needle)
if !s:InComment(line, 1) && key != ''
let results[key] = line
endif
endw
call cursor(startpos)
return results
endf
fun s:InComment(line, col)
return stridx(synIDattr(synID(a:line, a:col, 0), 'name'), 'omment') != -1
endf
fun s:UpdateMethodList()
winc p " Go to source file window
let s:methods = s:GetAllMatches('^\v(\@(implementation|interface) \w+|'.
\ '\s*(\+|-).*|#pragma\s+mark\s+\zs.+)')
winc p " Go to method window
if empty(s:methods)
winc q
echoh WarningMsg
echo 'There are no methods in this file!'
echoh None
return
endif
call setline(1, sort(keys(s:methods), 's:SortByLineNum'))
exe "norm! \<c-w>".line('$').'_'
endf
fun s:SortByLineNum(i1, i2)
let line1 = s:methods[a:i1]
let line2 = s:methods[a:i2]
return line1 == line2 ? 0 : line1 > line2 ? 1 : -1
endf
fun s:SelectMethod()
let number = s:methods[getline('.')]
winc q
winc p
call cursor(number, 1)
endf
fun s:LeaveMethodList()
for [option, value] in items(s:opt)
exe 'let &'.option.'='.value
endfor
let @/ = s:last_search == '' ? '' : s:last_search
unl s:opt s:last_search
endf
" vim:noet:sw=4:ts=4:ft=vim

View file

@ -0,0 +1,87 @@
" File: pum_snippet.vim
" Author: Michael Sanders (msanders42 [at] gmail [dot] com)
" Last Updated: June 12, 2009
" Description: Uses snipMate to jump through function or method objc
" parameters when autocompleting. Used in cocoacomplete.vim.
" This function is invoked whenever pum_snippet is to be used; the keys are
" only mapped when used as the trigger, and then immediately unmapped to avoid
" breaking abbreviations, as well as other things.
fun! objc#pum_snippet#Map()
ino <silent> <buffer> <space> <c-r>=objc#pum_snippet#Trigger(' ')<cr>
if !exists('g:SuperTabMappingForward') " Only map tab if not using supertab.
\ || (g:SuperTabMappingForward != '<tab>' && g:SuperTabMappingForward != '<tab>')
ino <silent> <buffer> <tab> <c-r>=objc#pum_snippet#Trigger("\t")<cr>
endif
ino <silent> <buffer> <return> <c-r>=objc#pum_snippet#Trigger("\n")<cr>
let s:start = col('.')
" Completion menu can only be detected when the popup menu is visible, so
" 'menuone' needs to be temporarily set:
let s:cot = &cot
set cot+=menuone
endf
fun! objc#pum_snippet#Unmap()
call s:UnmapKey('<space>')
call s:UnmapKey('<tab>')
call s:UnmapKey('<return>')
endf
fun s:UnmapKey(key)
if maparg(a:key, 'i') =~? '^<C-R>=objc#pum_snippet#Trigger('
sil exe 'iunmap <buffer> '.a:key
endif
endf
fun! objc#pum_snippet#Trigger(key)
call objc#pum_snippet#Unmap()
if pumvisible()
let line = getline('.')
let col = col('.')
let word = matchstr(line, '\%'.s:start.'c\k\+(.\{-})\%'.col.'c')
if word != ''
let ConvertWord = function('s:ConvertFunction')
elseif match(line, '\%'.s:start.'c\k\+[^()]*:[^()]*\%'.col.'c') != -1
let word = matchstr(line, '\%'.s:start.'c\k\+[^()]*\%'.col.'c')
let ConvertWord = function('s:ConvertMethod')
endif
if word != ''
call s:ResetOptions()
let col -= len(word)
sil exe 's/\V'.escape(word, '\/').'\%#//'
return snipMate#expandSnip(ConvertWord(word), col)
endif
endif
call s:ResetOptions()
return a:key
endf
fun s:ResetOptions()
let &cot = s:cot
unl s:start s:cot
endf
fun s:ConvertFunction(function)
let name = matchstr(a:function, '^\k\+')
let params = matchstr(a:function, '^\k\+(\zs.*')
let snippet = name.'('.substitute(params, '\v(.{-1})(, |\))', '${0:\1}\2', 'g').'${0}'
return s:OrderSnippet(snippet)
endf
fun s:ConvertMethod(method)
if stridx(a:method, ':') == -1 | return a:method | endif
let snippet = substitute(a:method, '\v\k+:\zs.{-}\ze(\s*\k+:|$)', '${0:&}', 'g')
return s:OrderSnippet(snippet)
endf
" Converts "${0} foo ${0} bar ..." to "${1} foo ${2} bar", etc.
fun s:OrderSnippet(snippet)
let snippet = a:snippet
let i = 1
while stridx(snippet, '${0') != -1
let snippet = substitute(snippet, '${0', '${'.i, '')
let i += 1
endw
return snippet
endf
" vim:noet:sw=4:ts=4:ft=vim

View file

@ -0,0 +1,328 @@
" pathogen.vim - path option manipulation
" Maintainer: Tim Pope <http://tpo.pe/>
" Version: 2.2
" Install in ~/.vim/autoload (or ~\vimfiles\autoload).
"
" For management of individually installed plugins in ~/.vim/bundle (or
" ~\vimfiles\bundle), adding `call pathogen#infect()` to the top of your
" .vimrc is the only other setup necessary.
"
" The API is documented inline below. For maximum ease of reading,
" :set foldmethod=marker
if exists("g:loaded_pathogen") || &cp
finish
endif
let g:loaded_pathogen = 1
function! s:warn(msg)
if &verbose
echohl WarningMsg
echomsg a:msg
echohl NONE
endif
endfunction
" Point of entry for basic default usage. Give a relative path to invoke
" pathogen#incubate() (defaults to "bundle/{}"), or an absolute path to invoke
" pathogen#surround(). For backwards compatibility purposes, a full path that
" does not end in {} or * is given to pathogen#runtime_prepend_subdirectories()
" instead.
function! pathogen#infect(...) abort " {{{1
for path in a:0 ? reverse(copy(a:000)) : ['bundle/{}']
if path =~# '^[^\\/]\+$'
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
call pathogen#incubate(path . '/{}')
elseif path =~# '^[^\\/]\+[\\/]\%({}\|\*\)$'
call pathogen#incubate(path)
elseif path =~# '[\\/]\%({}\|\*\)$'
call pathogen#surround(path)
else
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
call pathogen#surround(path . '/{}')
endif
endfor
call pathogen#cycle_filetype()
return ''
endfunction " }}}1
" Split a path into a list.
function! pathogen#split(path) abort " {{{1
if type(a:path) == type([]) | return a:path | endif
let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
endfunction " }}}1
" Convert a list to a path.
function! pathogen#join(...) abort " {{{1
if type(a:1) == type(1) && a:1
let i = 1
let space = ' '
else
let i = 0
let space = ''
endif
let path = ""
while i < a:0
if type(a:000[i]) == type([])
let list = a:000[i]
let j = 0
while j < len(list)
let escaped = substitute(list[j],'[,'.space.']\|\\[\,'.space.']\@=','\\&','g')
let path .= ',' . escaped
let j += 1
endwhile
else
let path .= "," . a:000[i]
endif
let i += 1
endwhile
return substitute(path,'^,','','')
endfunction " }}}1
" Convert a list to a path with escaped spaces for 'path', 'tag', etc.
function! pathogen#legacyjoin(...) abort " {{{1
return call('pathogen#join',[1] + a:000)
endfunction " }}}1
" Remove duplicates from a list.
function! pathogen#uniq(list) abort " {{{1
let i = 0
let seen = {}
while i < len(a:list)
if (a:list[i] ==# '' && exists('empty')) || has_key(seen,a:list[i])
call remove(a:list,i)
elseif a:list[i] ==# ''
let i += 1
let empty = 1
else
let seen[a:list[i]] = 1
let i += 1
endif
endwhile
return a:list
endfunction " }}}1
" \ on Windows unless shellslash is set, / everywhere else.
function! pathogen#separator() abort " {{{1
return !exists("+shellslash") || &shellslash ? '/' : '\'
endfunction " }}}1
" Convenience wrapper around glob() which returns a list.
function! pathogen#glob(pattern) abort " {{{1
let files = split(glob(a:pattern),"\n")
return map(files,'substitute(v:val,"[".pathogen#separator()."/]$","","")')
endfunction "}}}1
" Like pathogen#glob(), only limit the results to directories.
function! pathogen#glob_directories(pattern) abort " {{{1
return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
endfunction "}}}1
" Turn filetype detection off and back on again if it was already enabled.
function! pathogen#cycle_filetype() " {{{1
if exists('g:did_load_filetypes')
filetype off
filetype on
endif
endfunction " }}}1
" Check if a bundle is disabled. A bundle is considered disabled if it ends
" in a tilde or its basename or full name is included in the list
" g:pathogen_disabled.
function! pathogen#is_disabled(path) " {{{1
if a:path =~# '\~$'
return 1
elseif !exists("g:pathogen_disabled")
return 0
endif
let sep = pathogen#separator()
let blacklist = g:pathogen_disabled
return index(blacklist, strpart(a:path, strridx(a:path, sep)+1)) != -1 && index(blacklist, a:path) != 1
endfunction "}}}1
" Prepend the given directory to the runtime path and append its corresponding
" after directory. If the directory is already included, move it to the
" outermost position. Wildcards are added as is. Ending a path in /{} causes
" all subdirectories to be added (except those in g:pathogen_disabled).
function! pathogen#surround(path) abort " {{{1
let sep = pathogen#separator()
let rtp = pathogen#split(&rtp)
if a:path =~# '[\\/]{}$'
let path = fnamemodify(a:path[0:-4], ':p:s?[\\/]\=$??')
let before = filter(pathogen#glob_directories(path.sep.'*'), '!pathogen#is_disabled(v:val)')
let after = filter(reverse(pathogen#glob_directories(path.sep."*".sep."after")), '!pathogen#is_disabled(v:val[0:-7])')
call filter(rtp,'v:val[0:strlen(path)-1] !=# path')
else
let path = fnamemodify(a:path, ':p:s?[\\/]\=$??')
let before = [path]
let after = [path . sep . 'after']
call filter(rtp, 'index(before + after, v:val) == -1')
endif
let &rtp = pathogen#join(before, rtp, after)
return &rtp
endfunction " }}}1
" Prepend all subdirectories of path to the rtp, and append all 'after'
" directories in those subdirectories. Deprecated.
function! pathogen#runtime_prepend_subdirectories(path) " {{{1
call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#surround('.string(a:path.'/{}').')')
return pathogen#surround(a:path . pathogen#separator() . '{}')
endfunction " }}}1
" For each directory in the runtime path, add a second entry with the given
" argument appended. If the argument ends in '/{}', add a separate entry for
" each subdirectory. The default argument is 'bundle/{}', which means that
" .vim/bundle/*, $VIM/vimfiles/bundle/*, $VIMRUNTIME/bundle/*,
" $VIM/vim/files/bundle/*/after, and .vim/bundle/*/after will be added (on
" UNIX).
function! pathogen#incubate(...) abort " {{{1
let sep = pathogen#separator()
let name = a:0 ? a:1 : 'bundle/{}'
if "\n".s:done_bundles =~# "\\M\n".name."\n"
return ""
endif
let s:done_bundles .= name . "\n"
let list = []
for dir in pathogen#split(&rtp)
if dir =~# '\<after$'
if name =~# '{}$'
let list += filter(pathogen#glob_directories(substitute(dir,'after$',name[0:-3],'').'*[^~]'.sep.'after'), '!pathogen#is_disabled(v:val[0:-7])') + [dir]
else
let list += [dir, substitute(dir, 'after$', '', '') . name . sep . 'after']
endif
else
if name =~# '{}$'
let list += [dir] + filter(pathogen#glob_directories(dir.sep.name[0:-3].'*[^~]'), '!pathogen#is_disabled(v:val)')
else
let list += [dir . sep . name, dir]
endif
endif
endfor
let &rtp = pathogen#join(pathogen#uniq(list))
return 1
endfunction " }}}1
" Deprecated alias for pathogen#incubate().
function! pathogen#runtime_append_all_bundles(...) abort " {{{1
if a:0
call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#incubate('.string(a:1.'/{}').')')
else
call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#incubate()')
endif
return call('pathogen#incubate', map(copy(a:000),'v:val . "/{}"'))
endfunction
let s:done_bundles = ''
" }}}1
" Invoke :helptags on all non-$VIM doc directories in runtimepath.
function! pathogen#helptags() abort " {{{1
let sep = pathogen#separator()
for glob in pathogen#split(&rtp)
for dir in split(glob(glob), "\n")
if (dir.sep)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir.sep.'doc') == 2 && !empty(filter(split(glob(dir.sep.'doc'.sep.'*'),"\n>"),'!isdirectory(v:val)')) && (!filereadable(dir.sep.'doc'.sep.'tags') || filewritable(dir.sep.'doc'.sep.'tags'))
helptags `=dir.'/doc'`
endif
endfor
endfor
endfunction " }}}1
command! -bar Helptags :call pathogen#helptags()
" Execute the given command. This is basically a backdoor for --remote-expr.
function! pathogen#execute(...) abort " {{{1
for command in a:000
execute command
endfor
return ''
endfunction " }}}1
" Like findfile(), but hardcoded to use the runtimepath.
function! pathogen#runtime_findfile(file,count) abort "{{{1
let rtp = pathogen#join(1,pathogen#split(&rtp))
let file = findfile(a:file,rtp,a:count)
if file ==# ''
return ''
else
return fnamemodify(file,':p')
endif
endfunction " }}}1
" Backport of fnameescape().
function! pathogen#fnameescape(string) abort " {{{1
if exists('*fnameescape')
return fnameescape(a:string)
elseif a:string ==# '-'
return '\-'
else
return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','')
endif
endfunction " }}}1
if exists(':Vedit')
finish
endif
let s:vopen_warning = 0
function! s:find(count,cmd,file,lcd) " {{{1
let rtp = pathogen#join(1,pathogen#split(&runtimepath))
let file = pathogen#runtime_findfile(a:file,a:count)
if file ==# ''
return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'"
endif
if !s:vopen_warning
let s:vopen_warning = 1
let warning = '|echohl WarningMsg|echo "Install scriptease.vim to continue using :V'.a:cmd.'"|echohl NONE'
else
let warning = ''
endif
if a:lcd
let path = file[0:-strlen(a:file)-2]
execute 'lcd `=path`'
return a:cmd.' '.pathogen#fnameescape(a:file) . warning
else
return a:cmd.' '.pathogen#fnameescape(file) . warning
endif
endfunction " }}}1
function! s:Findcomplete(A,L,P) " {{{1
let sep = pathogen#separator()
let cheats = {
\'a': 'autoload',
\'d': 'doc',
\'f': 'ftplugin',
\'i': 'indent',
\'p': 'plugin',
\'s': 'syntax'}
if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0])
let request = cheats[a:A[0]].a:A[1:-1]
else
let request = a:A
endif
let pattern = substitute(request,'/\|\'.sep,'*'.sep,'g').'*'
let found = {}
for path in pathogen#split(&runtimepath)
let path = expand(path, ':p')
let matches = split(glob(path.sep.pattern),"\n")
call map(matches,'isdirectory(v:val) ? v:val.sep : v:val')
call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]')
for match in matches
let found[match] = 1
endfor
endfor
return sort(keys(found))
endfunction " }}}1
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(<count>,'edit<bang>',<q-args>,0)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(<count>,'edit<bang>',<q-args>,0)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(<count>,'edit<bang>',<q-args>,1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(<count>,'split',<q-args>,<bang>1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(<count>,'vsplit',<q-args>,<bang>1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(<count>,'tabedit',<q-args>,<bang>1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(<count>,'pedit',<q-args>,<bang>1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(<count>,'read',<q-args>,<bang>1)
" vim:set et sw=2:

2812
dot_vim/autoload/plug.vim Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,433 @@
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.
" 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, '`.\{-}`',
\ substitute(eval(matchstr(snippet, '`\zs.\{-}\ze`')),
\ "\n\\%$", '', ''), '')
endw
let snippet = substitute(snippet, "\r", "\n", '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