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 across open buffers (Javacript) not working (CTRL-O CTRL-N works okay) #416

Closed adam-ah closed 11 years ago

adam-ah commented 11 years ago

Tried to find any reasonable solution but no luck so far. The use case is simple: I have several buffers open (Javascript files). If I press CTRL-O CTRL-N the completion correctly shows the possible endings marking the source file. However, neocomplcache only shows completions from the current buffer.

How can I convince neocomplcache

1., to use all open buffers (with same file type)? 2., scan a directory recursively for possible hits?

Thanks!


vimrc:

let g:neocomplcache_enable_at_startup = 1

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 24 2011 20:00:09) Mac OS X

Shougo commented 11 years ago

1., to use all open buffers (with same file type)?

Please read FAQ.

Q: I want to complete from all buffers.

A: |g:neocomplcache_same_filetype_lists|

    let g:neocomplcache_same_filetype_lists = {}
    let g:neocomplcache_same_filetype_lists._ = '_'

2., scan a directory recursively for possible hits?

You can use tags complete by using "ctags -R" command. But it is too heavy.

Shougo commented 11 years ago

I improved buffer cache timing. Please update and check it. And you should install vimproc.

https://github.com/Shougo/vimproc.vim

adam-ah commented 11 years ago

Thanks for the quick reply - however, I don't want to use all buffers, just all buffers with same filetype. I thought the default behaviour is to use that - so when I'm editing A.js and B.js is open as a buffer (#2) by default I would see completions from B.js in A.js.

Shougo commented 11 years ago

Please tell me the representation way. I will check.

adam-ah commented 11 years ago

Sorry, not too sure what you mean ?!

Shougo commented 11 years ago

You should update neocomplcache. I think the problem is fixed. But if it is not fixed in your environment, please tell me the representation way(command).

adam-ah commented 11 years ago

It's not fixed yet. So the way I can reproduce it: vi A.js :badd B.js MyObj. # in A.js typing the . brings up only the default functions :buffer 2 MyObjc.ban # typing the . correctly displays ban :buffer 1 MyObj.b # .ban correctly appears

Maybe adding a buffer does not refresh the cache?

Shougo commented 11 years ago

I improved for it.

UncleBill commented 11 years ago

I don't want to use all buffers, just all buffers with same filetype.

@adam-ho In some cases, we need completting from other filetypes like

Shougo commented 11 years ago

But you can custom it by g:neocomplcache_same_filetype_lists.

UncleBill commented 11 years ago

just know that. is there defualt same_filetype settings?

adam-ah commented 11 years ago

Thanks Shougo, fcaa25e9b850a256f4027a89f2398ed422b97967 seems to fix it!

Shougo commented 11 years ago

just know that. is there defualt same_filetype settings?

Because it is complicated, please refer to neocomplcache#init#_variables() in autoload/neocomplcache/init.vim for the initial value.

adam-ah commented 11 years ago

Just out of curiosity: maybe I'm doing something completely wrong but I'm not sure how people could use it before this fix? I mean completing across files is one of the most fundamental features right? So before this fix how could you complete across files? :)

UncleBill commented 11 years ago

@adam-ho <c-x><c-n> or <c-x><c-p> vim's built-in feature

adam-ah commented 11 years ago

erm... yeah, that's the title of the bug report :) However, the whole point of this plugin is to avoid using that, isn't it? :)