Printing from gvim

593 views
Skip to first unread message

jurcis

unread,
May 22, 2010, 10:38:51 AM5/22/10
to vim...@googlegroups.com

Hi!

I have an R code which i edit with gvim and it looks very nice with its
colors making numbers and some parameters appear blue colored.

I want to print this code with a pdf printer. The problem i encounter is
that i cant take off page header fully and i cant set up page numbers in the
center of page footer. The next step would be starting the page numbering
with other number than 1.

I managed to change the header but if i take it off i get "Page 1" written.
I also tried converting to html and printing from there but the outcome was
too pale.

I have spent like 2 days searching in google and haven't found the answer. I
found many similar threads but none could answer this one.

Thanks for help!
--
View this message in context: http://old.nabble.com/Printing-from-gvim-tp28643698p28643698.html
Sent from the Vim - General mailing list archive at Nabble.com.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Tony Mechelynck

unread,
May 22, 2010, 11:14:22 AM5/22/10
to vim...@googlegroups.com, jurcis
On 22/05/10 16:38, jurcis wrote:
>
> Hi!
>
> I have an R code which i edit with gvim and it looks very nice with its
> colors making numbers and some parameters appear blue colored.
>
> I want to print this code with a pdf printer. The problem i encounter is
> that i cant take off page header fully and i cant set up page numbers in the
> center of page footer. The next step would be starting the page numbering
> with other number than 1.
>
> I managed to change the header but if i take it off i get "Page 1" written.
> I also tried converting to html and printing from there but the outcome was
> too pale.
>
> I have spent like 2 days searching in google and haven't found the answer. I
> found many similar threads but none could answer this one.
>
> Thanks for help!

- Windows or Unix?

- What steps are you taking to get the coloured printout?
- If you are printing from a browser, you should be able to set the
header and footer from there (but not to start at a page number other
than 1), either in some "Page Setup" menu or when starting to print,
depending on your browser and/or OS.
- If the output is too pale, you can change the colorscheme (possibly
write one yourself) before running :TOhtml, or else set the 2html
options to get "modern" HTML with CSS, and change the colours /a
posteriori/ in the CSS. (Lower numbers mean darker colours, as you
probably know.)

- For questions pertaining strictly to Vim, don't search in Google,
search the Vim help. (Of course, the Vim help is powerless for what
happens after your printout leaves Vim.)


Best regards,
Tony.
--
You are only young once, but you can stay immature indefinitely.

jurcis

unread,
May 22, 2010, 12:12:39 PM5/22/10
to vim...@googlegroups.com



Tony Mechelynck-2 wrote:
>
>
> - Windows or Unix?
>
> - What steps are you taking to get the coloured printout?
> - If you are printing from a browser, you should be able to set the
> header and footer from there (but not to start at a page number other
> than 1), either in some "Page Setup" menu or when starting to print,
> depending on your browser and/or OS.
> - If the output is too pale, you can change the colorscheme (possibly
> write one yourself) before running :TOhtml, or else set the 2html
> options to get "modern" HTML with CSS, and change the colours /a
> posteriori/ in the CSS. (Lower numbers mean darker colours, as you
> probably know.)
>
> - For questions pertaining strictly to Vim, don't search in Google,
> search the Vim help. (Of course, the Vim help is powerless for what
> happens after your printout leaves Vim.)
>
>
> Best regards,
> Tony.
> --
> You are only young once, but you can stay immature indefinitely.
>
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
>

I'm using windows.

The main goal is to print directly from vim. :TOhtml was a test in case i
cant change vim output but as i cant change number on first page (in
browser) i have to return to beginning. I searched vim's built in help and
found the possibility to change header with option :set printheader=
if i leave it blank it posts page number in header top left
if i write something in it posts only that without the page number
It would be great if could leave the header blank and move the page number
to the center of page footer
and start the numbering at 5 for example.

--
View this message in context: http://old.nabble.com/Printing-from-gvim-tp28643698p28644263.html
Sent from the Vim - General mailing list archive at Nabble.com.

Gary Johnson

unread,
May 22, 2010, 1:06:12 PM5/22/10
to vim...@googlegroups.com
On 2010-05-22, jurcis wrote:

> I'm using windows.
>
> The main goal is to print directly from vim. :TOhtml was a test in case i
> cant change vim output but as i cant change number on first page (in
> browser) i have to return to beginning. I searched vim's built in help and
> found the possibility to change header with option :set printheader=
> if i leave it blank it posts page number in header top left
> if i write something in it posts only that without the page number
> It would be great if could leave the header blank and move the page number
> to the center of page footer
> and start the numbering at 5 for example.

You can make the header blank by setting 'printheader' to a blank,
e.g.,

:set printheader=\

where the backslash is followed by a space character. All of the
print options are discussed in

:help printing

There is no option to print a footer.

Under

:help pheader-option

it says that the 'printheader' "option is defined in the same way as
the 'statusline' option." If that's really true, then you can call
a Vim function in the 'printheader' option and you might be able to
have it return the current page number plus 5. See

:help statusline

HTH,
Gary

Tony Mechelynck

unread,
May 22, 2010, 1:10:14 PM5/22/10
to vim...@googlegroups.com, jurcis
Starting the numbering at 5 is IMHO not possible, unless maybe you can
compute exactly which number to print from the data available when the
header is displayed, and then use a %{...} expression-evaluation
substring. Did you use percent strings as mentioned under
|pheader-option| and detailed under 'statusline' ? The default value
shown under |pheader-option| (NOT when setting the option to the empty
string) should display:

- file name & path, truncated at left if too long
- [help] if it is a help file
- [+] if 'modified' or [-] if 'nomodifiable'
- elastic whitespace between left and right parts
- "Page ###" (where ### is the page number).

Your gvim version is compiled with +statusline I suppose? If it isn't,
you'll have to exchange it for a newer model. ;-)


However, :hardcopy is supposed to print in black-and-white. I wonder
where the "colours" you spoke about came from.


Oh, thinking of it, maybe you meant printing from the fifth page,
skipping four pages at the beginning of the file? That might be
possible, I'm not sure, by setting options in the menu that Windows pops
up (on a Vim for Windows, built with -postscript +printer) when you
issue the :hardcopy command with no exclamation mark.


Best regards,
Tony.
--
"This is a test of the Emergency Broadcast System. If this had been an
actual emergency, do you really think we'd stick around to tell you?"

jurcis

unread,
May 22, 2010, 2:18:54 PM5/22/10
to vim...@googlegroups.com
Im using gvim 7.2 and print with bullzip pdf printer. The colors could come
from bullzip. But vim makes the page setup. Thanks for the support. Ill try
to work without page numbers and see if i can add them somehow later to the
pdf file.
Jurcis
--
View this message in context: http://old.nabble.com/Printing-from-gvim-tp28643698p28645019.html
Sent from the Vim - General mailing list archive at Nabble.com.

Reply all
Reply to author
Forward
0 new messages