Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gerrymanoim/1184449 to your computer and use it in GitHub Desktop.
Save gerrymanoim/1184449 to your computer and use it in GitHub Desktop.
simple script to checkout files you want to edit in sublime text 2 using P4
[
{ "keys": ["f8"], "command": "p4_edit" }
]
[
{ "keys": ["f8"], "command": "p4_edit" }
]
[
{ "keys": ["f8"], "command": "p4_edit" }
]
import sublime, sublime_plugin, os, subprocess
class P4EditCommand(sublime_plugin.TextCommand):
def run(self, edit):
if self.view.file_name():
folder_name, file_name = os.path.split(self.view.file_name())
command = 'p4 edit -c default '+file_name
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=folder_name, shell=True)
result, err = p.communicate()
self.view.set_status('p4',result+err)
sublime.set_timeout(self.clear,2000)
def clear(self):
self.view.erase_status('p4')
@gerrymanoim
Copy link
Author

To use with Sublime Text 2, copy both these files into a new folder in your packages directory (Preferences -> Browse Packages).

github is having issues and including duplicate files in this gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment