views:

554

answers:

7

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

+1  A: 

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.

Kris Erickson
+2  A: 

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.

EBGreen
how do you tell VIM to do that?
Nathan Fellman
@Nathan: See the link ive added in the question: http://vim.wikia.com/wiki/Pasting_code_with_syntax_coloring_in_emails
svrist
A: 

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

Isak Savo
Was about to post the same. Would be overkill to fire up VS just for formatting, but I guess most IDEs will have such a feature.
OregonGhost
I havnt got a VS licence :(
svrist
A: 

@Kris: CopySourceAsHtml works only with VS2008 (.NET framework) installed. I couldnt get it working for old MSVC6.0 or even Visual Studio 2005 setup i have. Any pointers on that?

-AD

goldenmean
+1  A: 
svrist
+2  A: 

Late but I can give an answer that works. You need 2 things 1) putty 2) access to some modern Linux 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.

Logon to Linux server using putty. start vim by typing vim Paste your text (for example XML ) in to vim. enter command mode (of vim by pressing ) and type :set syn=xml Syntax highlighting kicks in. Copy the text using mouse and paste it into your email.

ring bearer
+1  A: 

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

(don't have enough mojo to comment yet)

pydave