@vaporeon_ what does your script do
@vaporeon_ VIM can print???
@wallhackio Yes!! If you have set up a printer that works with lp
and is set as the default printer there, try :ha
Otherwise, try :ha > some-file.ps
and look at the resulting PostScript
@wallhackio Also try :help ha
if you want the details. You can also print that file if you want, using — guess what — :ha
while you're inside the help window, it's 11 pages
@wallhackio Here's the source code, I put this in my .vimrc
:
function PrintFile()
let pg = systemlist("awk '/^%%Pages: [0-9]+/ { print $2 }' " .. v:fname_in)[0]
let r = input("Print " .. pg .. " pages? ")
if r[0] == "y" || r[0] == "Y"
call system('lpr' .. (&printdevice == '' ? '' : ' -P' .. &printdevice) .. ' ' .. v:fname_in)
call delete(v:fname_in)
return v:shell_error
else
call delete(v:fname_in)
return 1
endif
endfunc
set printexpr=PrintFile()
@vaporeon_ sorry Vaporeon but you're cool
@wallhackio When I type
:ha
to print out a file, the script first counts the pages and prompts me to confirm that I want to print out that many pages, and then sends it to the printer if I said yesSo that if I decide I don't want to print 25 pages of code actually, I still have a chance to say no