This question already has answers here:
TODO comments in rStudio
(4 answers)
Closed 5 years ago.
How do I use TO DOs in RStudio? By TO DOs I mean, some special flags or comments that would stand out, so I could get back to certain things I want to rework/modify etc.
I searched on Internet as well as on Rstudio, but I don't seem to be able to find such a functionality as other IDEs have (e.g. PyCharm when I code in python). I am using comments currently, but that is very imperfect in a bigger project that is heavily commented anyway.
Can you share your tips and tricks?
Ctrl + Shift + R to create a section label that stands out. Any code that sits between this and another section label can be minimized/maximized when you need to, and you can call it TO DO.
You can also use Alt + Shift + J to jump between these section labels when you want to rework or modify them.
The answer to this question might help, I suppose.
I am not sure if it is okay to copy the full text of that answer, so briefly:
Shift + Cmd + F / Shift + Ctrl + F
enter ^\s*# TODO:
^ means the start of the string we are interested in,
\s is for any whitespace character (space, tab, line break),
and the following * implies that the whitespace character is repeated zero to an infinite amount of times;
a-a-and – run the search!
Related
This question already has answers here:
ending "+" prompt in R
(5 answers)
Closed 6 years ago.
I'm new to R Programming and have somehow gotten stuck in an argument that will not stop. I wrote view(file) and hit enter and now there is an endless string of "+" and the argument will not close. Any help would be appreciated on how to close my argument. I know I can just force quit the program, but I would rather just figure out of to end the argument. Thank You!
In R, if you keep seeing an endless string of +, it means that you didn't close a pair of either single quotes '', double quotes "", or parentheses/brackets ()/{}.
Usually, not closing a pair of parentheses or brackets produces an error sooner or later. But open quotes can keep going forever if you do not close them (or unless you terminate the command: esc in RStudio or ctrl+c if in command line).
Here is an example:
> view("file
+ i can keep
+ writing
+ until
+ i close the
+ double quote
+ , but once I do,
+ I have to also close the parentheses )
+ "
+ )
Error: could not find function "view"
>
This question already has answers here:
ending "+" prompt in R
(5 answers)
Closed 6 years ago.
After entering a complex code(where something was incorrect), instead of > sign R displays +. If I knew what is missing (oftentimes due to missing out (,),') it would be easy to fix, but I am not sure. Therefore I am "locked" with this + state and cannot escape it. Is there a way to kill it and revert back to the default prompt?
It depends on where R is running. Try CTRL+C on the keyboard, if you are running plain R. Some IDE (like RStudio) have a Stop button you can press to abort the command given.
Often Esc, the escape key works.
This question already has answers here:
Vim: underscore(_) automatically converted to (<-)
(4 answers)
Closed 8 years ago.
By default, the Vim-R-plugin inserts <- whenever I type or paste an underscore _. This creates problems when I paste stuff like geom_bar, which becomes geom <- bar. Is there a way to turn this short-cut off?
I tried looking at the manual (scroll down to Edit section) but couldn't figure out how to do it.
I'm using Vim-R-plugin Version 0.9.9.9
for Vim version 7.4.
From the help page of the plugin:
6.3. Assignment operator and Rnoweb completion of code block
...
To completely disable this feature, put in your vimrc:
let vimrplugin_assign = 0
--
EDIT: As of writing this (2019-10-25), add this to your vimrc instead:
6.4. Assignment operator and Rnoweb completion of code block
...
let R_assign = 0
I'm trying to figure out how to define a new text editing keystroke in Xcode 4.
To pick one example, Xcode does not appear to have the incredibly useful Emacs join-line function: delete the newline between the current line and the previous line AND ALSO delete any excess indentation whitespace at the beginning of the current line. ie, go in one keystroke from this:
_measurement =
[DPLMeasurement newWithDate:measureDate inManagedObjectContext:[datastore managedObjectContext]];
to this:
_measurement = [DPLMeasurement newWithDate:measureDate inManagedObjectContext:[datastore managedObjectContext]];
and NOT this:
_measurement = [DPLMeasurement newWithDate:measureDate inManagedObjectContext:[datastore managedObjectContext]];
I've seen instructions for user scripts that were apparently for Xcode 3. Does Xcode 4 no longer have anything like this?
Halley's answer to this question does ALMOST what I want:
Xcode duplicate line
Add the following to the plist file, /Developer/Library/PrivateFrameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist:
Join Previous Line
String
moveToBeginningOfLine:, moveWordRight:, moveWordLeft:, deleteToBeginningOfLine:, deleteBackward:
I say "almost" because it joins the two lines, and deletes whitespace at the beginning of the second line, but if the first line doesn't end with a space it just rams them together and I have to type in the required space. It also deletes punctuation (like open brackets) if they happen to fall at the beginning of the line. So I'm not quite there.
Can I teach Notepad++ that it should apply a fold whenever it sees a multi-line comment, where comments start with the hash mark and multi-line comments are hash marks on consecutive lines?
# This is a comment
# It continues on the next line
# and the next
# I want to fold this block
Edit
I submitted a fix to the R lexer to support multi-line comments. It includes the fix to source as well as a compiled SciLexer.dll for those who are eager to use this feature. Simply replace SciLexer.dll in the NPP folder with the one attached to the bug:
https://sourceforge.net/tracker/?func=detail&aid=3485870&group_id=95717&atid=612385
I've tested your multi-line comment with notepad++ 5.9.8 and it correctly fold as a single entity as long as there is a non-comment line between the comment groups and that the language selected has comments starting with '#' (eg: sh).
EDIT:
This seem to be language specific.
I've looked at the xml files that configure the behavior of notepad++ and it seem that this mechanic is hardcoded inside the program.
EDIT2:
The author of the question has just added comment folding support for the R languange!