-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathpersonal.vim
More file actions
39 lines (34 loc) · 817 Bytes
/
personal.vim
File metadata and controls
39 lines (34 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"
" Various personal stuff
"
function! personal#print_file(fname)
let l:pdf = a:fname . '.pdf'
call system(printf('ps2pdf %s %s', a:fname, l:pdf))
echohl ModeMsg
let l:reply = input('View file before printing [y/N]? ')
echohl None
echon "\n"
if l:reply =~# '^y'
call system('mupdf ' . l:pdf)
endif
echohl ModeMsg
let l:reply = input('Save file to $HOME [Y/n]? ')
echohl None
echon "\n"
if empty(l:reply) || l:reply =~# '^n'
call system(printf('cp %s ~/vim-hardcopy.pdf', l:pdf))
endif
echohl ModeMsg
let l:reply = input('Send file to printer [y/N]? ')
echohl None
echon "\n"
if l:reply =~# '^y'
call system('lp ' . l:pdf)
let l:error = v:shell_error
else
let l:error = 1
endif
call delete(a:fname)
call delete(l:pdf)
return l:error
endfunction