DiffMerge Window

How to integrate DiffMerge with Sublime Text for comparing files

The other day, I was searching for some ways to compare two files(one from production and another from the local development of the same file) in Sublime Text. I found that there is no default tool to compare two files, thats why I installed “FileDiffs“, a package which provides the above needed functionality. What this tool does is: it provides you a result file which contains unified differences from both the compared files with + (Plus) & (Minus) symbols. Even though it serves the purpose, but for someone who has been using compare tools like WinMerge, or the color-full GUI in Notepad++ editor on Windows, the experience will be horrible.

However a cool feature of this “FileDiffs” package is that, it can integrate with any external diff. tools through command line. So, I installed “DiffMerge“, an free application to visually compare and merge files. Below is the set of settings that integrates “DiffMerge” with “FileDiffs” on “Sublime Text 3”.


// You can set a command like this
// "cmd": ["command", "$file1", "$file2"]

// You can also include other command line parameters like this
// "cmd": ["command", "-parameter1", "-parameter2", "$file1", "$file2"]


{
"open_in_sublime": true,

// diffmerge (DiffMerge)
"cmd": ["/usr/bin/diffmerge", "$file1", "$file2"],

"trim_trailing_white_space_before_diff": false,

"expand_full_file_name_in_tab": true,

"apply_tempfile_changes_after_diff_tool": false

// "limit": 1000
}

How and where to apply these settings ?

  • Go to: Sublime Text –> Preferences –> Package Settings –> FileDiffs –> Settings – User
  • Copy & paste the above code in the FileDiffs.sublime-settings file.
  • Restart Sublime and see the file diffs visually in a nice graphical way. 🙂
how to apply settings for FileDiffs
how to apply settings for FileDiffs

 

Diff with Tab - FileDiffs on Sublime Text
Diff with Tab – FileDiffs on Sublime Text

 

DiffMerge Window
DiffMerge Window

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Update: “Compare Side-By-Side” package for Sublime Text can be used to side-by-side file comparison & difference in Sublime Text 2 / Sublime Text 3. This works great and easy to set up.


Posted

in

by

Comments

3 responses to “How to integrate DiffMerge with Sublime Text for comparing files”

  1. […] To know how to integrate DiffMerge(an application to visually compare and merge files) with Sublime Text read: http://subharanjan.com/integrate-diffmerge-with-sublime-text-comparing-files/ […]

  2. codelobster Avatar
    codelobster

    I use Codelobster for it: http://www.codelobster.com

  3. Michael Uschold Avatar
    Michael Uschold

    Will this work for other compare tools? I have compare-side-by-side, and following your instructions, led to a file called SBSCompare.sublime-settings

Leave a Reply

Your email address will not be published. Required fields are marked *