- 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
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(

View File

@ -422,8 +422,8 @@ languages' indent files can not work very well (e.g.: PHP, Python).
}
<
"options word" means this snippet is expanded by word boundary.
Note: The trigger must be word(digits or alphabet characters or "_")
characters.
Note: To complete the trigger in snippets_complete, it must be word(digits or
alphabet characters or "_") characters.
>
snippet date
options word
@ -457,6 +457,7 @@ CHANGELOG *neosnippet-changelog*
2012-10-21
- Added options head.
- Added options word.
- Improved options word behavior.
2012-10-20
- Improved scala snip.