Vim只能使用8位编码进行打印.如果存在包含所有这些字符的编码,则只需使用
set printencoding={encoding}
Run Code Online (Sandbox Code Playgroud)
如果没有,则无法直接从vim打印.您可以使用:TOhtml@DaoWen建议的命令,执行
:TOhtml
:w /tmp/print.html
:!command-that-makes-browser-print-a-file(I-do-not-know-one) /tmp/print.html
:!rm /tmp/print.html
Run Code Online (Sandbox Code Playgroud)
.您还可以使用我的formatvim插件通过latex将其打印到pdf(不要忘记提交错误报告:latex-xcolor输出未经测试):
:Format format latex-xcolor to /tmp/print.tex
:!pdflatex /tmp/print.tex && lp /tmp/print.pdf && rm /tmp/print.*
Run Code Online (Sandbox Code Playgroud)
(你也可以使用html输出,但这不会让我知道打印它的命令).当然,您可以将这些映射到单个键.