I have a txt file where part of it is json. I'd like to turn on syntax highlighting just for the part that is json. I read answers on similar questions and they said to press alt + enter to bring up a menu that will allow me to set this. But when I press alt + enter nothing happens in a .txt file.
This is the community edition.
Related
I have XML in Sublime Text 3 and I would like to use it as an example in Google Slides. The issue is when you copy the text you end up with plain text, I would like to keep the syntax highlighting as it makes it much easier to read. Is this possible? Is there some Sublime package I need?
Open the package control to install a package (Ctrl/Cmd + Shift + P):
Look for Highlight and click it:
Done! You can now right click some text and copy it as RTF:
Then you can paste that in Google Slides, PowerPoint, Word, Outlook, whatever you like.
I use CopyAsHtml pakage. It is better than SublimeHighlight pakage. You can install it according to what MS Berends said above.
CopyAsHtml pakage keeps sublime coloring exactly.
It will add another copy as HTML in your right click as you can see below.
Is there a simple way to copy syntax-coloured code block as rtf in intellij IDEA?
UPDATE: there is now a new plug-in for this: 'Copy' on steroids that is maintained by JetBrains.
There is no way to copy colored code block from IDEA directly.
A workaround is to use File | Export to HTML, then open HTML in a browser, then copy from the browser window and paste into Wordpad or MS Word.
Another and more faster way is to install the Copy as HTML plug-in in Settings | Plugins:
Copies a snippet of code as html
Adds menu items "Copy as HTML" to main menu and editor popup. Will copy the current selection or the complete editor buffer. Currently only works if focus is in editor (for example won't work in project tree).
Preserves more formatting than the built-in HTML export.
HTML is only a snippet (without html and body tags) meant to be inserted into a complete HTML document.
Currently HTML format is fixed and uses CSS a lot.
Options: unindent, add border, padding, line numbers, tabs to spaces conversion, include editor's warning and error highlighting (see IDE Settings -> Copy as HTML).
Reuses the editor "Show Line Numbers" setting (see Idea's "View" menu).
IntelliJ IDEA 15
By default, you can copy rich text from IntelliJ to Microsoft Word (for example).
This feature can be found in File > Settings... > Editor > General > Rich-text copy > Copy as rich text by default
You can also change the color scheme only for the copy-paste operation (your current scheme won't be affected).
Go to https://gist.github.com/
Copy code from IntelliJ to the new private gist;
Save it, copy colorful code from the browser to wherever you want;
Delete the gist.
Use external tool notepad++
1) copy code snippet to notepad++
2) apply syntax highlighting
3) copy with nppexport plugin to clipboard as rtf
If you're on a mac and like TextMate, here's a great way to copy styled code from TextMate: https://github.com/bblimke/copy-with-style-tmbundle
It's not as convenient as doing it directly from IntelliJ, but it's a bit more convenient than using gist or pastebin. Also, unlike the Copy as HTML Plugin for IntelliJ, this solution actually works at the time of this writing.
I recently made a code editor in vb.net for personal use. The only issue I am having is using it as my default text editor. I can open the files from inside the program using an open file dialog and the read all text command but when I double click on a text file it opens my program but the text doesn't appear in the box. I didn't expect it to be that easy but I also didn't expect it to this hard to find an answer. If there is already an open topic that I couldn't find that has the answer on it please leave me a link. Thanks.
How do you copy VBA code into a Word document and retain the VBA editor color scheme?
You can use Notepad++ to accomplish this in three ways. Just so you know, Notepad++ is a more advanced version of Notepad, which supports syntax highlighting of different code files "out of the box" - Visual Basic included!
Download & install it, fire it up, and load up your VBA code. You should automatically see it beautifully coloured (if not, because the file extension is something other than .vb, go to Language -> VB or Language -> V -> VB).
If you need to change any of the colours, you can easily do so - just go to Settings -> Styler Configurator. From that menu, you can change the various highlighting and font options, to suit your needs - although the default usually suffices for most.
Then, go to Plugins -> NppExport. From there, you have three options you can consider:
Directly print from Notepad++
Copy all formats to clipboard
Export to RTF
Export to HTML
The first is self explanatory. The second one - "Copy all formats to clipboard" - will copy the entire file with the highlighted syntax to the clipboard. Once you click it, then open Microsoft Word or your other favourite document editor, and just hit paste! You should see the beautifully syntax-highlighted code. If something goes wrong, then you can try one of the other options (export to RTF/HTML), although I've never had a problem with the clipboard method.
There are two programs on cnet downloads, which are free to try. In case you did not try them, here are the links:
VB-VBA Code Formatter & Printer 2.2
VBAcodePrint 6.13.110
Smart Indenter could be what you're looking for? You'd load the result into Notepad++, set language to VB and save as .rtf/.doc (or print to file, can't remember off the top of my head).
For a more modern approach, Sublime Text users can install ExportHTML from Package Control. This has the added benefit of being able to include the line numbers, and changing the code coloration.
HTML files can be opened directly within Word.
Highlight supports a wide range of Operating Systems and 150+ languages including Visual Basic, although I'm not sure about VBA.
I would recommend this one: planetB
It works well with Internet Explorer (didn't work wit Firefox for me, not sure abt Chrome).
Plus it's online, so no need to install anything (the case of Company/University PC's)
Regards
Wheeliam
The following works with Visual Studio Code:
Start VS Code.
New file.
Copy & Paste the VBA code into the VS Code window.
In the lower right-hand corner, click on "Plain Text" and select "Visual Basic" instead. Note that the code is now syntax-highlighted.
Copy & Paste the formatted code into Word.
I am trying to use VS 2010 for writing C. Frequently, I try to use a hotkey combination, and I get an error message of the form:
The key combination (key, key) is
bound to command (Command) which is
not currently available.
Why is this? Examples include CTRL + R, R for Rename and CTRL + K, CTRL + D for Format Document.
I am trying these commands with my cursor in the code editing window.
I find that this works in 2008 C# but not 2010 C/C++.
As 020Z28 says, the commands aren't supported in the C++ text editor. The workaround for Format Document is to Select All then Format Selection: Ctrl A, Ctrl K, Ctrl F.
The C++ text editor does not implement those two commands. If they work in 2008, it's only because you have an extension installed that adds support for those features.
Edit: The OP currently says "for writing C", just in case the question later changes to "for writing C#."
If the OP actually means C#, then the error is occurring because you are editing a document that is not part of a project/solution you currently have open, or the file has the Build Action set to None.
I have at random found the format document command to be "not currently available". I have found that saving the file and switching to another tab and back, will renable the command.
It may depend on the file extension of the file you are trying to format.
For example, I was testing a BizTalk map (XSLT) which outputs XML. The output file had a .txt extension, and it repeatedly threw the Ctrl+K, Ctrl+D error. When I changed the file extension to .xml, Ctrl+K,Ctrl+D worked every time.
I don't know if VS uses the content or the extension to determine how to format the file, but my thinking is that VS has no idea how to format a .txt file, but it does know how to format a .xml file.
Remove 'tagprefix="asp"' property from register tag.