blog.courier10pt.com

Getting SublimeText GraphVizPreview to work on Windows

Update 2015-02-11

In response to this post Ryan Munro, who is the original author of GraphVizPreview pulled in the changes from Ragnar Von Lodbrok. The entry at Packagecontrol.io is not updated yet, so some of the installation instructions below may still be of use.

Intro

At the time of writing (2015-02-07), GraphVizPreview does not support Windows. I found this when I installed the package via Sublime Package Control. Via the GraphVizPreview github repo i found the rlodbrock fork which does work. I’ll describe the steps I took to get it running.

Preparation

  • Download and install GraphViz
  • Add the GraphViz bin folder to the PATH variable, in my case this is C:\Program Files (x86)\Graphviz2.38\bin
  • Remove GraphVizPreview via Sublime Package Control in case it is still installed

Update Package Control settings

To prevent Sublime Package Control from removing the manually installed fork I added "remove_orphaned" : false to the Package Control User settings. Note that GraphVizPreview is not listed in installed_packages.

{
    "in_process_packages": [],
    "installed_packages":
    [
        "MarkdownEditing",
        "Package Control",
        "Pretty JSON"
    ],
    "remove_orphaned": false
}

There may be different / better ways to achieve the same. I’d be interested to learn.

Install the ‘rlodbrock fork’

Download the fork’s zip and copy it the Sublime packages folder (or use git if you so prefer).

To test it you could paste the following code in SublimeText. When you select it and press Win + Shift + G a PDF representing the graph should be opened.

digraph G {
    main -> parse -> execute;
    main -> init;
    main -> cleanup;
    execute -> make_string;
    execute -> printf;
    init -> make_string;
    main -> printf;
    execute -> compare;
}

The sample graph is taken from the Dot Guide.

Sample graph (colors inverted)

Sample graph (colors inverted)

Comments

You can send me an e-mail to leave a comment

RSS | Hakyll powered