Write Rcpp Package in Vim

Plenty of tutorials have been posted online for writing Rcpp packages in Rstudio, but few tutorials mention developing R packages in vim.

After some attempt, I have figure out the solution by myself.

install requirement

  • Rcpp in R
  • neovim (with coc.nvim)
  • ccls
  • clang

set up a new project

R -e 'Rcpp::Rcpp.package.skeleton("mypackage")'
cd ./mypackage

setup project

create ccls config file (.ccls) in the project, and fill it with the following settings.

clang
%c -std=c11
%cpp -std=c++2a
-I/home/yech/.local/lib/R-3.6/library/Rcpp/include/
-I/usr/include/R

Last modified on 2023-11-01