Skip to main content

VS Code for R

My VS Code environment for R on Windows: install steps, settings, keybindings, extensions, and the files to rebuild it.
Published

November 8, 2026

Modified

November 9, 2026

I write R in VS Code, on more than one Windows machine. These pages describe the set-up in enough detail that I (or you) can rebuild it, and include my configuration files.

My set-up in short

I use VS Code with the vscode-R extension for all my R work, on Windows. R runs in radian, a modern R console with syntax highlighting and multi-line editing, opened in a terminal panel docked on the right. Plots go to the httpgd viewer inside VS Code. The languageserver package gives autocompletion, hover help and go to definition; lintr checks the code as I type, and styler formats it when I ask. I write documents, slides and this website in Quarto, with the Quarto extension for preview and code-chunk execution. rig manages several R versions side by side, and renv with targets keeps each project reproducible (project template). Git work happens in the built-in Source Control view, with GitLens, Git Graph and the GitHub Pull Requests extension. For AI help I use GitHub Copilot and Claude Code. The look is the built-in Visual Studio Dark theme with vscode-icons, and a set of custom keybindings (for example Ctrl+Shift+M for the pipe) makes the common R actions one keystroke. Everything is kept in one VS Code profile called R, synced between my machines.

It pairs with two other things I use daily:

The idea

One environment on every machine, with no machine-specific paths.

  • VS Code’s Settings Sync carries settings, keybindings, snippets, tasks and extensions between machines.
  • That only works if the synced files contain no user names and no install paths. So nothing in them says where R is or which version: VS Code starts radian, radian starts R, and both are found on PATH.
  • rig decides which R that is, per machine, with rig default. Changing the R version never touches VS Code.
  • The few things Sync cannot carry (task scripts, .Rprofile, PowerShell profiles) follow the same rule. .Rprofile and the PowerShell profiles are shared through OneDrive; the task scripts I copy by hand.

How the pieces fit

flowchart TB
  subgraph sync["Settings Sync"]
    profile["VS Code profile 'R'<br/>settings · keybindings<br/>snippets · tasks · extensions"]
  end
  subgraph machine["Each machine"]
    path["PATH"]
    radian["radian<br/>(Python 3.12)"]
    rig["rig shortcuts<br/>C:\Program Files\R\bin"]
    r["R x.y.z<br/>(rig default)"]
    lib["package library<br/>per R version"]
    rprofile[".Rprofile<br/>(OneDrive)"]
  end
  profile -- "r.consolePath: radian" --> path
  path --> radian
  path --> rig
  radian -- "R on PATH" --> rig
  profile -- "language server, help" --> rig
  rig --> r
  r --> lib
  r --> rprofile

The pages

Page What is in it
Install, in order VS Code, rig and R, Python and radian, Rtools, the R packages, Quarto, ripgrep, with winget commands and the versions I use.
Settings The settings of the R profile and what they do.
Keybindings My keybindings, what they replace, and the layout presets.
Extensions My extensions, grouped, with the minimum set for R and an install script.
Snippets and tasks Quarto snippets, the two VS Code tasks and their scripts.
Profiles and Settings Sync How profiles work, the sync gotcha that drops R settings, the Default and teaching profiles.
Outside VS Code .Rprofile, radian, PowerShell, git, and the PATH rules.
R versions Switching R for the machine or pinning it per project.
Troubleshooting Problems I have run into, with fixes.

Rebuild from scratch

On a new Windows machine:

  1. Install everything in the order on Install, in order (steps 1–9).
  2. VS Code profile. Either sign in to Settings Sync (on my own machines), or create a profile called R and fill it in from the published files:
  3. Sync gotcha. Make sure settingsSync.ignoredSettings is also in the Default profile (why).
  4. Outside VS Code: put .Rprofile in Documents, the task scripts in %USERPROFILE%\.vscode-scripts\, and run rig system fix-r-alias (details).
  5. Check PATH against the rules: no R_HOME, no R-x.y.z\bin, Python 3.12 first.
  6. Restart VS Code completely, open an R terminal, approve the sess installation it asks for, and run plot(1:10) (test).