Duplicate question because I can not comment (Shortcut for commenting in Rmarkdown?)
in Rstudio using shift-cmd(ctrl)-c or the 'comment/uncomment' line option produces a '#' that comments out the line in the editor, but upon compiling does not comment out the line.
using " " comments out the line when compiled, but does not change the Rstudio font, making it difficult to use Rstudio for editing.
Am I missing something?
You can use cmd-shift-c (or ctrl-shift-c on Windows) to produce the comment symbol. The comment tag added varies depending on which section of the document you are working in.
If you are working inside an RMarkdown chunk then # will appear.
To comment out text outside the code chunk with <!-- --> you first need to have some text entered on the line you wish to comment then, with the cursor located anywhere on the same line, try using the shortcut.
<!-- RMarkdown text wrapped in a comment -->
```{r}
# Comment inside code chunk
```
Note commenting outside a code chunk using the shortcut doesn't work for me on a line containing only whitespace. I don't think this was the case in the previous version of RStudio (I'm using Version 1.1.383) but perhaps it's my memory that's faulty!
Related
I would like to add these Quarto code snippets to the RStudio IDE:
# quarto callout note
snippet con
:::{.callout-note appearance=minimal}
${1:text}
:::
# quarto callout warning
snippet cow
:::{.callout-warning appearance=simple}
${1:text}
:::
The editor will only expand the snippets if the text is inside a code chunk. Is there a fix/work-around to allow snippets in plain text?
These snippets are expanding only inside the r-code chunk for your case, probably because you have defined these snippets in the R snippet. Instead, You need to add these snippets for Markdown to get these work.
So go to Tools > Global Options > Code > Editing > Edit Snippets, and then go to the section Markdown and paste these snippets there. Save, OK, apply.
Now after writing con in qmd file and then press shift + Tab.
Also be careful about pasting the snippet, so that any extra space doesn't get pasted with these. (While I tried to paste these snippets, these didn't work at first, because of extra spaces were pasted before :::)
I use PyCharm 2016.2 to write my Python programs. Some of my in-line comments look a little messe:
code # comment
code # comment
more code # comment
Is there a way to have PyCharm automatically align all in-line comments in a section or file on a vertical line. So it looks like this:
code # comment
code # comment
more code # comment
Related to that: I tried doing it manually, but PyCharm sometimes messes up my indentation of comments, e.g., when copying code. How can I change that?
In Pycharm, do this while your script is open: Click on Code, then click on Reformat Code (or use the shortcut). I tried it on your example and it worked.
Note: If you only want to reformat part of your script, first run your mouse over the desired portion of the script to select it. Then follow above procedure.
Im using CKEditor as a part of Grocery Crud (this is a php codeignihter crud setup), which uses CKEditor (3.6.5) to edit text fields.
So the problem im having is, some special characters (like Ā) gets somewhat stripped from CKEditor (this happens in the latest version too). Can someone help me make sure these special characters gets treated correctly (specially if there is any flags that i can set maybe)?
To test, just open up a CKEditor anywhere (use the Full demo on the CKEditor website), click the "source" button (to see html mode), then paste the following in the editor: Ā. Then click the source button again (to see the wysiwyg mode) and you will see a Letter A with a line above it. Then click the source again (to see html mode) and you will see that the characters you entered Ā have been replaced by the Letter A with the line above it.
Any thoughts about keeping CKEditor from stripping out the character codes?
The above only happens for some special characters (ones that uses decimal or hex codes) and not others which is a bit strange. And some character codes (that uses hex/decimal) get changed to some other codes (that has non hex/decimal alternatives, which is strange but atleast you end up with the same result).
Alright, let me answer my own question.
You need to add the following to the config:
config.entities_processNumerical = true;
In the case of grocery crud, this is done on the following file: /assets/grocery_crud/texteditor/ckeditor/config.js
More doccumentation can be found here: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.entities_processNumerical
To be fair though, im surprised this is not enabled by default. Not quite sure why.
My question is related to this topic How to copy and paste code without rich text formatting? except its from the opposite viewpoint: I'm creating a document from PowerPoint in which I have code snippets in text boxes. I want to make the document as simple as possible by making the code snippet text boxes easy to copy and paste the code into a terminal to run without editing anything. However, the way I have it right now is that when I copy and paste it keeps the formatting and I have to go though letter by letter to erase the end of line symbols. How should I format this in PowerPoint?
You can get rid of most formatting by copy/pasting from PPT to Notepad and then copy/pasting from there to your terminal program, or if the latter has a Paste Special command, you should be able to paste as plain text, which'd get rid of formatting.
Line/Paragraph breaks are another matter. If the end of line symbols are the only formatting problem when you've pasted the text into a terminal (emulator program, I assume), it sounds as though the terminal's using CR or LF as a line ending, whereas PPT's using CR/LF pairs. It might only be necessary to reconfigure the terminal software to use CR/LF.
It's worth a look at this page on my site, where I explain what line and paragraph ending characters are used by different versions of PowerPoint in different situations.
Paragraph endings and line breaks
http://www.pptfaq.com/FAQ00992_Paragraph_endings_and_line_breaks.htm
Sorry, my mistake was not realizing that PowerPoint auto formats hyphens and quotation marks to make them stylized, and the terminal was not recognizing the symbols. All I did was type in a quotation mark/hyphen then copying that before I pressed the space bar after it to save the original formatting.
Im facing some problems, I looked around in the forum and didnt find
any solutions discussed. Im sorry if these have been resolved earlier.
Is there someway I can make the VIM line break after 80 characters. I
dont want the text to wrap around but create a new line. And I wish it would
break off the complete last word. So instead of fo in the previous and o
in the next line, can it break with foo in the next line?
When I end my comment and press enter, I get a # in the new line. This is
cool but when I delete # and want to start a line of code, I dont get syntax
highlighting there. It still thinks what Im typing is a comment. Is this a
bug or am I doing it wrong?
One more thing is that I have set the shiftwidth to 4. But when I press
Ctrl+S to save the document, the cursor jumps to the beginning of the
sentence. I then need to manually go back to my original position to begin
the code. Is there a way I can resolve this?
Thank you for reading this. I am new to Ruby and Vim. I hope you guys help
me out.
Ctrl-S ? This is not known to me. In Vim/Gvim, a file is usually saved by
:w filename.ext (if none's been given yet)
or
:saveas filename.ext
(for all of these commands try ":help :w" or ... the same principle).
I don't know about the comment part, since I don't do Ruby, but it would be pretty wise for you to get yourself a nice commenter plugin (I think I use LineCommenter) - eases up on the commenting. Just write the comment, and add the #'s later (set it to work in normal and in visual mode; it works beautifully).
As for the breaking the text part, that could be solved by adding
:set tw=80
"wrapscan" is the vim feature that wraps a whole word to the next line; it might not be set by default in your configuration - probably isn't. So in addition to
:set tw=78 you probably want to try one of these:
:set wrapscan
:set wrap <- just a shorter version
:set nowrap <- to turn the wordwrap feature back off
Incidentally, rather than setting the text width (tw) to some number of characters (smaller than your window), you could instead set the margin you want to leave on the right side of the window like so:
:set wrapmargin=1
If wrapmargin is set to something other than 0, textwidth should be ignored.
I would use ":w" to save and continue editing (or ":w filename" if it's a new file) and "ZZ" or ":wq" to save-and-exit when you're done - none of those will move the cursor position.
I'm not sure where your "#" continuation is coming from, but I'd also make sure to set these if they aren't already (you can check what variables are set by just typing ":set" with no other options):
:set syntax=ruby
:set filetype=ruby
:syntax enable
If you started with an empty document and then added "#!/usr/bin/ruby" to it, vim won't notice you're editing ruby until you save&exit and reopen the file. There are other cases where syntax coloring isn't very bright or needs a nudge but yes, that sounds like a bug to me.