Iâm announcing my plugins in order of their popularity on Package Control. #1 spot goes to zenburn, which Iâm glad to see. #2 is FileDiffs. This is not surprising, because I think it offers many of the TextMate âdiffâ commands, but with the ST2 spin.
The commands it provides are:
-
Diff file with Clipboard
-
Diff Selections
-
Diff file with Saved
-
Diff file with File in ProjectâŚ
-
Diff file with Open TabâŚ
If you have selected some text, âDiff fileâ changes to âDiff selectionâ. âDiff selectionsâ is only available when there are exactly two selections in the current view. âDiff file with Open Tabâ will show a picker for the open tabs (unless there are just two open, it will just pick the other tab). Diff file with File in Project uses the fuzzy finder.
The diff is calculated using pythonâs difflib library, using the unified_diff command. I had some headaches getting unicode to diff correctly, so bear with me if your files arenât decoding correctly. AFAIK, it only supports UTF8. If you need to diff two files with different encodings, try using âDiff file with Open Tabâ. It uses sublime text to fetch the content, so it should deal with the encoding transparently.
Next, my question about etiquette. In writing plugins, my first audience (me!) gets special consideration. I add key mappings that are intuitive to me, and add them to a Defaults (OSX).sublime-keymap file. I also create Windows and Linux versions, just for consistency. The keymap file for FileDiff looks like this:
{ "keys": "ctrl+shift+d"], "command": "file_diff_menu" }
]
When I publish these plugins, I have very mixed feelings about including these keymap files. What I like is that these files show the commands and options the package provides. What I donât like is that hit all users will agree with my keymappings.
Is there a standard in place for including or excluding keymap files? Or what to name example files?