def on_select(self, index): # get file and line module_name = self.module_names[index] # open man retcode, data = SUBLIMERL.execute_os_command("%s -man %s | col -b" % (SUBLIMERL.erl_path, module_name)) if retcode == 0: self.log(data)
def on_select(self, index): # get file and line module_name = self.module_names[index] # open man retcode, data = SUBLIMERL.execute_os_command( "%s -man %s | col -b" % (SUBLIMERL.erl_path, module_name)) if retcode == 0: self.log(data)
def format(self): # save current caret position current_region = self.view.sel()[0] # save current file contents to temp file region_full = sublime.Region(0, self.view.size()) content = self.view.substr(region_full).encode('utf-8') temp = tempfile.NamedTemporaryFile(delete=False) temp.write(content) temp.close() # call erlang formatter os.chdir(SUBLIMERL.support_path) escript_command = "sublimerl_formatter.erl %s" % SUBLIMERL.shellquote(temp.name) retcode, data = SUBLIMERL.execute_os_command('%s %s' % (SUBLIMERL.escript_path, escript_command)) # delete temp file os.remove(temp.name) if retcode == 0: # substitute text self.view.replace(self.edit, region_full, data.decode('utf-8')) # reset caret to original position self.view.sel().clear() self.view.sel().add(current_region) self.view.show(current_region)