2014-03-06 23 views
4

在打印文件时,_vimrc中有设置不同的配色方案的方法吗?Vim打印时不同的配色方案

我喜欢屏幕上的深色背景灯文字方案,但很明显这并不能很好地表达纸张。

编辑:我可以在打印之前手动更改方案,然后将其更改回来并且工作正常。只是好奇,是否有办法告诉Vim在打印时总是使用特定的方案。

这是:hardcopy输出: enter image description here

+0

我不能得到'vimrc'标签工作.. – Dan

+5

如何像':命令硬拷贝让colors_save = G:colors_name 色彩方案默认硬拷贝执行'colorscheme'colors_save'?也许扔在''bg''选项。 – benjifisher

+2

@Dan vimrc标签是vim的同义词。 – FDinoff

回答

5

如何像

:command Hardcopy let colors_save = g:colors_name <Bar> colorscheme default <Bar> hardcopy <Bar> execute 'colorscheme' colors_save 

也许在'bg'选项扔。如果你关心局部变量,使其成为一个功能:

command Hardcopy call Hardcopy() 
function! Hardcopy() 
    let colors_save = g:colors_name 
    colorscheme default 
    hardcopy 
    execute 'colorscheme' colors_save 
endfun 
+0

非常好,谢谢! – Dan

1

:hardcopy将始终以白色背景上打印。从:help hardcopy

The current highlighting colors are used in the printout, with the following 
considerations: 
1) The normal background is always rendered as white (i.e. blank paper). 
2) White text or the default foreground is rendered as black, so that it shows 
    up! 
3) If 'background' is "dark", then the colours are darkened to compensate for 
    the fact that otherwise they would be too bright to show up clearly on 
    white paper. 

但是,我不知道究竟是如何“[...]的颜色会加深补偿[...]”的作品,所以你可能还是要一起去@ benjifisher的解决方案。

或者,您可以使用:TOhtml来获得相同的表示形式(在这种情况下绝对使用不同的颜色方案),然后以其他方式打印出来。有关相关选项,请参见:help TOhtmlg:html_number_lines

+0

':hardcopy'会产生不良结果。看我的编辑。 – Dan

3

Vim插件"Printer Dialog"允许配置打印参数,其中之一是用于打印的颜色方案。

安装并配置“打印机对话框”后,在需要打印的Vim窗口中按\pd。下面的“对话”将打开:

enter image description here

下方其他事情的语法高亮打印可以选择。有关更多详细信息,请参阅:help printer-dialog。 变量g:prd_syntaxList定义了可以选择的语法高亮显示。默认为

g:prd_syntaxList = "no,current,default,print_bw,zellner" 

有关如何设置此功能的详细信息,请参阅:help prd_syntaxList

+0

整洁的插件,但我更喜欢本更简单的解决方案。 – Dan

+0

@丹:没问题;-) – Habi