Search code examples
rrstudioparentheses

RStudio: Closing parenthesis overwritten


I am doing a stastitics course in R, and while it is pretty great in many aspects, it is annoying as hell in one. That is, if I have nested parentheses, and I want to wrap a function around something, the closing parenthesis gets overwritten, unless I am not just outside of it.

bla(xxx) # start here
blu(bla(xxx*) # Type blu, move with Ctrl+> to the star and type ')'
blu(bla(xxx)) # What I expect
blu(bla(xxx)  # What I get

Is there a way to turn this off? I could not find an option in the settings, only some regex hacking ideas on other pages.

Thanks in advance!


Solution

  • Within RStudio, go to Tools -> Global Options -> Code Within this tab, uncheck Insert matching parens/quotes. This turns this behaviour off but unfortunately also the quoting which is useful.

    Code screenshot