Created
November 19, 2014 02:13
-
-
Save tomasklapka/996c3ab67a50e35c6803 to your computer and use it in GitHub Desktop.
Terminator Plugin to handle file paths with line number to be handled and opened in Sublime Text (or change editor_cmd to whatever you want)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import terminatorlib.plugin as plugin | |
import subprocess | |
# Every plugin you want Terminator to load *must* be listed in 'AVAILABLE' | |
AVAILABLE = ['EditorFileURLHandler'] | |
editor_cmd = "subl" | |
class EditorFileURLHandler(plugin.URLHandler): | |
capabilities = ['url_handler'] | |
handler_name = 'file_path' | |
# Match any non-space string starting with an alnum or a slash and ending with a line number | |
match = r'[a-zA-Z0-9\/][^ ]+:[[:digit:]]+|[a-zA-Z0-9\/][^ ]+\([[:digit:]]+\)' | |
def callback(self, url): | |
subprocess.Popen([editor_cmd, url]) | |
return "some_random_string_just_so_that_opening_the_resulting_url_will_fail" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment