fix(vim): match prefix when handling completion
This commit is contained in:
parent
356d01933d
commit
cf903619ea
10
.vimrc
10
.vimrc
|
@ -142,11 +142,15 @@ endfunction
|
||||||
function! s:truncate_labels(options, matches) abort
|
function! s:truncate_labels(options, matches) abort
|
||||||
let l:items = []
|
let l:items = []
|
||||||
for [l:source_name, l:matches] in items(a:matches)
|
for [l:source_name, l:matches] in items(a:matches)
|
||||||
|
let l:startcol = l:matches['startcol']
|
||||||
|
let l:base = a:options['typed'][l:startcol - 1:]
|
||||||
for l:item in l:matches['items']
|
for l:item in l:matches['items']
|
||||||
if has_key(l:item, 'abbr')
|
if stridx(l:item['word'], l:base) == 0
|
||||||
let l:item['abbr'] = s:truncate(l:item['abbr'])
|
if has_key(l:item, 'abbr')
|
||||||
|
let l:item['abbr'] = s:truncate(l:item['abbr'])
|
||||||
|
endif
|
||||||
|
call add(l:items, l:item)
|
||||||
endif
|
endif
|
||||||
call add(l:items, l:item)
|
|
||||||
endfor
|
endfor
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue