So :ha(rdcopy)
has been deleted from Neo Vim.
I can understand why, since it makes code refactoring for developers easiear without having to consider an infinite number of things.
Here is the workaround.
Use this function in your .vimrc
file.
There is no need to save the working file to print.
Remember to change the printer name to your own printer name
The first letter of a command has to be upper case so we cannot have :ha
or :hardcopy
and have instead to have :Ha
and :Hardcopy
.
Place all of this inside your .vimrc
function! PrintBuffer()
silent execute '!lpoptions -d HP_LaserJet_2200_LOCAL_hpcups'
silent execute 'w !lp -n 1 -o media=a4 -o sides=two-sided-long-edge -'
endfunction
command! Ha call PrintBuffer()
command! Hardcopy call PrintBuffer()
Or use the below function to print to the default printer, again no need to save the file to print.
This time I have mapped this to :Hc
" below for instant printing to default printer
function! PrintBufferWithCR()
silent execute 'w !lp'
endfunction
command! Hc call PrintBufferWithCR()
To find out which is your default printer use lpstat -d
on the command line.
`
:Hardcopy
command that takes a detour over HTML and your browser.:!lpr %
and be done with it.