LoginSignup
7
8

More than 5 years have passed since last update.

Vimでテキストを印刷

Last updated at Posted at 2016-05-09

↓の記事を見て、backspace.fmのVim-sideでKoRoNさんがVimでカラー印刷できると言っていたのを思い出して、もうちょっと簡単に(?)実現する方法を調べてみた。

プログラムの写経(vim編)
http://qiita.com/NoriakiOshita/items/b7a5b0f14189da25128a

追記

参照先の記事でhardcopyについて触れられている記述を見逃してました... すみません
hardcopyが動作する場合はこんな感じにするといいよ、と受け取って頂ければ幸いです。

印刷方法

結論としては以下のコマンドをVimで実行するだけ。(MacVimでのみ検証済み)

:set background=light
:set printoption=syntax:y,number:y
:hardcopy

Vimではhardcopyというコマンドで印刷ができる (詳しくはhelp :hardcopyを参照 ちなみに自分の環境だとMacのプレビューが開かれた)
helpを見ると、

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.

と書いてあるのでbackground=lightに指定
また行番号とsyntaxを反映させるためprintoptions=syntax:y,number:yに指定

Vimのコンパイルオプションとかによっては動作しない場合もあると思うので注意

7
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
8