How can I prevent RStudio from turning my spaces into tabs? It seems to ignore my global options setting

こ雲淡風輕ζ 提交于 2020-05-09 05:33:09

问题


I use spaces to indent but RStudio always converts spaces into tabs. This is even though I have the "Insert spaces for tab" global option selected. Drives me batty!

Here's my settings in case I'm overlooking something.

Thanks in advance!


回答1:


This was driving me nuts too. Here's what I found (works in Rstudio Version 1.1.383 on Windows).

  • Check "Insert spaces for tab" (You've done this)
  • Set "Tab width" to 1
  • Restart Rstudio

Do this in your Global options. If you are using a project, do it in your Project Options as well (as pointed out by mowshowitz).

To see what is going on, select Global Options > Code > Display > Show whitespace characters. If you have "Insert spaces for tab" checked, it appears to truly insert spaces, but it forces your cursor to treat one tab-width's worth of spaces as a single character in the editor. By setting Tab width to 1, you can get around this limitation.



来源:https://stackoverflow.com/questions/48268178/how-can-i-prevent-rstudio-from-turning-my-spaces-into-tabs-it-seems-to-ignore-m

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!