Skip to content

Commit

Permalink
Merge pull request #1464 from ychin/fix-macos-14-sonoma-printing
Browse files Browse the repository at this point in the history
Fix macOS 14 Sonoma printing to use ps2pdf instead
  • Loading branch information
ychin committed Dec 9, 2023
2 parents 78cef1b + 25b6728 commit bbe7a4a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion runtime/autoload/macvim.vim
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,19 @@ enddef
# PreviewConvertPostScript doesn't work.
export def PreviewConvertPostScript(deltimer = 10000): number
# Convert PS to PDF because Preview can't use PS files in macOS 13+
system($"pstopdf {v:fname_in} -o {v:fname_in}.pdf")
if executable('/usr/bin/pstopdf')
system($"/usr/bin/pstopdf {v:fname_in} -o {v:fname_in}.pdf")
else
# Starting in macOS 14, pstopdf is no longer bundled. We just require the
# user to install ps2pdf as it's the simplest solution for a relatively
# niche feature today (printing).
if executable('ps2pdf')
system($"ps2pdf {v:fname_in} {v:fname_in}.pdf")
else
echoerr 'Cannot find ps2pdf. You can install it by installing Ghostscript. This is necessary in macOS 14+ for printing to work.'
return 1
endif
endif
if v:shell_error != 0
return v:shell_error
endif
Expand Down

0 comments on commit bbe7a4a

Please sign in to comment.