Permalink
Browse files

去掉 neocomplcache 的 text mode 支持

  • Loading branch information...
1 parent 98a04c3 commit ed6bc432b876ed8819949e05c1d2171f60454b16 @lilydjwg committed Oct 21, 2012
Showing with 4 additions and 50 deletions.
  1. +2 −43 autoload/neocomplcache.vim
  2. +2 −7 autoload/neocomplcache/sources/dictionary_complete.vim
View
@@ -87,7 +87,6 @@ function! neocomplcache#enable() "{{{
let s:moved_cur_text = ''
let s:changedtick = b:changedtick
let s:context_filetype = ''
- let s:is_text_mode = 0
let s:within_comment = 0
let s:skip_next_complete = 0
let s:is_prefetch = 0
@@ -480,14 +479,6 @@ function! neocomplcache#enable() "{{{
\'-R --sort=1 --c++-kinds=+p --fields=+iaS --extra=+q -I __wur --language-force=C++')
"}}}
- " Initialize text mode filetypes."{{{
- if !exists('g:neocomplcache_text_mode_filetypes')
- let g:neocomplcache_text_mode_filetypes = {}
- endif
- call neocomplcache#set_dictionary_helper(g:neocomplcache_text_mode_filetypes,
- \ 'text,help,tex,gitcommit,vcs-commit', 1)
- "}}}
-
" Initialize tags filter patterns."{{{
if !exists('g:neocomplcache_tags_filter_patterns')
let g:neocomplcache_tags_filter_patterns = {}
@@ -1161,9 +1152,6 @@ endfunction"}}}
function! neocomplcache#is_eskk_enabled()"{{{
return exists('*eskk#is_enabled') && eskk#is_enabled()
endfunction"}}}
-function! neocomplcache#is_text_mode()"{{{
- return s:is_text_mode
-endfunction"}}}
function! neocomplcache#is_windows()"{{{
return neocomplcache#util#is_windows()
endfunction"}}}
@@ -1387,7 +1375,6 @@ function! neocomplcache#get_complete_words(complete_results, is_sort,
let words = []
let icase = g:neocomplcache_enable_ignore_case &&
\!(g:neocomplcache_enable_smart_case && a:cur_keyword_str =~ '\u')
- \ && !neocomplcache#is_text_mode()
for keyword in complete_words
if has_key(keyword, 'kind') && keyword.kind == ''
" Remove kind key.
@@ -1452,26 +1439,6 @@ function! neocomplcache#get_complete_words(complete_results, is_sort,
endfor
endif"}}}
- " Convert words.
- if neocomplcache#is_text_mode() "{{{
- if a:cur_keyword_str =~ '^\l\+$'
- for keyword in complete_words
- let keyword.word = tolower(keyword.word)
- let keyword.abbr = tolower(keyword.abbr)
- endfor
- elseif a:cur_keyword_str =~ '^\u\+$'
- for keyword in complete_words
- let keyword.word = toupper(keyword.word)
- let keyword.abbr = toupper(keyword.abbr)
- endfor
- elseif a:cur_keyword_str =~ '^\u\l\+$'
- for keyword in complete_words
- let keyword.word = toupper(keyword.word[0]).tolower(keyword.word[1:])
- let keyword.abbr = toupper(keyword.abbr[0]).tolower(keyword.abbr[1:])
- endfor
- endif
- endif"}}}
-
if g:neocomplcache_max_keyword_width >= 0 "{{{
" Abbr check.
let abbr_pattern = printf('%%.%ds..%%s',
@@ -1506,9 +1473,7 @@ function! s:set_complete_results_words(complete_results)"{{{
" Save options.
let ignorecase_save = &ignorecase
- if neocomplcache#is_text_mode()
- let &ignorecase = 1
- elseif g:neocomplcache_enable_smart_case && result.cur_keyword_str =~ '\u'
+ if g:neocomplcache_enable_smart_case && result.cur_keyword_str =~ '\u'
let &ignorecase = 0
else
let &ignorecase = g:neocomplcache_enable_ignore_case
@@ -1818,9 +1783,7 @@ function! neocomplcache#complete_common_string()"{{{
" Get cursor word.
let [cur_keyword_pos, cur_keyword_str] = neocomplcache#match_word(s:get_cur_text())
- if neocomplcache#is_text_mode()
- let &ignorecase = 1
- elseif g:neocomplcache_enable_smart_case && cur_keyword_str =~ '\u'
+ if g:neocomplcache_enable_smart_case && cur_keyword_str =~ '\u'
let &ignorecase = 0
else
let &ignorecase = g:neocomplcache_enable_ignore_case
@@ -1922,7 +1885,6 @@ function! s:on_insert_leave()"{{{
let s:cur_keyword_str = ''
let s:complete_words = []
let s:context_filetype = ''
- let s:is_text_mode = 0
let s:skip_next_complete = 0
let s:is_prefetch = 0
endfunction"}}}
@@ -2010,9 +1972,6 @@ function! s:set_context_filetype()"{{{
" Set text mode or not.
let syn_name = neocomplcache#get_syn_name(1)
- let s:is_text_mode =
- \ (has_key(g:neocomplcache_text_mode_filetypes, s:context_filetype)
- \ && g:neocomplcache_text_mode_filetypes[s:context_filetype])
let s:within_comment = (syn_name ==# 'Comment')
" Set filetype plugins.
@@ -84,11 +84,7 @@ endfunction"}}}
function! s:source.get_keyword_list(cur_keyword_str)"{{{
let list = []
- let filetype = neocomplcache#is_text_mode() ? 'text' : neocomplcache#get_context_filetype()
- if neocomplcache#is_text_mode() && !has_key(s:dictionary_list, 'text')
- " Caching.
- call s:caching()
- endif
+ let filetype = neocomplcache#get_context_filetype()
for ft in neocomplcache#get_source_filetypes(filetype)
call neocomplcache#cache#check_cache('dictionary_cache', ft,
@@ -109,8 +105,7 @@ function! s:caching()"{{{
return
endif
- let key = neocomplcache#is_text_mode() ?
- \ 'text' : neocomplcache#get_context_filetype()
+ let key = neocomplcache#get_context_filetype()
for filetype in neocomplcache#get_source_filetypes(key)
if !has_key(s:dictionary_list, filetype)
\ && !has_key(s:async_dictionary_list, filetype)

0 comments on commit ed6bc43

Please sign in to comment.