R-nvim / R.nvim

Neovim plugin to edit R files
GNU General Public License v3.0
155 stars 16 forks source link

`reprex` not working (file not found) #75

Closed PMassicotte closed 6 months ago

PMassicotte commented 6 months ago

Trying to run this, I get an error:

reprex::reprex({
  plot(1)
}, std_out_err = TRUE)
Error in abs_path(input) : 
  The file 'super-sable_reprex.R' does not exist.
In addition: Warning message:
In normalizePath(x, winslash = winslash, mustWork = must_work) :
  path[1]="super-sable_reprex.R": No such file or directory

This works fine in radian outside nvim. My guess it has to do with relative path, but I can not find why at this time.

jalvesaq commented 6 months ago

I confirm that it works with setwd = "no" (I have vim.o.autochdir = true in my init.lua). The option was introduced in 2014: https://github.com/jcfaria/Vim-R-plugin/pull/99 Perhaps we should change the default value of setwd to "no"...

PMassicotte commented 6 months ago

I have it set to "yes". Doing some test , will come back in a few.

PMassicotte commented 6 months ago

Perfect, switching it to setwd = "no", solve this. I think it would be best making the default to no. My 2 cents.