Site icon R-bloggers

Set-up NeoVim on Mac for R

[This article was first published on Joris Muller's blog - Posts about R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

The objective of this post is to describe step-by-step how to set up NeoVim on Mac to use it as a powerfull editor for R code. I need also a gui version of NeoVim for fast editing.

Pre-requise

I consider there is no previous neovim install. We will not import my previous configuration, I want a fresh install.

Softwares to install

Recipe

Install NeoVim and UI

brew tap neovim/neovim
brew tap rogual/neovim-dot-app
brew install neovim-dot-app
brew linkapps neovim-dot-app

If there is some problem with e.g. msgpack, try

brew install --HEAD neovim-dot-app

Install the plugin manager

With a single command proposed on the vim-plug page, create the config directory for NeoVim, the autoload directory and download vim-plug.

curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

Update your NeoVim’s config file ~/.config/nvim/init.vim

call plug#begin()

call plug#end()

Then test in NeoVim if the command Plu is autocompleted (by e.g. PlugInstall).

Install Nvim-R

Just add the repo of Nvim-R in the vim-plug section

call plug#begin()

Plug `jalvesaq/Nvim-R`

call plug#end()

Reload the NeoVim’s config file

source $MYVIMRC

And install

:PlugInstall

That’s all!

Extra

Python support

sudo pip3 install neovim

And use always system clipboard. Add in init.vim

set clipboard+=unnamedplus

To leave a comment for the author, please follow the link and comment on their blog: Joris Muller's blog - Posts about R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.