Question

Im in the situation that I often send small codesnippets and xml-snippets to coworkers and partners via my outlook. Has anyone got a good idea or tool that I can use to have my pastes syntaxhighlighted before I paste them into an email.

I was thinking of an intermediate paste to "$fancytool" and then I would have something to copy that will htmlified so I can copy paste it into the "compose email" window.

Edit-More-info:

Im pasting from windows within a VMWare virtual Machine, it might be eclipse, xmlspy, logfiles and other programs

Even-more-info:

I've seen this link how to do it from Vim. Unfortunately it seldom from vim im copying Code, and my email machine hasnt got any vim. The vmware machines has gvim, but I was hoping for an easier way that pasting to vim, saving to file, opening in internetexplorer and then copy/paste

Was it helpful?

Solution

Late but I can give an answer that works. You need 2 things

  1. putty
  2. access to some Unix server (With vim)

In putty options, Under window → selection , turn the check box on for

Paste in to clipboard in RTF as well as plain text.

Log on to the server using putty. start vim by typing vim Paste your text (for example XML ) in to vim. enter command mode (of vim by pressing ESC) and type :set syn=xml.

Syntax highlighting kicks in. Copy the text using mouse and paste it into your email.

OTHER TIPS

5 years too late, sorry, but I've a much simpler solution than the accepted answer.

Use this online tool: http://tohtml.com/

copy the preview from your browser window and just paste into Word or Outlook.

Vim (or GVim) will output your code as formatted HTML. Then as long as your email is using an HTML format you can copy and paste it in.

Just an update on this matter, if you're on Windows, you can install Notepad++ (which is one of the best windows editors anyway), it comes out of the box with a plugin for this: "Copy text with Syntax Highlighting", when you select some text and right click on it.

If you just want the Add-In here it is.

If you want to know how it is done, here is an article on how to write the Add-In.

Comment: svrist mentioned a code paste site with syntax highlighting. Try http://codepad.org/

(don't have enough mojo to comment yet)

This link led me to SciTE.

Looks like SciTE has a Copy to RTF feature:

SciTE

Edit(vmware upgrade): But it looks like I am pretty much lost when I use vmware because I cant transfer rtf clipboard items to the vmware host. And I cant install software on the vmware host.

Maybe a paste-site with syntax highlighting?

If you're on Windows, Visual Studio does this automatically. At least it does for me, using Visual Studio 2005 on XP and copy/pasting to both MS Word and Lotus Notes

HeidiSQL does this for sql queries, and the syntax highlighting choices they made are quite readable. However, this will only work for sql queries, not other code. I like Notepad++ for Windows-based systems, and here are some instructions for Notepad++. Several people mentioned VIM for unix/shell environment.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top