forked from SublimeText/LaTeXTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoggle_fwdsync.py
28 lines (22 loc) · 851 Bytes
/
toggle_fwdsync.py
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
# ST2/ST3 compat
from __future__ import print_function
import sublime
if sublime.version() < '3000':
# we are on ST2 and Python 2.X
_ST3 = False
else:
_ST3 = True
import sublime, sublime_plugin
# Toggle forward syncing to PDF after compiling
class toggle_fwdsyncCommand(sublime_plugin.TextCommand):
def run(self, edit, **args):
s = sublime.load_settings("LaTeXTools Preferences.sublime-settings")
prefs_forward_sync = s.get("forward_sync", True)
if self.view.settings().get("forward_sync",prefs_forward_sync):
self.view.settings().set("forward_sync", False)
sublime.status_message("Do not forward sync PDF (keep current position)")
print ("Do not forward sync PDF")
else:
self.view.settings().set("forward_sync", True)
sublime.status_message("Forward sync PDF after compiling")
print ("Forward sync PDF")