Adding backticks more easily

Is there a shortcut or addin for the RSudio IDE to wrap selected text with backticks `like this`?

When I select some text and enter a double quotation mark, the selected text will automatically be wrapped in two quotation marks "and". It would be fantastic to have this feature for backticks as well when writing markdown documents. Currently, the text will just disappear and be replaced with two backticks.

Rstudio Version 1.1.383
German Keyboard Layout

One way to add backticks easily for inline code in markdown documents (which I just found out) is to install the remedy package:

Then bind a shortcut to the backtick addin via Tools/Modify Keyboard Shortcuts and search for backtick.

Once you select text and hit your shortcut, it will be set in `backticks`.


We've also implemented this in RStudio v1.2, which is currently available as a preview release. If you have a chance, give it a try and let us know if everything works as expected!


Thanks for the reply, Kevin. I gave it a try, but could not get it to
work in RStudio 1.2.792. Is there anything in particular I have to do?

> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 18.2

 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [7] LC_PAPER=de_DE.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods
[7] base

loaded via a namespace (and not attached):
 [1] backports_1.1.1 bookdown_0.7    magrittr_1.5
 [4] rprojroot_1.2   htmltools_0.3.6 tools_3.2.3
 [7] yaml_2.1.19     Rcpp_0.12.18    stringi_1.2.4
[10] rmarkdown_1.10  blogdown_0.6    knitr_1.20
[13] xfun_0.2        stringr_1.3.1   digest_0.6.15
[16] evaluate_0.11

Can you elaborate on exactly what you tried to do, and what you saw? I testing in a recent v1.2 build and inserting a backtick when some text is surrounded should indeed surround that selection.

Make sure you have the 'Surround text on text insertion:' preference set appropriately:

Got it to work! I have a German keyboard layout where the backtick/grave
accent is a dead key. I have to press it twice, or followed by a tab on
space bar, to make it print. That action would simply replace any
selected text.

Changing the keyboard layout to 'German(eliminate dead keys)' has done
the trick.

I only worry that my few french friends might be a little déçu from now
on :wink: