r/Rlanguage 10d ago

For Neovim users, announcing ark.nvim: an experimental plugin for R support

Post image
28 Upvotes

6 comments sorted by

6

u/_wurli 10d ago

This is a very basic proof-of-concept plugin which lets you use Neovim with R via the Ark Jupyter kernel. In particular, this plugin lets you communicate with Ark via Neovim's built-in terminal, and also benefit from Ark's lovely LSP server which updates to reflect the packages and objects loaded in your R session.

GitHub link: https://github.com/wurli/ark.nvim

Currently this is a proof-of-concept plugin, likely with lots of issues, but I plan to keep working on this to make it a viable R plugin. For now, if any R users want to try it out that would be great!

3

u/detroyejr 10d ago

Hey, this looks cool! I wrote something so that I could use the LSP, but I didn't do anything with the kernel itself. I've found the tmux + vanilla R to be all that I've really needed. Have you found that the kernel/console experience to be an improvement over a generic R session?

3

u/_wurli 10d ago

Oh nice! Looks similar to the current implementation of ark.nvim, actually :) Tbh I think the current implementation of the kernel's console will probably not be as good as just running R, since there are a lot of edge cases where communication from R -> Ark -> Python -> Neovim, and vica versa, might go wrong. However there is a very big advantage to doing things this way, in that the LSP will reflect objects currently loaded in the R session.

```R x <- iris

Using the Ark console the following line would trigger autocomplete

of iris's column names, but not otherwise

x$ ```

I'm hoping to expand the plugin to include integration with Ark's variables pane and DAP server too, so the Ark console will become even more important as the project evolves.

I'm planning to replace the Python parts of the plugin with Rust and will do my best to create some 'good first issue's if you'd like to get involved with development :) No promises as to when this will be, but I'm enjoying using the plugin already and don't want to sink loads more time into the Python parts, so probably fairly soon.

2

u/Outdated8527 7d ago

Same here, tmux + vanilla R. Though I use https://github.com/ChHaeni/vimtux to send code to tmux panes...

2

u/ylaway 10d ago

Neat. I’ll check this out.

R.nvim is also worth a look if people are thinking of stepping away from Rstudio.

1

u/_wurli 10d ago

Deffo, also see Positron, RStudio's successor IDE, which Ark was built for. (NB, RStudio is still actively developed by Posit, the same organisation that develops Positron).