This site has been retired. For up to date information, see handbook.gnome.org or gitlab.gnome.org.


[Home] [TitleIndex] [WordIndex

External Tools

Overview

The goal of this plugin is to allow users to execute external commands from gedit interface. This allow the user to do two things: either to pipe some content into a command and to exploit its output (for example, sed), or to simply launch some predefined command (for example, make).

Using External Tools

  1. To install the plugin, go to Edit -> Preferences -> Plugins -> External Tools.

  2. To configure the plugin, go to Tools -> Manage External Tools.... A dialog will appear and you can start adding tools.

  3. To run tools, go to Tools -> External Tools or use (if applicable) associated shortcut keys.

External Tools dialog

The name of the current tool can be edited directly using the list on the left side of the dialog.

Here is a short description of the editable properties for a given tool:

You can add and remove custom tools, and customize system-provided tools. You can revert latter ones to the upstream version in one click.

Available Environment Variables

Storage and hand-editing of tools

System tools path

User tools path

gedit 2

$XDG_DATA_DIRS/gedit-2/plugins/tools

~/.gnome2/gedit/tools

gedit 3

/usr/share/gedit/plugins/externaltools/tools

~/.config/gedit/tools

(Note: when upgrading to gedit 3, the user generated external tools may not be moved automatically.)

Each tool consists on an executable script file (in Bash, Perl, Python, Ruby, etc.) containing a metadata section that resembles usual desktop files.

The metadata section starts with a # [Gedit Tool] line, and each following line from the metadata section should start with . Those lines contain key/value pairs, in the form of key=value. Current keys are:

The rest of the file is the script to be ran. Note that it is good practice to begin the file with a shebang (ex: #!/bin/perl) so that the system knows which interpretor it should use.

You can also share your home-grown tools by copying the relevant file in your home directory.

Tips and tricks

You can use xargs (combined to the Selection input) to use the selected text as an argument for you command. Here is an exemple using that facility to show the manpage of the selected term:

Current Features

An awful lot ;-).

Possible Features

Screenshots

The External Tools Manager dialog showing the Build tool:


2024-10-23 10:58