How to get printer dialog in GVim on Linux? How to get printer dialog in GVim on Linux? linux linux

How to get printer dialog in GVim on Linux?


See :h hardcopy and :h print-options.

You can set the set the printer using :set printdevice=xxx and other options using :set printoptions=xxx.

If you really want to use the dialog box you could print to a file then open that file from some other program to print it :hardcopy > output.ps


To obtain a print dialog upon printing in gvim, you can add the following to ~/.vimrc:

set printexpr=PrintFile(v:fname_in)function PrintFile(fname)  call system("kprinter " . a:fname)  call delete(a:fname)  return v:shell_errorendfunc

Instead of kprinter, which is the print dialog from KDE3, you can also use gtklp or whatever is the the print dialog command of your desktop environment.


There is a Vim script available (see PrtDialog) that provides a self made printer dialog. To be honest, I'm the author ;-)It allows to select many printing relevant settings like paper format, orientation, line numbering, color scheme, line wrapping, margins, font and font size, etc.

There is also the option "Dialog" (see last line in the printer dialog). If this option is set to "yes", the system printer dialog will be opened before printing. There you have the option to further fine tune printing.