jalvesaq / Nvim-R

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

Missing option to send chunks #737

Closed PMassicotte closed 1 year ago

PMassicotte commented 1 year ago

First, thank you for this great plugin. Secondly, please forgive me if this is a basic question, I am new to vim.

I have installed the plugin successfully and made sure to have the leader and localleader key mapped differently as recommended.

vim.g.mapleader = ' '
vim.g.maplocalleader = ';'

However, it seems that I do not have the option to send the current chunk to the console:

image

In fact, I do not have access to any chunk (c) commands.

Any ideas what I missed?

Thanks

jalvesaq commented 1 year ago

What file type are you editing? What is your version of (Neo)Vim? The chunk commands should be available for both Rmd and Quarto file types.

PMassicotte commented 1 year ago

By bad, I was also thinking to send a r section (as defined within R Studio, to the console. Indeed it works fine. I will search around how to do this, but sending rmd and quarto chunks works fine.

jalvesaq commented 1 year ago

One useful feature is sending marked blocks. For example, if you press in Normal mode ma on one line and mb on other line, then you can use <LocalLeader>bb to send the block of code between the two lines to R, and this will work even if you either remove or add lines to the block. Currently, I use the marks.vim plugin to see the marks, but there are other plugins that do the same.

PMassicotte commented 1 year ago

Very nice! If you do not mind, is it possible to set up keybinding to run a r plugin? One I am using is https://github.com/MilesMcBain/breakerofchains which will run a current chain (defined by pipes) up to the cursor positon.

jalvesaq commented 1 year ago

I avoid adding support for specific R packages. So, it will be better if someone develops a complement to Nvim-R doing this. Please, see R_source in Nvim-R's documentation.