1

This is an elementary question really, for which my apologies, but I have been using vim-plug as my plugin.

I usually have done the following:

call plug#begin('~/.vim/plugged')

" common develpment
Plug 'bluz71/vim-nightfly-colors'
Plug 'ryanoasis/vim-devicons'
Plug 'jalvesaq/Nvim-R', {'branch': 'stable'}
Plug 'hrsh7th/nvim-cmp'
Plug 'jalvesaq/cmp-nvim-r'
call plug#end()

and which has worked, by and large.

However, the developmental branch plugin for R.nvim at https://github.com/R-nvim/R.nvim has the following installation instruction:

  {
    "R-nvim/R.nvim",
    lazy = false
  },
  "R-nvim/cmp-r",
  {
    "hrsh7th/nvim-cmp",
    config = function()
      require("cmp").setup({ sources = {{ name = "cmp_r" }}})
      require("cmp_r").setup({ })
    end,
  },

But I can not figure out where and how to put such a snippet/chunk in. Any suggestions on what is no doubt an elementary question is very appreciated. Thanks in advance!

I tried putting:

Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'R-nvim/R.nvim'
Plug 'R-nvim/cmp-r' 

lua require("cmp").setup({ sources = {{ name = "cmp_r" }}})
lua require("cmp_r").setup({ })

but I get:

    Error detected while processing /home/username/.config/nvim/init.vim[5]../home/username/.vim/vimrcs/new-plugins.vim:
line   23:
    E5108: Error executing lua [string ":lua"]:1: module 'cmp' not found:
            no field package.preload['cmp']
            no file './cmp.lua'
            no file '/usr/share/luajit-2.1/cmp.lua'
            no file '/usr/local/share/lua/5.1/cmp.lua'
            no file '/usr/local/share/lua/5.1/cmp/init.lua'
            no file '/usr/share/lua/5.1/cmp.lua'
            no file '/usr/share/lua/5.1/cmp/init.lua'
            no file './cmp.so'
            no file '/usr/local/lib/lua/5.1/cmp.so'
            no file '/usr/lib64/lua/5.1/cmp.so'
            no file '/usr/local/lib/lua/5.1/loadall.so'
    stack traceback:
            [C]: in function 'require'
            [string ":lua"]:1: in main chunk
    line   22:
    E5108: Error executing lua [string ":lua"]:1: module 'cmp_r' not found:
            no field package.preload['cmp_r']
            no file './cmp_r.lua'
            no file '/usr/share/luajit-2.1/cmp_r.lua'
            no file '/usr/local/share/lua/5.1/cmp_r.lua'
            no file '/usr/local/share/lua/5.1/cmp_r/init.lua'
            no file '/usr/share/lua/5.1/cmp_r.lua'
            no file '/usr/share/lua/5.1/cmp_r/init.lua'
            no file './cmp_r.so'
            no file '/usr/local/lib/lua/5.1/cmp_r.so'
            no file '/usr/lib64/lua/5.1/cmp_r.so'
            no file '/usr/local/lib/lua/5.1/loadall.so'
    stack traceback:
            [C]: in function 'require'
            [string ":lua"]:1: in main chunk
Error detected which processing BugNewFile Autocommands for "*":
Error executing lua callback: /usr/share/nvim/runtime/filetype.lua:24: Error executing lua: /usr/sha
re/nvim/runtime/filetype.lua:25: BufNewFile Autocommands for "*"..FileType Autocommands for "*"..fun
ction <SNR>1_LoadFTPlugin[19]..script /home/username/.vim/plugged/R.nvim/ftplugin/r_rnvim.lua: Vim(run
time):E5113: Error while calling lua chunk: /usr/share/nvim/runtime/lua/vim/treesitter/language.lua
93: no parser for 'r' language, see :help treesitter-parsers
stack traceback:
        [C]: in function 'error'
        /usr/share/nvim/runtime/lua/vim/treesitter/language.lua:93: in function 'add'
        /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:252: in function 'parse'
        /home/maitra/.vim/plugged/R.nvim/lua/r/send.lua:642: in main chunk
        [C]: in function 'require'
        /home/maitra/.vim/plugged/R.nvim/lua/r/run.lua:7: in main chunk
        [C]: in function 'require'
        /home/maitra/.vim/plugged/R.nvim/lua/r/config.lua:739: in function 'global_setup'
        /home/maitra/.vim/plugged/R.nvim/lua/r/config.lua:803: in function 'real_setup'
        /home/maitra/.vim/plugged/R.nvim/ftplugin/r_rnvim.lua:12: in main chunk
        [C]: in function 'nvim_cmd'
        /usr/share/nvim/runtime/filetype.lua:25: in function </usr/share/nvim/runtime/filetype.lua:2
4>
        [C]: in function 'nvim_buf_call'
        /usr/share/nvim/runtime/filetype.lua:24: in function </usr/share/nvim/runtime/filetype.lua:1
0>
stack traceback:
        [C]: in function 'nvim_cmd'
        /usr/share/nvim/runtime/filetype.lua:25: in function </usr/share/nvim/runtime/filetype.lua:2
4>
        [C]: in function 'nvim_buf_call'
        /usr/share/nvim/runtime/filetype.lua:24: in function </usr/share/nvim/runtime/filetype.lua:1
0>
stack traceback:
        [C]: in function 'nvim_buf_call'
        /usr/share/nvim/runtime/filetype.lua:24: in function </usr/share/nvim/runtime/filetype.lua:1
0>

I do not know what cmp is, however, cmp-r is installed.

18
  • It look to me that the hrsh7th/nvim-cmp module is not installed properly. You should have a ~/.config/nvim-data/plugged/nvim-cmp/lua/cmp/init.lua file after the installation that the code is supposed to import. Mar 3 at 18:41
  • 1
    I don't have a ~/.local/share/nvim/plugged/nvim-cmp/lua/cmp/init.lua. however, i do have a ~/vimfiles/plugged/nvim-cmp/lua/cmp/init.lua Mar 3 at 19:30
  • 1
    I get a bunch of R commands Example: RSendAndOpenNewOne, etc on the screen, nothing is downloaded.And the errors are still there. Mar 3 at 20:51
  • 1
    Thanks @VivianDeSmedt Can I have two call plug#begin() and 'call plug#end` for different directories? Mar 4 at 13:05
  • 1
    By trial and error, the answer appears to be no, @VivianDeSmedt Mar 5 at 0:31

1 Answer 1

0

These are lazy plugin manager instructions.

From what I read it seems you need to install:

  • hrsh7th/nvim-cmp
  • R-nvim/R.nvim
  • R-nvim/cmp-r
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'R-nvim/R.nvim'
Plug 'R-nvim/cmp-r'

I would try the following vimrc configuration:

lua require("cmp").setup({ sources = {{ name = "cmp_r" }}})
lua require("cmp_r").setup({ })

Remark: On Windows for the plugin to work the following two packages must be installed:

The following path must be in the path:

  • Rtools (e.g. C:\rtools43)
  • R.exe (e.g. C:\R\bin\x64)
  • RTerm.exe (e.g. C:\R\bin\x64)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.