forked from SublimeText/LaTeXTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
evince_sync
34 lines (28 loc) · 982 Bytes
/
evince_sync
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
#!/bin/sh
PYTHON="$1"
SUBLIME="$2"
# We need to remove the stupid "file://" that Evince puts in front of the file name
# Notice the wild quoting: we need to interpolate $SUBLIME
# In the end, EDITORCMD should be of the form:
#
# f=%f; sublime-text "${f#file://}:%l"
#
# where sublime-text is the name of the sublime-text binary
EDITORCMD="f=\"%f\"; $SUBLIME \"\${f#file://}:%l\""
PDFFILE="$3"
if [ -f "$PDFFILE" ];then
# danke an Feuerfieber
# http://forum.ubuntuusers.de/topic/evince-synctex-vim-emacs-scite-lyx-kile-editor/#post-2841828
if [ -f "${PDFFILE%%.pdf}.synctex.gz" ];then
# we change the cwd to this directory, so this should work
# also note that we stick in 'python' because the script file need not be executable
$PYTHON evince_backward_search "$PDFFILE" "$EDITORCMD"&
BACKWARD_SEARCH_PID=$!
echo $BACKWARD_SEARCH_PID
fi
fi
/usr/bin/evince "$3"
if [ "$BACKWARD_SEARCH_PID" ];then
echo "Killing $BACKWARD_SEARCH_PID"
kill $BACKWARD_SEARCH_PID
fi