PDF syncing in Sublime Text for LaTeX on Windows

I have moved all of my work back onto a Windows box recently, which means completing overhauling my LaTeX setup. I know there are a lot of integrated environments for LaTeX on Windows, but I prefer a straight text editor. Coming from Textmate, I landed on Sublime Text 2.

Sublime comes with a LaTeX bundle already installed (which has syntax highlighting and a number of other bells and whistles), but it takes a bit more elbow grease to achieve two-way syncing with a PDF viewer and use XeTeX. I couldn’t find anywhere else on the web that exactly details this process and confirms that it works, so for anyone searching for the solution (and for myself next time), here is how I got it working:

with

"cmd": ["latexmk",
"-e", "$pdflatex = 'xelatex %O -interaction=nonstopmode -synctex=1 %S'",
//"-silent",
"-f", "-pdf"],

And you’re done. Now, you can compile any LaTeX file in Sublime Text via latexmk by ctrl+b, and it will launch the pdf in Sumatra, opened exactly at the location of your last edit. When you want to go back to the LaTeX source in Sublime Text, double-click in the pdf wherever you want the source to open.

Big improvement over opening on the title page of your dissertation every compile.