- Used partial match for neocomplcache completion.

This commit is contained in:
Shougo Matsushita 2012-11-02 11:19:46 +09:00
parent c9a8833b60
commit 9f74be4e7c
5 changed files with 15 additions and 10 deletions

View File

@ -1,7 +1,7 @@
"=============================================================================
" FILE: snippets_complete.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 28 Oct 2012.
" Last Modified: 02 Nov 2012.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@ -79,8 +79,9 @@ endfunction"}}}
function! s:keyword_filter(snippets, cur_keyword_str)"{{{
" Uniq by real_name.
let dict = {}
let list = neocomplcache#keyword_filter(
\ values(a:snippets), a:cur_keyword_str)
let list = filter(values(a:snippets),
\ printf('v:val.abbr =~ %s',
\ string(neocomplcache#keyword_escape(a:cur_keyword_str))))
" Add cur_keyword_str snippet.
if has_key(a:snippets, a:cur_keyword_str)

View File

@ -213,6 +213,7 @@ function! s:initialize_snippet(dict, path, line, pattern, name)"{{{
let dict = {
\ 'word' : a:dict.name, 'snip' : a:dict.word,
\ 'abbr' : a:dict.abbr,
\ 'description' : a:dict.word,
\ 'menu' : menu_pattern.abbr,
\ 'dup' : 1, 'options' : a:dict.options,

View File

@ -1,7 +1,7 @@
"=============================================================================
" FILE: snippet.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 31 Oct 2012.
" Last Modified: 02 Nov 2012.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@ -64,8 +64,7 @@ function! s:source.gather_candidates(args, context) "{{{
let list = []
for keyword in a:context.source__snippets
let dict = {
\ 'word' : keyword.word,
\ 'abbr' : printf('%-50s %s', keyword.word, keyword.menu),
\ 'word' : printf('%-50s %s', keyword.word, keyword.menu),
\ 'kind': 'snippet',
\ 'action__complete_word' : keyword.word,
\ 'action__complete_pos' : keyword_pos,

View File

@ -1,7 +1,7 @@
"=============================================================================
" FILE: snippet_target.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 31 Oct 2012.
" Last Modified: 02 Nov 2012.
" License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
@ -57,8 +57,8 @@ function! s:source.gather_candidates(args, context) "{{{
let list = []
for keyword in a:context.source__snippets
let dict = {
\ 'word' : keyword.word,
\ 'abbr' : printf('%-50s %s', keyword.word, keyword.menu),
\ 'word' : printf('%-50s %s', keyword.word, keyword.menu),
\ 'source__trigger' : keyword.word,
\ 'source__menu' : keyword.menu,
\ 'source__snip' : keyword.snip,
\ 'source__context' : a:context,
@ -98,7 +98,7 @@ function! s:source.action_table.select.func(candidate)"{{{
call cursor(0, getpos("'<")[2])
call neosnippet#expand(neosnippet#util#get_cur_text(),
\ col('.'), a:candidate.word)
\ col('.'), a:candidate.source__trigger)
endfunction"}}}
"}}}

View File

@ -337,6 +337,9 @@ EXAMPLES *neosnippet-examples*
" Enable snipMate compatibility feature.
" let g:neosnippet#enable_snipmate_compatibility = 1
" For neocomplcache partial match.
" let g:neocomplcache_enable_refresh_always = 1
<
==============================================================================
SNIPPET SYNTAX *neosnippet-snippet-syntax*
@ -657,6 +660,7 @@ CHANGELOG *neosnippet-changelog*
2012-11-02
- Added g:neosnippet#enable_snipmate_compatibility option.
- Used partial match for neocomplcache completion.
2012-11-01
- Fixed snippet mirror behavior.