Side-by-Side File Comparison Plugin for Sublime

I found a nice side-by-side file comparison plugin for Sublime called Glue Views. Something cool about Glue Views is that it supports more than two files at a time. The plugin’s developer has a number of other free packages available for Sublime, including similar diff tools.

On the Sublime feature request forum I noticed a number of folks want the developer to include diff-merge features in Sublime by default. I already use other diff-merge tools specifically for merging conflicts in Git and the like, so that’s not exactly what I was looking for when I found this plugin. For those looking for that kind of functionality, some forum posters have recommended using existing TextMate packages since they are supporter by Sublime without modification. If your interested in learning more, this thread is a good place to start.

To install Glue Views or other Sublime packages on a Mac (the process and location is similar on Windows), simply navigate to /Users/<user account>/Library/Application Support/Sublime Text 2/Packages/User (Cmd + Shift + G in Finder). Copy the *.py package into that directory and Sublime will automatically detect it and compile. In the case of Glue Views, the developer included sample key bindings within the comments of the Python code. His didn’t work for me so I created my own:

[
   { "keys": ["alt+equals"], "command": "glue_views_add"},
   { "keys": ["alt+minus"], "command": "glue_views_remove"},
   { "keys": ["ctrl+alt+0"], "command": "glue_views_clear"}
]

Paste those into the Default (OSX).sublime-keymap file. If you want a separate menu for the plugin or all your plugins, create a file (in the same directory listed above) named Main.sublime-menu and put something similar to the following in it:

[
   {
      "caption": "Plugins",
      "mnemonic": "l",
      "id": "plugins",
      "children":
      [
         {
            "caption": "Glue",
            "mnemonic": "G",
            "id": "glue",
            "children":
            [
               { "command": "glue_views_add", "caption": "Add View", "mnemonic": "A" },
               { "command": "glue_views_remove", "caption": "Remove View", "mnemonic": "R" },
               { "command": "glue_views_clear", "caption": "Clear Views", "mnemonic": "C" }
            ]
         }
      ]
   }
]

That gives you a permanent Plugins menu to which you can add menus and commands for other plugins.

3 Comments

  1. Good plugin, but still sublime has no notepad++ compare plugin features.

    Reply

    1. It’s true. While I don’t think the developer will make this part of the main distribution in the near future, it would be awesome if someone developed a legitimate and powerful compare plugin like notepad++ or other software.

      Reply

  2. Such a plugin is already there. It’s called Sublimerge: http://www.sublimerge.com/

    Reply

Comments, questions and feedback welcome.