From 9a8109c3eda48f0a824e83254ad097bcfa021d44 Mon Sep 17 00:00:00 2001 From: Stefan Podkowinski Date: Sat, 1 Mar 2014 19:56:24 +0100 Subject: [PATCH] added support for open file at specified line number --- rsub.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/rsub.py b/rsub.py index 7a2086d..9ed4801 100644 --- a/rsub.py +++ b/rsub.py @@ -114,8 +114,15 @@ def on_done(self): if len(sublime.windows()) == 0: sublime.run_command("new_window") + # open file at provided line number if specified + try: + lineno = int(self.env.get('selection', -1)) + except ValueError: + lineno = -1 + # Open it within sublime - view = sublime.active_window().open_file(self.temp_path) + if lineno != -1: view = sublime.active_window().open_file(self.temp_path + ':%d' % lineno, sublime.ENCODED_POSITION) + else: view = sublime.active_window().open_file(self.temp_path) SESSIONS[view.id()] = self # Bring sublime to front