From 825a15079a279cd67c5c561b178906791f9e0975 Mon Sep 17 00:00:00 2001 From: Jacques Heunis Date: Sun, 1 Mar 2015 14:11:50 +0200 Subject: [PATCH] Auto-open selected file when selecting a completion --- i_opener.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/i_opener.py b/i_opener.py index 2ec7d17..371f375 100644 --- a/i_opener.py +++ b/i_opener.py @@ -320,14 +320,17 @@ def on_done(self, i): # Remove what was there before. directory = split( self.get_text() )[0] new_path = join(directory, self.path_cache[i]) - + self.path_cache = None + if (isdir(expanduser(new_path))): new_path = new_path + sep - - self.set_text(new_path) - self.path_cache = None + self.set_text(new_path) + sublime.active_window().focus_view(self.view) + else: + self.open_file(new_path) + sublime.active_window().run_command("hide_panel", {"cancel": True}) + else: sublime.active_window().focus_view(self.view) - sublime.active_window().focus_view(self.view) #----------------------------------------------------------------------#