URL: http://www.math.fu-berlin.de/~guckes/vim/howto/print.html URL: https://www.vim8.org/howto/print.html (mirror) Created: Tue Aug 25 18:00:00 CEST 1998 Last update: Thu Jan 07 18:00:00 CET 1999
:w file :!type file > prn
:<range>w !lp or :M,Nw !lpExamples:
Print from line 10 to line 20 (inclusive): :10,20w !lp Print from current line to line 100 (inclusive): :.,100w !lp Print from first line to current line (inclusive): :1,.w !lp Print from current line to line 100 (inclusive): :.,100w !lp Print from current line to last line (inclusive): :.,$w !lp Print all lines (ie from first line to last line) (inclusive): :1,$w !lp :%w !lpPrinting visual text: Type ':' as the operator and Vim will use the range "'<,'>" to denote the previous visual text; now you can apply the write command:
:'<,'>w !lp