Skip to content

Perforce Plugin

Trevor Williams edited this page Apr 25, 2020 · 1 revision

This plugin may only apply to a small subset of the TKE user base who use Perforce for their version control system, but it’s a really handy one that does one thing really well. When you are working with Perforce-controlled files, getting permissions to edit a file requires that you always execute the ‘p4 edit filename’ command before you save the file contents. This usually means that you need to open a terminal, enter the command, then go to your editor where you make and save the change.

The Perforce plugin, when installed, automatically performs a p4 edit on the file when the file is saved. This will greatly improve your workflow when editing Perforce-controlled files (so much so that it will bother you to use other editors that don’t have this feature).

To install the plugin, simply click on the Plugins / Install… menu item and select the Perforce plugin from the available list. Before using the plugin, select the Plugins / Perforce / Edit include directories menu option. This will open a settings file in a new editing buffer which will look like the following:

# Host Directory
# ——— ————

Below the line, enter the name of the server containing the Perforce view that you would like to edit (i.e., the result of executing the ‘hostname’ command on *nix filesystems), followed by one or more spaces, and the base directory containing the Perforce view to edit (i.e., the result of displaying $P4WORKAREA in a terminal). Save the file, close it, and you are ready to start editing without the tedium ad nauseum of ‘p4 edit’ madness. You can add as many Perforce host-directory combinations that you need, if you are someone who works with multiple views on several machines.

If at any time, you want to disable this feature, simply select the Plugins / Perforce / Disable edit on open menu option. The plugin even provides a feature which will revert the current file if you want to throw away changes made to the file since the last file submission via the Plugins / Perforce / Revert current file menu option.

Once you have this plugin enabled and firing on all cylinders, you’ll never want to go back.

Clone this wiki locally