Skip to content
This repository has been archived by the owner on Jul 27, 2018. It is now read-only.

Support for deoplete plugins #50

Closed
JelteF opened this issue Mar 10, 2017 · 7 comments
Closed

Support for deoplete plugins #50

JelteF opened this issue Mar 10, 2017 · 7 comments
Labels

Comments

@JelteF
Copy link

JelteF commented Mar 10, 2017

There's a lot of deoplete plugins that exist. Would it be possible to add support for those in this library? Or maybe just to have full deoplete as one of the sources.

@roxma
Copy link
Owner

roxma commented Mar 10, 2017

It's easier to have full deoplete as one of the sources. But I don't want to maintain this feature. So Here's the code:

" force init deoplete then hack deoplete's mapping
call deoplete#enable()

" register as ncm source
au User CmSetup call cm#register_source({'name' : 'deoplete',
        \ 'priority': 7,  
        \ 'abbreviation': '', 
        \ })

" hack deoplete's mapping
inoremap <silent> <Plug>_ <C-r>=g:Deoplete_ncm()<CR>

func! g:Deoplete_ncm()
  " forward to ncm
  call cm#complete('deoplete', cm#context(), g:deoplete#_context.complete_position + 1, g:deoplete#_context.candidates)
  return ''
endfunc

It is possible to support deoplete's python source. But that might take a lot of work. So I have no plan for this currently.

@charliesbot
Copy link

@roxma so, by using this snippet, is not necessary to have installed deoplete too?

I wanna start using this plugin as my only autocomplete manager, but elm autocompletion sources just have support for deoplete and YCM

@roxma
Copy link
Owner

roxma commented May 11, 2017

@charliesbox

The snippet needs deoplete.

Looks like elm-vim has omni function. You could use simillar config as it is for css. Note that omni completion is running on the same thread as nvim's main thread, though. I'd rather create a plugin for ncm if I have the time.

" css completion via `csscomplete#CompleteCSS`
" The `'cm_refresh_patterns'` is PCRE.
" Be careful with `'scoping': 1` here, not all sources, especially omnifunc,
" can handle this feature properly.
au User CmSetup call cm#register_source({'name' : 'cm-css',
		\ 'priority': 9, 
		\ 'scoping': 1,
		\ 'scopes': ['css','scss'],
		\ 'abbreviation': 'css',
		\ 'cm_refresh_patterns':[':\s+\w*$'],
		\ 'cm_refresh': {'omnifunc': 'csscomplete#CompleteCSS'},
		\ })

@charliesbot
Copy link

charliesbot commented May 11, 2017

there's a PR to support deoplete :) ElmCast/elm-vim#120

That would be awesome! If I can help you to have it as fast as possible, let me know. I have never worked in a vim plugin, but I really need this autocomplete sources, and I know some others will too !

(At least, that's what I've been watching in others .vimrc files in github :) )

@roxma
Copy link
Owner

roxma commented May 11, 2017

@charliesbox

Please test this fork: https://github.com/roxma/elm-vim

I think it's working for me, though, I'm not familiar with elm.

I'll open a pr after you confirm it's working.

@charliesbot
Copy link

@roxma is not working for me :(

did you added an extra config along with the plugin?

When I press, for example, String., I don't receive a completion of the functions

@davidosomething
Copy link
Contributor

davidosomething commented May 23, 2017

Something to note when forwarding completions from deoplete as above, you should disable the following:

let g:deoplete#ignore_sources._ = {}
let g:deoplete#ignore_sources._ = [
      \   'buffer',
      \   'member',
      \   'tag',
      \   'file',
      \   'around',
       \ ]

This is because NCM already implements those completions (at relatively the same speed too).
And the around completion (nearby keywords) I've found to generally not work well and clobber the completion list when used with NCM.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants