Skip to content

Instantly share code, notes, and snippets.

@nils-werner
Created October 23, 2013 10:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nils-werner/7116389 to your computer and use it in GitHub Desktop.
Save nils-werner/7116389 to your computer and use it in GitHub Desktop.
#!/bin/sh
SUBLIME="subl"
# 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="$1"
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" ];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
evince_backward_search "$PDFFILE" "$EDITORCMD"&
BACKWARD_SEARCH_PID=$!
#echo $BACKWARD_SEARCH_PID
fi
fi
/usr/bin/evince "$1"
if [ "$BACKWARD_SEARCH_PID" ];then
#echo "Killing $BACKWARD_SEARCH_PID"
kill $BACKWARD_SEARCH_PID
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment