From 50cabbdce7541abb1b2addcd50fbfec5bb72c84d Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sun, 30 Sep 2012 17:21:47 +0900 Subject: [PATCH] - Deleted neocomplcache depends. --- autoload/neosnippet.vim | 14 +------------- autoload/neosnippet/util.vim | 8 ++++++++ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/autoload/neosnippet.vim b/autoload/neosnippet.vim index 1112a90..808cbe4 100644 --- a/autoload/neosnippet.vim +++ b/autoload/neosnippet.vim @@ -164,7 +164,7 @@ function! neosnippet#expandable()"{{{ endfunction"}}} function! neosnippet#force_expandable()"{{{ let snippets = neosnippet#force_expandable() - let cur_text = neocomplcache#get_cur_text(1) + let cur_text = neosnippet#util#get_cur_text(1) " Found snippet trigger. return s:get_cursor_keyword_snippet(snippets, cur_text) != '' @@ -199,10 +199,6 @@ function! s:set_snippet_dict(snippet_pattern, snippet_dict, dup_check, snippets_ let alias_pattern = copy(pattern) let alias_pattern.word = alias - let abbr = (g:neocomplcache_max_keyword_width >= 0 && - \ len(alias) > g:neocomplcache_max_keyword_width) ? - \ printf(abbr_pattern, alias, alias[-8:]) : alias - let alias_pattern.abbr = abbr let alias_pattern.action__path = a:snippets_file let alias_pattern.action__pattern = action_pattern let alias_pattern.real_name = a:snippet_pattern.name @@ -217,9 +213,6 @@ function! s:set_snippet_dict(snippet_pattern, snippet_dict, dup_check, snippets_ let snippet.real_name = a:snippet_pattern.name endfunction"}}} function! s:set_snippet_pattern(dict)"{{{ - let abbr_pattern = printf('%%.%ds..%%s', - \ g:neocomplcache_max_keyword_width-10) - let a:dict.word = substitute(a:dict.word, '\n$', '', '') let menu_pattern = (a:dict.word =~ \ s:get_placeholder_marker_substitute_pattern()) ? @@ -229,9 +222,6 @@ function! s:set_snippet_pattern(dict)"{{{ \ s:get_placeholder_marker_pattern(). '\|'. \ s:get_mirror_placeholder_marker_pattern(). \ '\|\s\+\|\n', ' ', '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, @@ -298,8 +288,6 @@ endfunction"}}} function! s:load_snippets(snippet, snippets_file)"{{{ let dup_check = {} let snippet_pattern = { 'word' : '' } - let abbr_pattern = printf('%%.%ds..%%s', - \ g:neocomplcache_max_keyword_width-10) let linenr = 1 diff --git a/autoload/neosnippet/util.vim b/autoload/neosnippet/util.vim index 8253fcb..5b79875 100644 --- a/autoload/neosnippet/util.vim +++ b/autoload/neosnippet/util.vim @@ -73,6 +73,14 @@ function! neosnippet#util#set_dictionary_helper(...)"{{{ return call(s:V.set_dictionary_helper, a:000) endfunction"}}} +function! neosnippet#util#get_cur_text()"{{{ + return + \ (mode() ==# 'i' ? (col('.')-1) : col('.')) >= len(getline('.')) ? + \ getline('.') : + \ matchstr(getline('.'), + \ '^.*\%' . col('.') . 'c' . (mode() ==# 'i' ? '' : '.')) +endfunction"}}} + let &cpo = s:save_cpo unlet s:save_cpo