I have not been able to make rkward do automatic R-style indentation in the script editor. I would like to have this perform as with ESS under Emacs with auto-indenting when entering {, further indenting on the line after the opening {, revert to previous indent level with closing }, etc. Thanks for any assistance.
Frank
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Personally, I am not a fan of automatic indentation, so maybe I'm missing something. However, you can select an indentation mode using Edit->Tools Move->Indentation (probably C-style comes closest). You can set the default indentation mode using (open a script window, first) Settings->Configure Editor->Editing->Indentation.
Regards
Thomas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for your reply Thomas. C style goes part of the way, but it does not further indent the next line after a line containing {.
I find that the ESS indenting style makes for more readable R code.
Frank
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have not been able to make rkward do automatic R-style indentation in the script editor. I would like to have this perform as with ESS under Emacs with auto-indenting when entering {, further indenting on the line after the opening {, revert to previous indent level with closing }, etc. Thanks for any assistance.
Frank
Hi,
Personally, I am not a fan of automatic indentation, so maybe I'm missing something. However, you can select an indentation mode using Edit->Tools Move->Indentation (probably C-style comes closest). You can set the default indentation mode using (open a script window, first) Settings->Configure Editor->Editing->Indentation.
Regards
Thomas
Thanks for your reply Thomas. C style goes part of the way, but it does not further indent the next line after a line containing {.
I find that the ESS indenting style makes for more readable R code.
Frank
I'm not sure I understand what you mean. When I type
using C style indentation, the next line will be (further) indented automatically. Something that does not work is this example:
Is this what you mean? (But then, this coding style does not really make for readable code at all in my opinion).
Here's an example:
if(1==2)
{
y <- 1
}
is what appears. I would like the { indented as per a popular R formatting style:
if(1==2)
{
y <- 1
}
Having function arguments automatically indented in continuation lines would also be nice:
lm(y ~ x,
data=d)
Frank
Hi again,
first, for clarification, here are your examples in "code"-tags, to make them display correctly in this forum:
Now, I guess tastes differ. Personally, I find that style rather appalling ;-). But if this matters to you, and you are willing to invest a bit of time, you can write an indentation script yourself. See http://dhaumann.blogspot.com/2007/07/kate-scripting-indentation.html and http://dhaumann.blogspot.com/2007/07/kate-more-on-indentation-scripting.html . Consider posting your results to this forum or to rkward-devel@lists.sourceforge.net, then we can include this in a future release.
Regards
Thomas
Thanks Thomas - I will look into this in the future. This default style in ESS is quite nice in the view of many R programmers.