From e3972d8aad9b6f0143c49f5938501e248af058d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20Yngve=20Lerv=C3=A5g?= Date: Sat, 5 Mar 2016 22:32:10 +0100 Subject: [PATCH] Update UpdateSkim example (#383) --- doc/vimtex.txt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/doc/vimtex.txt b/doc/vimtex.txt index e01f8ac..c8e9c15 100644 --- a/doc/vimtex.txt +++ b/doc/vimtex.txt @@ -824,8 +824,19 @@ Options~ " This adds a callback hook that updates Skim after compilation let g:vimtex_latexmk_callback_hook = 'UpdateSkim' function! UpdateSkim(status) - if a:status - call system('updateskim.sh ' . b:vimtex.tex) + if !a:status | return | endif + + let l:out = b:vimtex.out() + let l:cmd = [g:vimtex_view_general_viewer, '-r'] + if !empty(system('pgrep Skim')) + call extend(l:cmd, ['-g']) + endif + if has('nvim') + call jobstart(l:cmd + [line('.'), l:out]) + elseif has('job') + call job_start(l:cmd + [line('.'), l:out]) + else + call system(join(l:cmd + [line('.'), shellescape(l:out)], ' ')) endif endfunction <