Shougo / neocomplcache.vim

Ultimate auto-completion system for Vim.
http://www.vim.org/scripts/script.php?script_id=2620
1.72k stars 135 forks source link

complete #406

Closed kdurant closed 11 years ago

kdurant commented 11 years ago
I use neocomplcache 8.0. It is very good, But can't completes from all buffers.
eg.
    There are *.c , *.v , *.txt in buffers. If I edit *.txt, it can't completes from *.c and *.v .
How to solve this problem? I want it completes from all buffers.
Shougo commented 11 years ago

:help g:neocomplcache_same_filetypes

g:neocomplcache_same_filetype_lists
        It is a dictionary to connect file type mutually.  It is
        effective at time to let you refer to c and cpp mutually.
        The value are comma-separated filetypes.
        If the value contains "_", neocomplcache completes from all
        buffers.  If the key is "_", the value will be used for default
        same filetypes.
        Note: neocomplcache completes from same filetype buffers in
        default.

        if !exists('g:neocomplcache_same_filetype_lists')
          let g:neocomplcache_same_filetype_lists = {}
        endif
        " In c buffers, completes from cpp and d buffers.
        let g:neocomplcache_same_filetype_lists.c = 'cpp,d'
        " In cpp buffers, completes from c buffers.
        let g:neocomplcache_same_filetype_lists.cpp = 'c'
        " In gitconfig buffers, completes from all buffers.
        let g:neocomplcache_same_filetype_lists.gitconfig = '_'
        " In default, completes from all buffers.
        let g:neocomplcache_same_filetype_lists._ = '_'
kdurant commented 11 years ago

I set "let g:neocomplcache_same_filetype_lists = {}",but no effect.

Shougo commented 11 years ago

You must set this.

        let g:neocomplcache_same_filetype_lists = {}
        " In default, completes from all buffers.
        let g:neocomplcache_same_filetype_lists._ = '_'
kdurant commented 11 years ago

I try it,but vim display "E121: 䶨ÒåµÄ±äÁ¿(undefine variable: g:neocomplcache_same_filetype_lists "

Shougo commented 11 years ago

Did you initialized g:neocomplcache_same_filetype_lists?

        let g:neocomplcache_same_filetype_lists = {}
        " In default, completes from all buffers.
        let g:neocomplcache_same_filetype_lists._ = '_'
kdurant commented 11 years ago

This still does not work. I only set

let g:neocomplcache_same_filetype_lists = {}            
let g:neocomplcache_same_filetype_lists._ = '_'
kdurant commented 11 years ago

it is ok now. May take time to analyze the buffer

Shougo commented 11 years ago

Yes. You can make cache manually by :NeoComplCacheCachingBuffer.

kdurant commented 11 years ago

thank you! Also I hope that many file types you can use a dictionary file, how do I set up?

Shougo commented 11 years ago
call neocomplcache#set_dictionary_helper({variable_name}, 'key1,key2,...', {value})
kdurant commented 11 years ago

what's this? I can't find it in neocomplcache.txt

Shougo commented 11 years ago

It is internal API. Not documented yet...

kdurant commented 11 years ago

soryy ,I can't use it.