Sublime Text 2 + Perforce

After shopping around for a new text editor, I decided to stick with Sublime Text 2. While the editor is still in Beta, it is very fast and stable. See this video review at HeyBigName.com for a more detailed review.

Even for home projects, I tend to use Perforce (the licence is free if you have 2 users max). While Sublime Text 2 didn’t support a perforce integration, it was pretty easy to add a small python plugin to allow

  • User command to be bound on a menu item or keyboard shortcut
  • Call to p4 edit when a file is read only and about to be saved

I think the longest part was understanding that to call my PerforceCheckoutCommand I had to write perforce_checkout (no caps, _ added and command removed) in the config file.

For those of you who would be interested in using it, it’s available on GitHub

https://github.com/ericmartel/Sublime-Text-2-Perforce-Plugin

Edit: The plugin now supports auto checkout, auto add, checkout command and add command. I’m waiting for Sublime Text 2 to support delete and rename callback to add those. The plugin was also submitted to be part of Package Control (another useful plugin for Sublime Text 2) to ease its integration.

Edit: It is now part of Package Control, just use Package Control: Install Package and type Perforce and you’re all set!

Leave a Reply

Your email address will not be published. Required fields are marked *