Daily Ubuntu / Linux news and application reviews.

ads

Gedit compare with Meld

Meld is a great visual diff and merge tool but it can only be used for that and is not suitable for coding. On the other hand, Gedit is a great text editor but it doesn't come with a tool for comparing files. Wouldn't it be great if you could integrate Meld into Gedit? Here is how to do it.


Please note that by using the instructions in this post, you won't get a built-in compare tool in Gedit - you'll only get a quick way of comparing the file you're currently viewing in Gedit and some other file, in Meld.

Set up Meld as an External Tool in Gedit


Before proceeding, make sure you've installed Meld and Zenity (Zenity should come by default). In Ubuntu, install Meld using the following command:
sudo apt-get install meld zenity

In Gedit, go to Edit > Preferences and on the "Plugins" tab, enable the "External tools" plugin. Then click "Configure Plugin", add a new external tool (the "+" button), give it a name like "Compare with Meld", additionally set a keyboard shortcut for it and under the "Edit" field, enter this:

#!/bin/sh 
meld $GEDIT_CURRENT_DOCUMENT_DIR/$GEDIT_CURRENT_DOCUMENT_NAME `zenity --file-selection --title="File for comparsion" --filename=/home/` &

Now whenever you press the keyboard shortcut you've set above or go to Tools > External Tools > Compare with Meld (or whatever name you've set for the custom external tool), a Zenity window will popup letting you browse for a file to compare with the currently active file in Gedit.


«
Next
Newer Post
»
Previous
Older Post