Is there a way in _vimrc to set a different colorscheme to be used when printing files?
I like a dark background light text scheme on screen, but obviously that doesn't translate well to paper.
Edit: I can change the scheme manually before printing, then change it back after and it works fine. Just curious if there's a way to tell Vim to always use a specific scheme while printing.
This is what :hardcopy
outputs:
How to Set Default Vim Color Scheme. Changes you have made to the color settings are not permanent. Once you close Vim, the color scheme returns to the default settings. To make the changes permanent, modify Vim's configuration file with the wanted color settings.
View preinstalled color schemes Some color schemes are already installed on your system. You can find those color schemes in the /usr/share/vim/vim*/colors directory as . vim extension.
You can set your preferred color scheme in gvim for MS Windows by editing the file _vimrc in C:\Program Files\Vim or the location where you installed Vim. Save the file and start gvim you will see your color scheme.
How about something like
:command Hardcopy let colors_save = g:colors_name <Bar> colorscheme default <Bar> hardcopy <Bar> execute 'colorscheme' colors_save
Maybe throw in the 'bg'
option. If you care about local variables, make it a function:
command Hardcopy call Hardcopy()
function! Hardcopy()
let colors_save = g:colors_name
colorscheme default
hardcopy
execute 'colorscheme' colors_save
endfun
The Vim plugin "Printer Dialog" allows to configure printing parameters, one of them is the colorscheme to be used for printing.
After installing and configuring "Printer Dialog" press \pd
in the Vim window you want to print. The following "dialog" will open:
Beneath other things the syntax-highlighting for printing can be selected. See :help printer-dialog
for further details.
The variable g:prd_syntaxList
defines the syntax-highlightings that can be selected. Default is
g:prd_syntaxList = "no,current,default,print_bw,zellner"
See :help prd_syntaxList
for details on how to setup this feature.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With