- Fixed alias problem.

This commit is contained in:
Shougo Matsushita 2012-10-17 08:19:37 +09:00
parent 25d448c133
commit 33de2273e8
3 changed files with 17 additions and 8 deletions

View File

@ -1,7 +1,7 @@
"============================================================================= "=============================================================================
" FILE: snippets_complete.vim " FILE: snippets_complete.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com> " AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 06 Oct 2012. " Last Modified: 17 Oct 2012.
" License: MIT license {{{ " License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining " Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the " a copy of this software and associated documentation files (the
@ -60,11 +60,18 @@ function! s:source.get_complete_words(cur_keyword_pos, cur_keyword_str)"{{{
endfunction"}}} endfunction"}}}
function! s:keyword_filter(list, cur_keyword_str)"{{{ function! s:keyword_filter(list, cur_keyword_str)"{{{
let keyword_escape = neocomplcache#keyword_escape(a:cur_keyword_str)
" Keyword filter. " Keyword filter.
let list = filter(a:list, printf('v:val.word =~ %s',
\ string('^' . keyword_escape))) " Uniq by real_name.
let dict = {}
for snippet in neocomplcache#keyword_filter(a:list, a:cur_keyword_str)
if !has_key(dict, snippet.real_name) ||
\ len(dict[snippet.real_name].word) > len(snippet.word)
let dict[snippet.real_name] = snippet
endif
endfor
let list = values(dict)
" Substitute abbr. " Substitute abbr.
let abbr_pattern = printf('%%.%ds..%%s', let abbr_pattern = printf('%%.%ds..%%s',

View File

@ -1,7 +1,7 @@
"============================================================================= "=============================================================================
" FILE: neosnippet.vim " FILE: neosnippet.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com> " AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 06 Oct 2012. " Last Modified: 17 Oct 2012.
" License: MIT license {{{ " License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining " Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the " a copy of this software and associated documentation files (the
@ -218,8 +218,7 @@ function! s:set_snippet_pattern(dict)"{{{
\ '\|\s\+\|\n', ' ', 'g')) \ '\|\s\+\|\n', ' ', 'g'))
let dict = { let dict = {
\ 'word' : a:dict.name, \ 'word' : a:dict.name, 'snip' : a:dict.word,
\ 'snip' : a:dict.word, 'abbr' : a:dict.name,
\ 'description' : a:dict.word, \ 'description' : a:dict.word,
\ 'menu' : menu_pattern.abbr, \ 'menu' : menu_pattern.abbr,
\ 'dup' : 1, 'is_head' : get(a:dict, 'is_head', 0), \ 'dup' : 1, 'is_head' : get(a:dict, 'is_head', 0),

View File

@ -409,6 +409,9 @@ snippet *neosnippet-unite-action-snippet*
============================================================================== ==============================================================================
CHANGELOG *neosnippet-changelog* CHANGELOG *neosnippet-changelog*
2012-10-17
- Fixed alias problem.
2012-10-15 2012-10-15
- Improved lua snip. - Improved lua snip.
- Improved c++ snip. - Improved c++ snip.