Open easyfrog opened 2 years ago
this is a plugin I wrote some time back for the exact purpose
from .terminus.core import *
class TerminusReRunCommand(TerminusFindTerminalMixin,sublime_plugin.WindowCommand):
def run(self, tag=None, visible_only=False):
terminal = self.find_terminal(self.window, tag=tag, visible_only=visible_only)
if not terminal:
raise Exception("no terminal found")
elif not terminal.process.isalive():
raise Exception("process is terminated")
if terminal.panel_name:
self.window.run_command("show_panel", {
"panel": "output.{}".format(terminal.panel_name)
})
else:
TerminusSendStringCommand.bring_view_to_topmost(self,terminal.view)
#terminal.view.run_command("terminus_render")
terminal.view.run_command("terminus_show_cursor")
terminal.send_key("up")
terminal.send_key("enter")
If you want to use it directly, create an override using OverrideAudit
and place it in the Terminus folder. Looking at it, there might be some improvements which could be made but it worked for me.
Thinking about it your use-case is a bit different. maybe you could include the send_key("up")
as part of your post-window hooks.
In daily development, the usual operation is to open Terminus and press the up key to re-use the last command and then press Enter to execute it
Therefore, it would be helpful if terminus can display the previous command (automatic execution press the up key) when opening terminus.