Skip to content
Jakson Alves de Aquino edited this page Jan 9, 2026 · 22 revisions

Minimal configuration

This subsection was temporarily deleted and should be rewritten when Neovim 0.12 is released.

Using params in R Markdown

With this shortcut, you can read the YAMLheader of the.Rmdfile (the saved version of the file) into theparams` variable.

  {
    "R-nvim/R.nvim",
    keys = {
      {
        "<LocalLeader>pr",
        "<cmd>lua require('r.send').cmd('params <- lapply(knitr::knit_params(readLines(\"' .. vim.fn.expand(\"%:p\") .. '\")), function(x) x$value); class(params) <- \"knit_param_list\"')<CR>",
        desc = "read params from the YAML header",
      },
    }
  }

Using httpgd as the default graphics device

You can add this to your .Rprofile file to use the modern httpgd device as the default graphics device:

options(device=httpgd::hgd)

This requires httpgd package to be installed.

You can also bind this to a shortcut to open the browser:

      {
        "<LocalLeader>gd",
        "<cmd>lua require('r.send').cmd('tryCatch(httpgd::hgd_browse(),error=function(e) {httpgd::hgd();httpgd::hgd_browse()})')<CR>",
        desc = "httpgd",
      },

Please note that httpgd is not currently hosted on CRAN due to an issue with some upstream dependencies. The package maintainer suggests that users install the package from GitHub.

remotes::install_github("nx10/httpgd")
# Alternatively, R-Universe still hosts the package
install.packages('httpgd', repos = c('https://remlapmot.r-universe.dev'))

Using terminalgraphics as the default graphics device

Terminalgraphics is an R package that defines a graphics device and functions for graphical output in terminal emulators that support graphical output, such as Kitty and WezTerm.

If you run R in an external terminal emulator or split pane, you can add this to your .Rprofile file to use the R package terminalgraphics as the default graphics device using these settings as recommended by the package maintainer:

options(device = terminalgraphics::tgp, term_col = TRUE)

For more information about the terminalgraphics package and for a list of supported terminal emulators, please refer to the package repository.

Support for webr and pyodide

Add this to your nvim-treesitter configuration to get webr and pyodide recognized as r and python respectively:

    {
        "nvim-treesitter/nvim-treesitter",
        config = function ()
            vim.treesitter.language.register("r", "webr")
            vim.treesitter.language.register("python", "pyodide")
        end,
    }

Clone this wiki locally