First attempt at built-in Skim support

See: #185
This commit is contained in:
Karl Yngve Lervåg 2015-06-21 00:07:37 +02:00
parent d4c26abccf
commit 82ecbeef71

View File

@ -9,6 +9,7 @@ let s:viewers = [
\ 'mupdf',
\ 'okular',
\ 'qpdfview',
\ 'skim',
\ 'sumatrapdf',
\ 'zathura',
\ ]
@ -344,6 +345,36 @@ endfunction
" }}}2
" {{{1 Skim
function! s:skim.init() dict " {{{2
call vimtex#util#set_default('g:vimtex_view_skim_options', '')
if !executable('/Applications/Skim.app/Contents/SharedSupport/displayline')
echoerr 'vimtex viewer Skim is not executable!'
endif
endfunction
" }}}2
function! s:skim.view(file) dict " {{{2
let outfile = a:file !=# '' ? a:file : b:vimtex.out()
if s:output_not_readable(outfile) | return | endif
let exe = {}
let exe.cmd = '/Applications/Skim.app/Contents/SharedSupport/displayline'
let exe.cmd .= ' ' . g:vimtex_view_skim_options
let exe.cmd .= ' ' . line('.')
let exe.cmd .= ' ' . vimtex#util#fnameescape(outfile)
let exe.cmd .= ' ' . vimtex#util#fnameescape(expand('%:p'))
call vimtex#util#execute(exe)
let self.cmd_view = exe.cmd
if has_key(self, 'hook_view')
call self.hook_view()
endif
endfunction
" }}}2
" {{{1 SumatraPDF
function! s:sumatrapdf.init() dict " {{{2
call vimtex#util#set_default('g:vimtex_view_sumatrapdf_options', '')