From 105485ac1d2035a7750f6af01dd0ba6fdf3c58cb Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Fri, 24 Feb 2012 13:42:12 +0900 Subject: [PATCH] - Improved a bit. --- .../sources/snippets_complete.vim | 20 ++++++++++++------- doc/neocomplcache-snippets-complete.txt | 3 +++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/autoload/neocomplcache/sources/snippets_complete.vim b/autoload/neocomplcache/sources/snippets_complete.vim index ee71329..ac3ab9b 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: 22 Feb 2012. +" Last Modified: 24 Feb 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 @@ -290,18 +290,24 @@ function! s:set_snippet_dict(snippet_pattern, snippet_dict, dup_check, snippets_ endif endfunction"}}} function! s:set_snippet_pattern(dict)"{{{ - let abbr_pattern = printf('%%.%ds..%%s', g:neocomplcache_max_keyword_width-10) + let abbr_pattern = printf('%%.%ds..%%s', + \ g:neocomplcache_max_keyword_width-10) let word = substitute(a:dict.word, '\%(<\\n>\)\+$', '', '') - let menu_pattern = a:dict.word =~ '\${\d\+\%(:.\{-}\)\?\\\@ ' : '[Snip] ' + let menu_pattern = a:dict.word =~ '\${\d\+\%(:.\{-}\)\?\\\@ ' : '[Snip] ' - let abbr = has_key(a:dict, 'abbr')? a:dict.abbr : - \substitute(a:dict.word, '\${\d\+\%(:.\{-}\)\?\\\@\|\$\d\+\|<\%(\\n\|\\t\)>\|\s\+', ' ', 'g') - let abbr = (g:neocomplcache_max_keyword_width >= 0 && len(abbr) > g:neocomplcache_max_keyword_width)? + let abbr = has_key(a:dict, 'abbr')? a:dict.abbr : + \substitute(a:dict.word, + \ '\${\d\+\%(:.\{-}\)\?\\\@\|' + \ '\$\d\+\|<\%(\\n\|\\t\)>\|\s\+', ' ', 'g') + let abbr = (g:neocomplcache_max_keyword_width >= 0 && + \ len(abbr) > g:neocomplcache_max_keyword_width)? \ printf(abbr_pattern, abbr, abbr[-8:]) : abbr let dict = { - \ 'word' : a:dict.name, 'snip' : word, 'abbr' : a:dict.name, + \ 'word' : a:dict.name, + \ 'snip' : word, 'abbr' : a:dict.name, \ 'description' : word, \ 'menu' : menu_pattern . abbr, 'dup' : 1 \} diff --git a/doc/neocomplcache-snippets-complete.txt b/doc/neocomplcache-snippets-complete.txt index 0b2f0bf..805db6e 100644 --- a/doc/neocomplcache-snippets-complete.txt +++ b/doc/neocomplcache-snippets-complete.txt @@ -281,6 +281,9 @@ snippet *neocomplcache-snippets-complete-unite-action-snippet* ============================================================================== CHANGELOG *neocomplcache-snippets-complete-changelog* +2012-02-24 +- Improved a bit. + 2012-02-22 - Fixed prev_word behavior.