Skip to content

Instantly share code, notes, and snippets.

@kar9222
Last active June 14, 2021 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kar9222/0a0d22db4bd8d6ca1652f97305538b07 to your computer and use it in GitHub Desktop.
Save kar9222/0a0d22db4bd8d6ca1652f97305538b07 to your computer and use it in GitHub Desktop.
Use R help system with Vimium

Use R help system with Vimium

GIF can't be uploaded. Not sure why. See here if you want...directly on imgur website

R_help R_help

I use R help in browser for

  • Vim keybindings with Vimium, particularly useful for
    • navigate up/down
    • navigate forward/backward page
    • open multiple links
    • search
    • hyperlinks
    • etc
  • I prefer reading documentation on white background
  • Style page with custom CSS (see below) with Stylebot
  • Type e.g. ?grepl in R REPL to fire up the browser
  • Quite often, when reading R docs, quite often I need to browser other stuffs, for example, StackOverflow, etc.

Have been using this setup for a while. I am enjoying it so far.

My Setup

.Rprofile

options(
    # Disable VSCode's built-in help system. See [VSCode-R](https://github.com/Ikuyadeu/vscode-R)
    vsc.helpPanel = FALSE,

    browser = function(url) {
      # Customize my_browser. Use browser app mode to hide url bar.
      system2('my_browser', url, stdout = FALSE, stderr = FALSE)
      # e.g. Chrome on Linux
      # system2('google-chrome-stable', ...)
      # e.g. Chrome on Windows
      # system2('chrome.exe', ...)
    })

Style page with custom CSS (see below) with Stylebot

Set custom site with wildcard e.g. */library/, */doc

/* General --------------------------------------- */

body, a,
h1, h2, h3, h4, h5, h6 {
    background: #f9f5e8;
}
h1, h2, h3, h4, h5, h6 {
    font-family: Consolas;
    font-size: 16px;
    font-style: italic;
    color: #1F454F;
}
a:link    { color: #008080; }
a:visited { color: #6E7C98; }

/* Code ------------------------------------------ */

pre, code {
    font-family: Fira Code;
    font-size: 12px;
    color: #03224B;
}
pre { box-shadow: 0px 1px 4px 3px #f4ecd2; }
code { background: #f4eed7; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment