- Improved options word behavior.

This commit is contained in:
Shougo Matsushita
2012-10-21 20:48:02 +09:00
parent deaa1469f5
commit e44c9d6562
2 changed files with 15 additions and 8 deletions

View File

@@ -435,15 +435,21 @@ function! s:is_beginning_of_line(cur_text)"{{{
return prev_word_end <= 0
endfunction"}}}
function! s:get_cursor_snippet(snippets, cur_text)"{{{
let cur_word = matchstr(a:cur_text, '\w\+$')
if cur_word != '' &&
\ has_key(a:snippets, cur_word) && a:snippets[cur_word].options.word
return cur_word
let cur_word = matchstr(a:cur_text, '\S\+$')
if cur_word != '' && has_key(a:snippets, cur_word)
return cur_word
endif
let cur_word = matchstr(a:cur_text, '\S\+$')
while cur_word != ''
if has_key(a:snippets, cur_word) &&
\ a:snippets[cur_word].options.word
return cur_word
endif
return cur_word != '' && has_key(a:snippets, cur_word) ? cur_word : ''
let cur_word = substitute(cur_word, '^\%(\w\+\|\W\)', '', '')
endwhile
return cur_word
endfunction"}}}
function! s:snippets_expand(cur_text, col)"{{{
let cur_word = s:get_cursor_snippet(