I adopted printing solution from https://unix.stackexchange.com/a/20448/9689 :
vim -c 'hardcopy > /path/to/saved.ps' -c 'quit' /path/to/file
Problem is, when I have this file
opened in VIM and I currently work on.
Then I would like script (e.g. in another terminal) to print it, and I get monit "You have already opened file...".
Yes, I know I can use -n
no swap file, but if I use it on second VIM it does not do the trick nor -R
etc...
vim -n -R -c 'hardcopy > /path/to/saved.ps' -c 'quit' /path/to/file
it looks like I would need to run this option on other VIM editors, while I don't want to. I want to use those swap files, just disable this for this one run that generates printout.
(and Vim seems only printing to ps/pdf solution that works nicely (syntax-highlighting) with rust, although if someone has alternative, please drop a comment, main question is about running VIM without complaining on swap
file... maybe answer is that it's impossible without everywhere disabling swap files with -n
, then I will have to live with it, but at this point I don't know)