Change R assignment operators to red complete arrows in VSCode? - r

I am new to VSCode and trying to use R in VSCode.
I was wondering how to change R assignment operators to the red ones(arrows) as showed in the VSCode website.
Here is the website:
https://code.visualstudio.com/docs/languages/r#_code-completion-intellisense

You need to have a font with ligatures. One of the most common to use is FiraCode. To install it, check here.
Then, in VSCode, go to settings.json and paste the following lines (check the full instructions here.
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": true
After that, close/reopen VSCode, and it should work.

Related

R extension on VS Code - keyboard shortcut NOT working

I have installed R extension and radian to use R from VS code.
I wanted to run selected line(s) as I do in Rstudio.
Even though it appears to be set among "Keyboard Shortcuts" the shortcut cmd+enter (see pic) doesn't seem to work. Anyone can think of why?
I figured it out!
First a clarification: the issue was only affecting code in *.rmd|*.Rmd files, while normal *.R script were doing OK.
As for the *.rmd files, following the instructions here I added this in my settings.json file:
{
"files.associations": {
"*.Rmd": "rmd"
}
}
Now my shortcut cmd+enter works like a breeze ✅
PS: there may be issues also with conflicting keyboard shortcuts. In fact I deleted some that I have no interest in, but that did not solve it.

Indenting VSCode like RStudio

I'm using VS Code and i miss RStudio's ctrl+i to indent lines.
I've read stuff online about LSP and other extensions and formatting with shift+alt+F but all i get is linter.
So, whats the equivalent if is there at all?
Found a solution but there a few things to take note.
First, VSCode notive options are language-agnostic, meaning it can't indent R code 'cause it doesn't understand it. You got to download extensions to make i work.
Extensions required are
Yuki Ueda's R for language support
REditorSupport's R LSP Client
Also, in order to R LSP Client to work, CRAN package {languageserver} is required.
Then, usage. If you're working functions, differently from RStudio in which one can hit ctrl+i and that'd indent that specifically line or selection, this solution works only if one selects the entire function. If you have functions inside another, you gotta indent everything (won't work for just a foo inside another).

Jupyter QtConsole: select one of the built in CSSs as the default via configuration

I am using Jupyter in Windows.
I mean to change coloring of the QT console.
How can I select one of the built in CSSs as the default, via configuration file?
I mean to avoid passing it as an argument as in jupyter qtconsole --style monokai.
I would rather use a configuration file, e.g. file1 = %USERPROFILE%\.jupyter\jupyter_qtconsole_config.py
What I ultimately want to do is write monokai in some configuration file, and have the QTconsole load the built-in monokai.
What I tried so far:
As a test, execute
jupyter qtconsole --style monokai.
It actually brought monokai (white fgr on dark gray bgr). Moreover, it combined well with my selected c.ConsoleWidget.font_size = 12 in file1.
Then, trying to use my own css.
I copied a monokai.css file in C:\Users\user1 (I have quite a few in my system, but I guess any one should work for the most basic stuff).
In file1 I included one of the lines
c.JupyterQtConsoleApp.stylesheet = u'C:/Users/user1/monokai.css'
c.JupyterQtConsoleApp.stylesheet = 'C:/Users/user1/monokai.css'
c.JupyterQtConsoleApp.stylesheet = 'C:\\Users\\user1\\monokai.css'
None worked.
If I made this work, I would still have to find how to replace the specification of a file as a location by a simple CSS name among the built-in.
PS: I know I could also set a Windows shortcut that launches jupyter qtconsole --style monokai.
I also mean to avoid this.
This is a solution, but I am not certain it is the only one, or if it is the most portable across systems.
Note: there might be some issues, yet to be solved, in the way this configuration works, see https://github.com/jupyter/qtconsole/issues/334
Use
c.JupyterWidget.syntax_style = 'monokai'
in file %USERPROFILE%\.jupyter\jupyter_qtconsole_config.py
or ~\.jupyter\jupyter_qtconsole_config.py.
Inspired by this.

Syntax Highlighting for R in Macvim

I use R and I find some of the embedded editor's characteristics annoying. Typically, it would be convenient to have the possibility to add tabs or even bette to do splits like you can do it with vim.
I have a Mac running Mavericks and I use Macvim. I want to use vim as my R editor, without using it as an IDE.
However, the syntax highlighting is not convincing. The functions are not recognized for instance.
I installed the Vim-R-plugin (I followed these instructions). However, I found no change in my syntax highlighting.
Do you have any suggestions?
R-Studio is a development environment for R. It is very light and powerful and it offers some embedded themes to highlight code.
You can use it as editor only...

vi input mode in R?

I'd like to be able to edit my R history using vi commands (e.g. ESC-/, ESC-k). I noticed a similar question here:
vi input mode in command line Matlab?
and tried the readline mods suggested in this post (doesn't R use readline?) but they don't work (for me).
Any ideas?
The Vim-R-plugin should do the trick. I have used it in Ubuntu, MacOS, and Windows 7. The developer is great and does frequent bugfixes.
To get Vim behavior in the R console you'll need to use the Conque Shell plugin, which Vim-R-plugin supports. I tried it for a day but found modality in the R command line a little tedious. All I ever use is tab completion and last command.

Resources