Terminus
Terminus copied to clipboard
How NOT to hide panel on ESCAPE press?
Hi,
sorry this might be a question related to sublime itself, but I can't seem to find a way to disable the closing of the panel every time I press ESCAPE. I do so quite frequently and the panel with the terminal inside closes. It can be easily reopened or even used in a VIEW rather than in a PANEL, however I do prefer the panel.
I've found the following in the default key bindings but could only figure out how to "unbind" the ESCAPE key entirely which prevents anything from being escaped.
{
"keys": ["escape"],
"command": "hide_panel",
"args": {"cancel": true},
"context":
[
{ "key": "panel_visible", "operator": "equal", "operand": true }
]
}
Any hints?
Apologies if this is the wrong place to ask.
Just put the following in your keybind
{ "keys": ["escape"], "command": "terminus_keypress", "args": {"key": "escape"},
"context": [
{ "key": "terminus_view" }
] },
Didn't help :(
It should work unless another package has overrided it. Run sublime.log_commands(True)
in the sublime console to see what command was executed.
command: hide_panel {"cancel": true}
Did you copy the hide_panel escape keybind?
No I'm only using the one you gave me. Here are all my keybindings:
[
{ "keys": ["ctrl+b"], "command": "goto_definition" },
{ "keys": ["ctrl+`"], "command": "toggle_terminus_panel" },
{ "keys": ["escape"], "command": "terminus_keypress", "args": {"key": "escape"},
"context": [
{ "key": "terminus_view" }
]
}
]
Btw ESC does not close terminus when terminus is in focus, but I believe this is the default behavior. However as soon as it looses focus and I have a reason to press ESC it does what I wanted it to do but has a side effect of closing terminus.
Oh, I may have misunderstood you. I thought escape
closes Terminus panel when it is in focus. It is an issue of Sublime Text. escape
will hide any output panel when escape
is hit.
It is currently impossible because there is no context to tell if a Terminus panel is visible. Terminus could do something in this direction though.
Yeah I was afraid you would say that. Let's hope that you can figure out something magical to make it happen ;) Thx for your work on this btw. It's working really great! Also thx for the time you put into answering my questions. FYI I only prefer the panel over the view because it takes less space and kinda looks cooler :)
Let’s keep it open
Because a similar issue brought me here and incase anyone else has the same problem as me in often accidentally closing the console view....
If you are using open-in-view, then over-riding the close tab keyboard shortcut can save you a lot of pain. Add this to your Keymap file.
{
"keys": ["command+w"],
"command": "terminus_keypress",
"args":
{
"key": ""
},
"context": [
{
"key": "terminus_view"
}]
},
Even though this never happened to me (yet) I do see value in it, thx ;) Btw it's ctrl+w
for windows/linux.
Very Recently I started using the terminus extensively, so I did this, here's the solution, this Safely ONLY removes the Panel Close from the Escape Key Functions, the rest work the same way in the same order. If you have any Queries how this works please ask,
All you have to do is copy this to your sublime key map files
If you actually want to close the panel you can use shift+escape.
This behaviour applies to all panels. If you want to limit to only preventing terminus closing, then add { "key": "terminus_view"}
in the context list of the pass command.
{ "keys": ["escape"], "command": "pass", "context": [
{ "key": "panel_visible", "operator": "equal", "operand": true },
{ "key": "panel_has_focus", "operator": "equal", "operand": false},
{ "key": "num_selections", "operator": "equal", "operand": 1 },
{ "key": "has_next_field", "operator": "equal", "operand": false },
{ "key": "has_prev_field", "operator": "equal", "operand": false },
{ "key": "overlay_visible", "operator": "equal", "operand": false },
{ "key": "popup_visible", "operator": "equal", "operand": false },
{ "key": "auto_complete_visible", "operator": "equal", "operand": false }
]},
{ "keys": ["escape"], "command": "single_selection", "context": [
{ "key": "num_selections", "operator": "not_equal", "operand": 1 },
{ "key": "panel_visible", "operator": "equal", "operand": true },
{ "key": "panel_has_focus", "operator": "equal", "operand": false }
]},
{ "keys": ["escape"], "command": "clear_fields", "context": [
{ "key": "has_next_field", "operator": "equal", "operand": true },
{ "key": "panel_visible", "operator": "equal", "operand": true },
{ "key": "panel_has_focus", "operator": "equal", "operand": false }
]},
{ "keys": ["escape"], "command": "clear_fields", "context": [
{ "key": "has_prev_field", "operator": "equal", "operand": true },
{ "key": "panel_visible", "operator": "equal", "operand": true },
{ "key": "panel_has_focus", "operator": "equal", "operand": false }
]},
{ "keys": ["shift+escape"],
"command": "hide_panel",
"args": {"cancel": true},
"context": [
{ "key": "panel_visible", "operator": "equal", "operand": true },
]
},
Thanks for sharing the key binding config. It was flawlessly. When i was looking for a solution I've put together something similar but instead of command "pass" I've used "noop". Anyone knows what would be a difference?
{ "keys": ["escape"], "command": "pass", "context": [
{ "key": "panel_visible", "operator": "equal", "operand": true },
...
vs
{ "keys": ["escape"], "command": "noop", "context": [
{ "key": "panel_visible", "operator": "equal", "operand": true },
...
When i was looking for a solution I've put together something similar but instead of command "pass" I've used "noop". Anyone knows what would be a difference?
There is no difference whether you write noop or pass , as both essentially refer to a command that doesn't exist in sublime, hence no operation is performed on pressing escape .
If you are using open-in-view, then over-riding the close tab keyboard shortcut can save you a lot of pain. Add this to your Keymap file. { "keys": ["command+w"], "command": "terminus_keypress", "args": { "key": "" }, "context": [ { "key": "terminus_view" }] },
Building on this, I am often trying to close the current tab that Terminus is overlaid on when I hit cmd+w. If Terminus has focus it will close it, sometimes while it is running a long running process, which is a pain. Instead of just noop, I use the following to close the tab as intended.
{
"keys": ["command+w"],
"command": "close",
"context": [
{
"key": "terminus_view"
}
]
},