Questions those come into mind when someone switches from Windows to Mac OS X for web development and wants to compare files:
- Which editor has support for file diff or file compare functionalities on Mac OS X ?
- Which is the best tool for file comparison while developing on Mac OS X ?
- How to use FileDiff package on Sublime Text editor ?
- How to use File Compare functionality in Text Wrangler in mac OS X ?
After developing 4 complete years on Windows, I have recently moved into a MacBook Air. During development, one thing I was missing was the “File Compare” plug-in on Notepad++ which I was using for a long time while on Windows. Even though NotePad++ doesn’t have a Mac version, there are some alternatives to that on Mac OS X. Two editors which I find very useful are Text Wrangler and Sublime Text 3.
File Compare on Text Wrangler:
- Open both the files on the TextWrangler editor. Did I mention, this is a free editor and best for editing text based files.
- Now select both the files in “Opened Documents” sidebar. [ ⌘ + Click ]
- Right click on the selected files and click on “Compare”.
File diff on Sublime Text 3:
- Install “Package Control” for Sublime if you haven’t yet. How to do that ? https://sublime.wbond.net/installation
- Now open the package installer and install “FileDiffs“.
- To diff. two files, open those two files in Sublime Text 3. Right click on that file tab and click on “Diff Tab”.
- Now you can use the diff. file generated (unified) to see changes between two files.
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/
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"]
// diffmerge (DiffMerge)
"cmd": ["/usr/bin/diffmerge", "$file1", "$file2"],
// "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
Diff with Tab – FileDiffs on Sublime Text