mirror of
https://github.com/amix/vimrc
synced 2025-06-16 01:25:00 +08:00
Updated plugins
This commit is contained in:
@ -223,6 +223,9 @@ fun! snipMate#ReadSnippetsFile(file) abort
|
||||
if line[:6] == 'snippet'
|
||||
let inSnip = 1
|
||||
let bang = (line[7] == '!')
|
||||
if bang
|
||||
let bang += line[8] == '!'
|
||||
endif
|
||||
let trigger = strpart(line, 8 + bang)
|
||||
let name = ''
|
||||
let space = stridx(trigger, ' ') + 1
|
||||
@ -336,7 +339,10 @@ endfunction
|
||||
|
||||
function! snipMate#SetByPath(dict, trigger, path, snippet, bang, snipversion) abort
|
||||
let d = a:dict
|
||||
if !has_key(d, a:trigger) || a:bang
|
||||
if a:bang == 2
|
||||
unlet! d[a:trigger]
|
||||
return
|
||||
elseif !has_key(d, a:trigger) || a:bang == 1
|
||||
let d[a:trigger] = {}
|
||||
endif
|
||||
let d[a:trigger][a:path] = [a:snippet, a:snipversion]
|
||||
@ -434,14 +440,13 @@ endf
|
||||
|
||||
" used by both: completion and insert snippet
|
||||
fun! snipMate#GetSnippetsForWordBelowCursor(word, exact) abort
|
||||
" Setup lookups: '1.2.3' becomes [1.2.3] + [3, 2.3]
|
||||
let parts = split(a:word, '\W\zs')
|
||||
" Since '\W\zs' results in splitting *after* a non-keyword character, the
|
||||
" first \W stays connected to whatever's before it, so split it off
|
||||
if !empty(parts) && parts[0] =~ '\W$'
|
||||
let parts = [ parts[0][:-2], strpart(parts[0], len(parts[0]) - 1) ]
|
||||
\ + parts[1:]
|
||||
endif
|
||||
" Split non-word characters into their own piece
|
||||
" so 'foo.bar..baz' becomes ['foo', '.', 'bar', '.', '.', 'baz']
|
||||
" First split just after a \W and then split each resultant string just
|
||||
" before a \W
|
||||
let parts = filter(tlib#list#Flatten(
|
||||
\ map(split(a:word, '\W\zs'), 'split(v:val, "\\ze\\W")')),
|
||||
\ '!empty(v:val)')
|
||||
" Only look at the last few possibilities. Too many can be slow.
|
||||
if len(parts) > 5
|
||||
let parts = parts[-5:]
|
||||
|
Reference in New Issue
Block a user