Closed Millani closed 5 years ago
Thanks for the bug report.
I'll have to check on that a bit later when I have more time, but it's possible that it has to do with the https://github.com/roxma/vim-hug-neovim-rpc Vim support, which is still experimental. ncm-R works for me with vim8 though.
If you had time to test your setup with neovim, that would be helpful as well.
Hi @gaalcaras thanks for the quick follow-up. I had a few minutes to try it in Neovim and got the same problem, with basically same error messages:
[ncmR] Can't find completion files. Please load the R packages you need (e.g. "base" or "utils").
[ncm_r@yarp] Traceback (most recent call last):
[ncm_r@yarp] File "/home/millani/.vim/plugged/nvim-yarp/pythonx/yarp.py", line 65, in <module>
[ncm_r@yarp] module_obj = importlib.import_module(module)
[ncm_r@yarp] File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
[ncm_r@yarp] return _bootstrap._gcd_import(name[level:], package, level)
[ncm_r@yarp] File "<frozen importlib._bootstrap>", line 994, in _gcd_import
[ncm_r@yarp] File "<frozen importlib._bootstrap>", line 971, in _find_and_load
[ncm_r@yarp] File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
[ncm_r@yarp] File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
[ncm_r@yarp] File "<frozen importlib._bootstrap_external>", line 678, in exec_module
[ncm_r@yarp] File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
[ncm_r@yarp] File "/home/millani/.vim/plugged/ncm-R/pythonx/ncm_r.py", line 303, in <module>
[ncm_r@yarp] SOURCE = Source(vim)
[ncm_r@yarp] File "/home/millani/.vim/plugged/ncm-R/pythonx/ncm_r.py", line 37, in __init__
[ncm_r@yarp] self.get_all_pkg_matches()
[ncm_r@yarp] File "/home/millani/.vim/plugged/ncm-R/pythonx/ncm_r.py", line 128, in get_all_pkg_matches
[ncm_r@yarp] comps = [f for f in listdir(cmp) if 'omnils' in f]
[ncm_r@yarp] FileNotFoundError: [Errno 2] No such file or directory: ''
[ncm_r@yarp] Job is dead. cmd=['/usr/bin/python3', '-u', '/home/millani/.vim/plugged/nvim-yarp/pythonx/yarp.py', '/tmp/nvimZukDPz/0', 5, 'ncm_r']
Thanks for trying it out with nvim.
Then it's a problem with accessing the completion files generated by Nvim-R. Have you started Nvim-R first? Can you check if the directory g:rplugin_compldir
exists on your system? If so, please paste the output of ls
of that directory.
Hi @gaalcaras thanks for your feedback. Ok, I had installed Nvim-R but never initialized a terminal with it, for instance with <localleader>rf
, because I have been using Slime to send R code directly to Vim 8.1 terminals. Therefore, I did not have any g:rplugin_compldir
directory created - hence the error message I was getting. Upon opening a Nvim-R terminal, that was solved and then the autocompletion started working as expected.
Last question. The folder that I get g:rplugin_compldir
pointing to is home/millani/.chace/Nvim-R/
. So, because it's in cache folder, does this mean that eventually it will stop working again until I explicitly open a R terminal with Nvim-R? If so, that is annoying and hence my question: couldn't one simply set g:rplugin_compldir
to a manually created folder that has all contents from home/millani/.chace/Nvim-R/
to make this permanent?
Thanks!
A cache directory is not necessarily a temporary directory, so unless you manually remove the cache directory you should be fine. But you can still set up a custom completion directory if you'd like, see :help R_compldir
.
Also, keep in mind that ncm-R works hand in hand with Nvim-R, so you could miss on some completion features if you use something else to interact with the R console.
Hi, I have been successfully working with NCM2 + Python for a while, and today needed to also get autocompletion for R. I just installed
ncm-R
by pasting the relevant installing code in my.vimrc
. The plugin seems to have been properly installed in my.vim/plugged
folder.However, every time that I open any
.r
file, I get an error. See the output of my:messages
:In case it helps, I am using gVim 8.1 (same happens with Vim 8.1) on Ubuntu 18.04.