Closed ahmedelgabri closed 7 years ago
it doesn't work trigger username completions @_ & github.com/username it doesn't work trigger repo completions github.com/username/repo
You should use 'github\.com\/\w*(\/\w*)?$'
instead of 'github\.com/\w*(/\w*)?$'
.
But the <c-x><c-o>
gets empty result with github.com/
, and github.com/repo/
. And this is where NCM cache the completion results.
Maybe I should add some option to enable always refreshing of a completion source. But it would make it really slow.
The best solution is to implement it in python, like most other ncm sources. Call self.complete
with refresh=True
it always triggers emoji completion not just after
:
You could use a higher value 'cm_refresh_min_word_len': 100,
to avoid triggering after some random word.
But When I test it with <c-x><c-o>
, it could also get triggered after @
, considering you have a pattern '@\w*$'
, ncm cannot workaround this behavior.
The best solution, emoji completion should be a standalone completion source.
You are right my regexs were not right, I checked the source code, copied the regex from there & this config works pretty ok now.
au User CmSetup call cm#register_source({'name' : 'cm-github',
\ 'priority': 9,
\ 'scopes': ['gitcommit'],
\ 'abbreviation': 'Github',
\ 'cm_refresh_patterns':[':\w*$', '#\d*$', '\[[\w\.\-]*]\($', '\%(@\|\<github\.com/\zs\)[[a-zA-Z0-9]-_]\+$', '[[a-zA-Z0-9]-_]\+/[[a-zA-Z0-9]-_]\+$'],
\ 'cm_refresh': {'omnifunc': 'github_complete#complete'},
\ })
The best solution is to implement it in python, like most other ncm sources. Call
self.complete
withrefresh=True
You mean reimplement the whole plugin or call the plugin from within Python?
You mean reimplement the whole plugin or call the plugin from within Python?
Call the plugin from python, that would have better control on the refresh triggering.
Reimplement the plugin, that would implement the non-blocking completion, since vimscript is single threaded. github completion requires network access, which is heavy weight.
Call the plugin from python, that would have better control on the refresh triggering.
Ok, any pointers on how this can be done?
https://github.com/roxma/nvim-cm-racer is good example.
To call vimscript. You could use the self.nvim
object: self.nvim.call('foo', 'arg1', 'arg2')
Thanks @roxma, will have a look :)
@ahmedelgabri FYI, this is my attempt to re-implement github-complete.vim: https://github.com/roxma/ncm-github
@roxma Great! thanks!
I think it's missing the usage of the token to be able to use it with private repos though https://github.com/rhysd/github-complete.vim#i-want-to-use-github-completevim-on-private-repositories
I don't have private github repo to test this feature.
Send PR if you need it.
@roxma I'm trying to work on the tokens/private repo part but I want to know how can I debug this in vim?
I'm trying to register github-complete.vim
But it's not really working properly here are some issues:
@_
&github.com/username
github.com/username/repo
:_
So what am I doing wrong here?