Daniel
Daniel

Reputation: 618

Keyboard shortcut for code chunk in R Markdown for windows gives í

Using RStudio for windows. Help says keyboard shortcut for inserting code chunk is Ctrl + Alt + i, which should give me:

```{r}

```

Instead, I get í (accented i, not bold...)

What is the keyboard shortcut to insert code chunks in this case?

Upvotes: 23

Views: 15460

Answers (9)

Silverfish
Silverfish

Reputation: 1954

Open the Windows onscreen keyboard and press CTRL + ALT to see what keys are available with those held down. With all my region and language settings set as "United Kingdom" and "English (United Kingdom") it looks like the "í" is what I'm stuck with:

Windows onscreen keyboard

English (United Kingdom) settings

Most of the answers here seem to deal with US users with the "wrong" keyboard settings, but for British users the "right" settings still produce the í problem (and changing to a non-UK layout is not an attractive option). The alternative is to customise the keyboard shortcuts in RStudio:

https://support.posit.co/hc/en-us/articles/206382178-Customizing-Keyboard-Shortcuts

Note that several other RStudio shortcuts might be affected by the same problem, these keyboard shortcuts just insert á, é, í and ú for me:

https://support.posit.co/hc/en-us/articles/200711853-Keyboard-Shortcuts-in-the-RStudio-IDE

Ctrl+Alt+A: Split into lines
Ctrl+Alt+E: Execute Code From Current Line to End of Document
Ctrl+Alt+I: Insert chunk
Ctrl+Alt+U: Find usages

Upvotes: 4

JesusP
JesusP

Reputation: 13

I had this same problem. I was trying to execute the shortcut on a filetype that was not .Rmd.

Upvotes: 0

Ulra
Ulra

Reputation: 11

Make sure to do it on an R Markdown (HTML) file. I was trying to do it on an R script and of course it was not working (I am a total beginner in R and only needed to use scripts so far). Nothing to do with the shortcuts or keyboard configuration.

Upvotes: 1

Sacristan
Sacristan

Reputation: 11

actually was searching for a solution since I got the same problem. I am running RStudio on Windows10 with ENG-US Keyboard and Ctrl+Alt+I didn't create a new RMarkdown chunk.

Nevertheless, there is an option on the menu that works: Code >> Insert Chunk (Ctrl+Alt+I).

I thought about the bindings (Tools >> Global Options >> Code >> Modify Keyboard Shortcuts ) after reading this thread and saw the following:

Insert Chunk R => Ctrl+Cmd+I (as opposite to Ctrl+Alt+I)

On windows we don't have Cmd key, but Windows key, so I tried **Ctrl+WindowsKey+I** and it worked!!.

Give it a try!

Upvotes: 1

Kavindu Nuwandika
Kavindu Nuwandika

Reputation: 31

The Case is Happening when you select Keyboard Type (ENG - INTL) or Some Other. Change Your Keyboard by pressing (Windows + Space) and Select Keyboard Type(ENG - US)

Upvotes: 3

Neha Tyagi
Neha Tyagi

Reputation: 1

I have a laptop with Windows 10 Home installed. Under "Typing Settings" --> "Advanced Keyboard Settings" --> chose "English (Singapore) - US". That fixed the issue.

Upvotes: 0

vlad1490
vlad1490

Reputation: 365

Fastest way is to assign new Shortcut:

Tools >> Modify Keyboard Shortcuts >> find relevant Shortcut >> click inside >> Add new shortcut

Upvotes: 4

rosan.fiqri
rosan.fiqri

Reputation: 61

I've faced similar problem. To solve it, I changed the keyboard setting, I use windows 10:

start -> setting -> time & language -> Region & language -> below +add language click the windows display language - > options -> add a keyboard, I choose US Qwerty -> change the keyboard on the right bottom of the corner side beside date & time, change it to eng us keyboard

Upvotes: 6

Shawn Azdam
Shawn Azdam

Reputation: 6160

On Mac OS you can use this shourtcut:

+ + I

Upvotes: 1

Related Questions