I would like to paste my code to a word document while preserving the highlighted, colored texts. Is there a way to do this?
You can also set the coding language by clicking the bottom right corner "Plain Text" to open a list of languages to choose from. Click the relevant language and the Sublime will do the coloring according to your selection.
Type Ctrl+C to copy all the text to your Clipboard. Go to your new document. Type Ctrl+V and Word will paste all the red text to your new document.
To do that -> simply press ctrl + c with the cursor anywhere on the line you wish to copy(no text-selection please) and hit ctrl + v with the cursor anywhere on the target line. The copied line will get pasted right above your target line.
You can install highlight plugin and then use SublimeHighlight: copy to clipboard as RTF
command from the command palette.
If you want to use your own color scheme use ExportHTML plugin to export to html and copy and paste the html in MS Word. HTMLExport can be configured to use any of your installed color schemes. just read the docs and look at the default settings.
Use a browser like Safari that can copy in RTF to the clipboard. For me chrome does not work.
Type "Add Repository", and press enter
Then paste this link https://github.com/n1k0/SublimeHighlight/tree/python3
Press CTRL+SHIFT+P on Windows or ⌘+⇧+P on Mac again and type "Install package" and press enter or return
Type "Sublime highlight" and press enter to install the plugin
Type, for example, "SublimeHighlight: copy to clipboard as RTF: " like so:
Paste it in Word or Powerpoint, you will find the text has been pasted with coloring and formatting.
These are the commands you can use:
SublimeHighlight: convert to HTML: will convert current code to highlighted HTML in a new SublimeText tab.
SublimeHighlight: convert to RTF: will convert current code to highlighted RTF in a new SublimeText tab.
SublimeHighlight: view as HTML: will convert current code to highlighted HTML and open it in your default browser.
SublimeHighlight: view as RTF: will convert current code to an RTF document and open the generated file with your default program.
SublimeHighlight: copy to clipboard as HTML: will convert current code to highlighted HTML and store it into the system clipboard.
SublimeHighlight: copy to clipboard as RTF: will convert current code to raw highlighted RTF and store it into the system clipboard.
Preferences
--> Package Settings
--> SublimeHighlight
--> Settings-User
. paste this code
{ "theme": "fruity", "linenos": "inline", "noclasses": true, "fontface": "Menlo" }
Here, I have used the "fruity" theme, you can choose whatever you like. These are all possible themes:
In the next code, I have set the CTRL+ALT+C to copy the text with formatting, you can do that following these few steps:
Go to Preferences
--> Key Bindings-User
.
Paste this code:
{ "keys": ["ctrl+alt+c"], "command": "sublime_highlight", "args": { "target": "clipboard", "output_type": "rtf" }},
` Now whenever you copy a text with CTRL+C, it will be copied without formatting and with CTRL+ALT+C, it will be copied with coloring :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With