roxma / nvim-completion-manager

:warning: PLEASE USE https://github.com/ncm2/ncm2 INSTEAD
MIT License
917 stars 49 forks source link

Disable a source when another is active #216

Closed alexlafroscia closed 6 years ago

alexlafroscia commented 6 years ago

What would be the recommended way to disable a source only when another is available?

For example, I have TypeScript completion enabled in a project. By default, I also get buffer completion. The buffer completion is fine for some languages, but is going to recommend things that aren't actually in scope, and I trust that the TypeScript completion will give me everything that's actually relevant. I want to keep the buffer completion enabled by default, but when TypeScript is available instead, turn buffer completion off.

I thought about adding something like

cm#disable_source('buffer')

to my ftplugin/typescript.vim file, but am pretty sure that would turn buffer completion off for all files once I have opened a TypeScript file.

alexlafroscia commented 6 years ago

For the time being, I decided to do this:

autocmd BufRead *.ts,*.tsx call cm#disable_source('cm-bufkeyword')
autocmd BufRead *.ts,*.tsx call cm#disable_source('cm-tmux')
roxma commented 6 years ago

Discussion should move to https://github.com/ncm2/ncm2/issues/3