From 33de2273e8cc884975680dfb7a8f7bf6f398f165 Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Wed, 17 Oct 2012 08:19:37 +0900 Subject: [PATCH] - Fixed alias problem. --- .../neocomplcache/sources/snippets_complete.vim | 17 ++++++++++++----- autoload/neosnippet.vim | 5 ++--- doc/neosnippet.txt | 3 +++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/autoload/neocomplcache/sources/snippets_complete.vim b/autoload/neocomplcache/sources/snippets_complete.vim index 4cc42d1..049b6ed 100644 --- a/autoload/neocomplcache/sources/snippets_complete.vim +++ b/autoload/neocomplcache/sources/snippets_complete.vim @@ -1,7 +1,7 @@ "============================================================================= " FILE: snippets_complete.vim " AUTHOR: Shougo Matsushita -" Last Modified: 06 Oct 2012. +" Last Modified: 17 Oct 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 @@ -60,11 +60,18 @@ function! s:source.get_complete_words(cur_keyword_pos, cur_keyword_str)"{{{ endfunction"}}} function! s:keyword_filter(list, cur_keyword_str)"{{{ - let keyword_escape = neocomplcache#keyword_escape(a:cur_keyword_str) - " 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. let abbr_pattern = printf('%%.%ds..%%s', diff --git a/autoload/neosnippet.vim b/autoload/neosnippet.vim index cd5d57b..9b1af1f 100644 --- a/autoload/neosnippet.vim +++ b/autoload/neosnippet.vim @@ -1,7 +1,7 @@ "============================================================================= " FILE: neosnippet.vim " AUTHOR: Shougo Matsushita -" Last Modified: 06 Oct 2012. +" Last Modified: 17 Oct 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 @@ -218,8 +218,7 @@ function! s:set_snippet_pattern(dict)"{{{ \ '\|\s\+\|\n', ' ', 'g')) let dict = { - \ 'word' : a:dict.name, - \ 'snip' : a:dict.word, 'abbr' : a:dict.name, + \ 'word' : a:dict.name, 'snip' : a:dict.word, \ 'description' : a:dict.word, \ 'menu' : menu_pattern.abbr, \ 'dup' : 1, 'is_head' : get(a:dict, 'is_head', 0), diff --git a/doc/neosnippet.txt b/doc/neosnippet.txt index f2d0adb..c39cfbd 100644 --- a/doc/neosnippet.txt +++ b/doc/neosnippet.txt @@ -409,6 +409,9 @@ snippet *neosnippet-unite-action-snippet* ============================================================================== CHANGELOG *neosnippet-changelog* +2012-10-17 +- Fixed alias problem. + 2012-10-15 - Improved lua snip. - Improved c++ snip.