Wikia

Vim Tips Wiki

Changes: Print to a Postscript file

Edit

Back to page

(Insert TipProposed template + minor manual clean)
(Assign tip id + convert to TipNew template + minor clean)
Line 1: Line 1:
{{TipProposed
+
{{TipNew
|id=0
+
|id=1609
|previous=0
+
|previous=1608
|next=0
+
|next=1610
 
|created=November 11, 2008
 
|created=November 11, 2008
 
|complexity=basic
 
|complexity=basic

Revision as of 09:17, April 6, 2009

Tip 1609 Printable Monobook Previous Next

created November 11, 2008 · complexity basic · author Sightless · version 7.0


If you want to be able to print to printer and file, place this snippet in your vimrc:

let &printexpr="(v:cmdarg=='' ? ".
    \"system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice)".
    \". ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error".
    \" : system('mv '.v:fname_in.' '.v:cmdarg) + v:shell_error)"

Then you can print to file by issuing:

:hardcopy filename.ps

or to printer by just issuing:

:hardcopy

Comments

So far this could be considered a bit insecure, as the filename isn't escaped at all. Probably fnameescape or something like that should be used.


Around Wikia's network

Random Wiki