jalvesaq / Nvim-R

Vim plugin to work with R
GNU General Public License v2.0
965 stars 125 forks source link

Plugin doesn't seem to work with Neovim but works with Vim (sort of) #113

Closed sriramkswamy closed 8 years ago

sriramkswamy commented 8 years ago

I installed this plugin using vim-plug in both Vim and Neovim.

My Vim version is 8.0 and Neovim version is 0.1.6-dev.

The plugin works in Vim, .i.e., I'm able to start R using \rf but it starts in a separate tab rather than a tmux pane.

The binding \rf doesn't do anything in Neovim. :Rhelp returns Not an editor command and :nmap has no maps for R. I also tried installing it as a vimball and releases.zip. Neither worked.

I'm on OS X El Capitan 10.11.6 and use iTerm (but it doesn't work with Neovim on Terminal either).

jalvesaq commented 8 years ago

I use Neovim, and the plugin works with it here. Could you be more specific, please? Is there any error message? Are you sure the plugin is properly installed?

jalvesaq commented 8 years ago

Note: Vimball is loaded by default by Vim, but it is an optional package in Neovim.

sriramkswamy commented 8 years ago

I updated the comment with more details (I pressed enter by mistake before I was done typing. Sorry about that). I use the same installation method with both Neovim and Vim - vim-plug and the plugin works well in Vim but not in Neovim. I'm able to use :Rhelp in Vim but not in Neovim. However, the help tags are present in both Neovim and Vim.

And when installing via Vimball, I do add :packadd Vimball first to add it before doing :so %.

jalvesaq commented 8 years ago

I used to have a symbolic link to my Nvim-R directory in ~/.local/share/nvim/site/pack/R/start. But I deleted it 5 minutes ago and put in my ~/.config/nvim/init.vim:

Plug 'jalvesaq/Nvim-R'

and restarted nvim and typed :PlugUpdate. Finally, I restarted nvim and the plugin still works.

That is, here, Nvim-R works fine when managed by Vim-plug.

sriramkswamy commented 8 years ago

Then I'm stumped.

I have the exact same configuration in both my .vimrc and init.vim and it is just

Plug 'jalvesaq/Nvim-R'

This works perfectly in Vim (except for the Tmux pane) but completely fails to load in Neovim.

I deleted just this plugin and reinstalled it. I deleted the entire plugged directory and reinstalled. I tried installing via Vimball and Vim package again. Nothing worked in Neovim. Is there a way to manually load all the files?

On a sidenote, I don't have any file called start in ~/.local/share/nvim/site/pack/R/. Is that a problem because I didn't quite understand the symbolic link part?

jalvesaq commented 8 years ago

It's not feasible to load the files manually. I have never done this. Things that you can try:

mkdir -p ~/.local/share/nvim/site/pack/R/start
cd ~/.local/share/nvim/site/pack/R/start
git clone https://github.com/jalvesaq/Nvim-R.git
sriramkswamy commented 8 years ago
     1: ~/.config/nvim/init.vim
     2: ~/.config/nvim/autoload/plug.vim
     3: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/macros/matchit.vim
     4: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/autoload/provider/python.vim
     5: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/autoload/provider/pythonx.vim
     6: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/autoload/remote/host.vim
     7: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/ftoff.vim
     8: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/filetype.vim
     9: ~/.config/nvim/plugged/ultisnips/ftdetect/snippets.vim
    10: ~/.config/nvim/plugged/vim-polyglot/ftdetect/polyglot.vim
    11: ~/.config/nvim/plugged/tern_for_vim/ftdetect/tern.vim
    12: ~/.config/nvim/plugged/vim-go/ftdetect/gofiletype.vim
    13: ~/.config/nvim/plugged/sparkup/ftdetect/hsb.vim
    14: ~/.config/nvim/plugged/Nvim-R/ftdetect/r.vim
    15: ~/.config/nvim/plugged/vim-polyglot/after/ftdetect/rspec.vim
    16: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/ftplugin.vim
    17: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/indent.vim
    18: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/syntax/syntax.vim
    19: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/syntax/synload.vim
    20: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/syntax/syncolor.vim
    21: ~/.config/nvim/plugged/vim-textobj-user/autoload/textobj/user.vim
    22: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/syntax/nosyntax.vim
    23: ~/.config/nvim/colors/PaperColor.vim
    24: ~/.config/nvim/plugged/vim-peekaboo/plugin/peekaboo.vim
    25: ~/.config/nvim/plugged/vim-peekaboo/autoload/peekaboo.vim
    26: ~/.config/nvim/plugged/vim-rooter/plugin/rooter.vim
    27: ~/.config/nvim/plugged/twcmd.vim/plugin/twcmd.vim
    28: ~/.config/nvim/plugged/vim-grepper/plugin/grepper.vim
    29: ~/.config/nvim/plugged/vim-repeat/autoload/repeat.vim
    30: ~/.config/nvim/plugged/vim-qfreplace/plugin/qfreplace.vim
    31: ~/.fzf/plugin/fzf.vim
    32: ~/.config/nvim/plugged/fzf.vim/plugin/fzf.vim
    33: ~/.config/nvim/plugged/editorconfig-vim/plugin/editorconfig.vim
    34: ~/.config/nvim/plugged/visualrepeat/plugin/visualrepeat.vim
    35: ~/.config/nvim/plugged/switch.vim/plugin/switch.vim
    36: ~/.config/nvim/plugged/inline_edit.vim/plugin/inline_edit.vim
    37: ~/.config/nvim/plugged/vim-over/plugin/over.vim
    38: ~/.config/nvim/plugged/targets.vim/plugin/targets.vim
    39: ~/.config/nvim/plugged/vim-indent-object/plugin/indent-object.vim
    40: ~/.config/nvim/plugged/vim-textobj-variable-segment/plugin/textobj/variable-segment.vim
    41: ~/.config/nvim/plugged/vim-textobj-function/plugin/textobj/function.vim
    42: ~/.config/nvim/plugged/vim-textobj-comment/plugin/textobj/comment.vim
    43: ~/.config/nvim/plugged/vim-sexp/plugin/sexp.vim
    44: ~/.config/nvim/plugged/vim-surround/plugin/surround.vim
    45: ~/.config/nvim/plugged/vim-commentary/plugin/commentary.vim
    46: ~/.config/nvim/plugged/ReplaceWithRegister/plugin/ReplaceWithRegister.vim
    47: ~/.config/nvim/plugged/vim-exchange/plugin/exchange.vim
    48: ~/.config/nvim/plugged/ultisnips/plugin/UltiSnips.vim
    49: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/autoload/provider/python3.vim
    50: ~/.config/nvim/plugged/ultisnips/autoload/UltiSnips/map_keys.vim
    51: ~/.config/nvim/plugged/vim-snippets/plugin/vimsnippets.vim
    52: ~/.config/nvim/plugged/vim-signify/plugin/signify.vim
    53: ~/.config/nvim/plugged/vim-fugitive/plugin/fugitive.vim
    54: ~/.config/nvim/plugged/vim-merginal/plugin/merginal.vim
    55: ~/.config/nvim/plugged/vim-obsession/plugin/obsession.vim
    56: ~/.config/nvim/plugged/vim-scriptease/plugin/scriptease.vim
    57: ~/.config/nvim/plugged/braceless.vim/plugin/braceless.vim
    58: ~/.config/nvim/plugged/vim-go/plugin/go.vim
    59: ~/.config/nvim/plugged/dash.vim/plugin/dash.vim
    60: ~/.config/nvim/plugged/dash.vim/autoload/dash.vim
    61: ~/.config/nvim/plugged/dash.vim/autoload/dash/defaults.vim
    62: ~/.config/nvim/plugged/vim-rails/plugin/rails.vim
    63: ~/.config/nvim/plugged/ri.vim/plugin/ri.vim
    64: ~/.config/nvim/plugged/vim-tmux-navigator/plugin/tmux_navigator.vim
    65: ~/.config/nvim/plugged/vim-eunuch/plugin/eunuch.vim
    66: ~/.config/nvim/plugged/vim-dispatch/plugin/dispatch.vim
    67: ~/.config/nvim/plugged/vim-tmuxify/plugin/tmuxify.vim
    68: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/plugin/gzip.vim
    69: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/plugin/health.vim
    70: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/plugin/man.vim
    71: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/plugin/matchit.vim
    72: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/plugin/matchparen.vim
    73: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/plugin/netrwPlugin.vim
    74: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/plugin/rplugin.vim
    75: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/plugin/rrhelper.vim
    76: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/plugin/shada.vim
    77: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/plugin/spellfile.vim
    78: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/plugin/tarPlugin.vim
    79: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/plugin/tohtml.vim
    80: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/plugin/tutor.vim
    81: /usr/local/Cellar/neovim/HEAD-b1edc8a/share/nvim/runtime/plugin/zipPlugin.vim
    82: ~/.config/nvim/plugged/ultisnips/after/plugin/UltiSnips_after.vim
 90: ~/.local/share/nvim/site/pack/R/start/Nvim-R/R/functions.vim
 91: ~/.local/share/nvim/site/pack/R/start/Nvim-R/R/setcompldir.vim
 92: ~/.cache/Nvim-R/fun_base_3.3.1
 93: ~/.cache/Nvim-R/fun_stats_3.3.1
 94: ~/.cache/Nvim-R/fun_graphics_3.3.1
 95: ~/.cache/Nvim-R/fun_grDevices_3.3.1
 96: ~/.cache/Nvim-R/fun_utils_3.3.1
 97: ~/.cache/Nvim-R/fun_methods_3.3.1
jalvesaq commented 8 years ago

You still have 1 file in plugged: plugged/Nvim-R/ftdetect/r.vim

The only files from Nvim-R that are being sourced from the pack directory are R/function.vim and R/setcompldir.vim. R/function.vim is sourced by the official syntax/r.vim and R/setcompldir.vim is sourced by R/functions.vim. That is, the plugin is installed, but the file ftplugin/r_nvimr.vim is not being sourced. Neovim is not finding ftplugin/r_nvimr.vim, but it does find R/functions.vim... I don't know the reason.

Are you using Mac OS X? It looks like there is a problem in 'runtimepath' or something like this, but I don't have access to any Mac to make tests.

jalvesaq commented 8 years ago

You could compare :scriptnames from Vim and Neovim...

sriramkswamy commented 8 years ago

Yes, I'm on Mac OS X 10.11.6.

runtimepath=
~/.config/nvim,
~/.config/nvim/plugged/vim-peekaboo/,
~/.config/nvim/plugged/vim-rooter/,
~/.config/nvim/plugged/twcmd.vim/,
~/.config/nvim/plugged/vim-grepper/,
~/.config/nvim/plugged/vim-qfreplace/,
~/.fzf/,
~/.config/nvim/plugged/fzf.vim/,
~/.config/nvim/plugged/editorconfig-vim/,
~/.config/nvim/plugged/visualrepeat/,
~/.config/nvim/plugged/vim-repeat/,
~/.config/nvim/plugged/switch.vim/,
~/.config/nvim/plugged/inline_edit.vim/,
~/.config/nvim/plugged/vim-over/,
~/.config/nvim/plugged/targets.vim/,
~/.config/nvim/plugged/vim-indent-object/,
~/.config/nvim/plugged/vim-textobj-user/,
~/.config/nvim/plugged/vim-textobj-variable-segment/,
~/.config/nvim/plugged/vim-textobj-function/,
~/.config/nvim/plugged/vim-textobj-comment/,
~/.config/nvim/plugged/vim-sexp/,
~/.config/nvim/plugged/vim-surround/,
~/.config/nvim/plugged/vim-commentary/,
~/.config/nvim/plugged/ReplaceWithRegister/,
~/.config/nvim/plugged/vim-exchange/,
~/.config/nvim/plugged/ultisnips/,
~/.config/nvim/plugged/vim-snippets/,
~/.config/nvim/plugged/vim-signify/,
~/.config
runtimepath=
~/.vim,
~/.vim/plugged/vim-peekaboo/,
~/.vim/plugged/vim-rooter/,
~/.vim/plugged/twcmd.vim/,
~/.vim/plugged/vim-grepper/,
~/.vim/plugged/vim-qfreplace/,
~/.vim/plugged/editorconfig-vim/,
~/.vim/plugged/visualrepeat/,
~/.vim/plugged/vim-repeat/,
~/.vim/plugged/switch.vim/,
~/.vim/plugged/inline_edit.vim/,
~/.vim/plugged/vim-over/,
~/.vim/plugged/targets.vim/,
~/.vim/plugged/vim-indent-object/,
~/.vim/plugged/vim-textobj-user/,
~/.vim/plugged/vim-textobj-variable-segment/,
~/.vim/plugged/vim-textobj-function/,
~/.vim/plugged/vim-textobj-comment/,
~/.vim/plugged/vim-sexp/,
~/.vim/plugged/vim-surround/,
~/.vim/plugged/vim-commentary/,
~/.vim/plugged/ReplaceWithRegister/,
~/.vim/plugged/vim-exchange/,
~/.vim/plugged/ultisnips/,
~/.vim/plugged/vim-snippets/,
~/.vim/plugged/vim-signify/,
~/.vim/plugged/vim-fugitive/,
~/.vim/plugged/vim-merginal/,
~/.vim/plugged/vim-obsession/,
~/.vim/plugged/vim-polyglot/,
~/.vim/plugged/vim-scriptease/,
~/.vim/plugged/braceless.vim/,
~/.vim/plugged/tern_for_vim/,
~/.vim/plugged/vim-go/,
~/.vim/plugged/sparkup/,
~/.

Is the runtimepath supposed to indicate the Nvim-R folder? If yes, it doesn't indicate it in either Vim or Neovim but it works and loads fine with Vim. I've pasted the difference below.

Nvim-R/ftplugin/r_nvimr.vim
Nvim-R/R/common_global.vim
Nvim-R/R/vimrcom.vim
Nvim-R/R/tmux.vim
Nvim-R/R/extern_term.vim
Nvim-R/R/common_buffer.vim
Nvim-R/ftdetect/r.vim
Nvim-R/R/setcompldir.vim
Nvim-R/R/functions.vim
Nvim-R/fun_base_3.3.1
Nvim-R/fun_stats_3.3.1
Nvim-R/fun_graphics_3.3.1
Nvim-R/fun_grDevices_3.3.1
Nvim-R/fun_utils_3.3.1
Nvim-R/fun_methods_3.3.1

I'm not really sure what is causing this abnormality. I'll try to dig into this more.

jalvesaq commented 8 years ago

Nvim-R directory is indicated in my 'runtimepath'. I expected the same there. Perhaps it's the case of reporting the issue on https://github.com/neovim/neovim/issues because both Vim and Neovim should source Nvim-R/ftplugin/r_nvimr.vim (which sources common_global.vim, vimrcom.vim, etc). Linux is not affected by this issue.

sriramkswamy commented 8 years ago

Neovim should source Nvim-R/ftplugin/r_nvimr.vim

That's exactly what I did and now it works.

augroup filetype_r
    autocmd!
    autocmd FileType R source ~/.config/nvim/plugged/Nvim-R/ftplugin/r_nvimr.vim
augroup end

I am not really sure what the issue was/is but this is an ugly workaround for it. I guess I'll close this issue now.

Although the knit, sweave, chunk and PDF bindings don't work. Is there another file that I need to source?

jalvesaq commented 8 years ago

For each file type, you have to repeat your auto command. For Rnoweb:

autocmd FileType rnoweb source ~/.config/nvim/plugged/Nvim-R/ftplugin/rnoweb_nvimr.vim

This seems to be a bug in either vim-plug or neovim.

sriramkswamy commented 8 years ago

Thank you.

This seems to be a bug in either vim-plug or neovim

Yes, it does. Once I get the time, I'll bisect my config and figure out whether it's a vim-plug or neovim issue