Basically, there are two different printer backends against which Vim
can be compiled: you can have Windows printing or postscript printing,
but not both. I think it is possible to compile Windows Vim with
+postscript but I don't recommend it; you would need ghostscript or
something to use :hardcopy then.
I suppose if you don't try to set all those options, but just use
":hardcopy", you don't get the expected results?
Personally I'm on Linux (i.e., on the other side of the fence) but I
haven't found out how to print Unicode from Vim. When I need "special"
characters which aren't in the Latin1 range, I save the file to disk and
print it using my browser.
To print with syntax highlighting, first convert to HTML (see ":help
convert-to-HTML") then open the resulting HTML file in your browser:
e.g., to open "C:\Documents and Settings\msingtse\My
Documents\foobar.html" you would point your browser to
file:///c:/Documents%20and%20Settings/msingtse/My%20Documents/foobar.html --
with file:/// at the start, forward slashes, and spaces and other
"special" characters replaced by percent-escaping in hex. If the file
name contains characters above U+007F, replace them by escaping each
byte of their UTF-8 representation separately -- the g8 command can help
you there. Or else, use the "File => Open" dialog if your browser has
such a menu item.
Best regards,
Tony.
--
MORTICIAN: What?
CUSTOMER: Nothing -- here's your nine pence.
DEAD PERSON: I'm not dead!
MORTICIAN: Here -- he says he's not dead!
CUSTOMER: Yes, he is.
DEAD PERSON: I'm not!
The Quest for the Holy Grail (Monty
Python)
Hi Tony,
Would you mind to test the following function, and see if you get the
expected result? You will need paps[1], which should be available from
your favorite distribution, if not, it's just a simple (CMMI)* package
that requires pango (possible you will need the dev package for pango).
function! system#print(...) range
let font = (exists("a:1") && !empty(a:1)) ? "Monospace ".a:1 : "Monospace 14"
let printer = split(readfile('/etc/printcap')[-1], "|")[0]
execute a:firstline.','.a:lastline.'write ++enc=utf-8 !paps --font='.font.
\ '|ps2pdf -sPAPERSIZE=a4 -dOptimize=true -
\ | lp -d '.printer.' -'
endfunction
1. http://paps.sourceforge.net/
* configure, make, make install
Regards,
Ag.
Sorry I am just testing it myself too, so I've missed the quotes,
> execute a:firstline.','.a:lastline.'write ++enc=utf-8 !paps --font='.font.
--font="'.font.'"
Regards,
Ag.
On 23/12/08 08:53, msin...@hkstar.com wrote:
. . . I think there must be a way to print Chinese without calling for Notepad? Plus, I cannot use notepad this time because I need syntax highlighting in the hardcopy.Basically, there are two different printer backends against which Vim can be compiled: you can have Windows printing or postscript printing, but not both. . .
Hm, what is the expected result? And no, AFAICT, SuSE doesn't distribute
paps (at least, searching the 11.1 repositories for it with settings
"Name" "Summary" and "RPM Provides", "contains", and "not
case-sensitive" yields no results). As for compiling from source, I'm
doing it for Vim but that's an exception. Other packages I get
pre-compiled from SuSE or, in the case of Firefox, Thunderbird,
SeaMonkey and Sunbird, from Mozilla.
The rare times that I need non-Latin glyphs (as in a paper recently, in
French with one four-letter Hebrew word in it), printing with SeaMonkey
is perfectly acceptable to me anyway, until or unless I can make Vim do
it without help. It also takes care (as in this case) of RTL words in an
LTR sentence, which Vim cannot show properly on the screen (and I don't
know what would happen when printing).
Best regards,
Tony.
--
"For three days after death hair and fingernails continue to grow but
phone calls taper off."
-- Johnny Carson
Ah, I normally don't use form feeds and let the browser figure where to
break the pages. One possible way would be to break the file into
several documents where the pages break. (Since there is no "intrinsic"
page break within an HTML document, the texts on my website are divided
into one distinct HTML page per chapter.)
Yes, and season's greetings for you too, merry Christmas, happy new
year, or whatever you feast around the December solstice.
Best regards,
Tony.
--
Syntactic sugar causes cancer of the semicolon.
-- Epigrams in Programming, ACM SIGPLAN Sept. 1982