new command, assigneable to key binding #7898

Closed
opened 2026-01-31 01:15:22 +00:00 by claunia · 12 comments
Owner

Originally created by @dmarinescu on GitHub (May 3, 2020).

{
  "command": "cls",
  "keys": [ "ctrl+l" ]
}

or whatever, more generic command syntax suits you

Originally created by @dmarinescu on GitHub (May 3, 2020). { "command": "cls", "keys": [ "ctrl+l" ] } or whatever, more generic command syntax suits you
claunia added the Issue-FeatureResolution-Duplicate labels 2026-01-31 01:15:23 +00:00
Author
Owner

@DHowett-MSFT commented on GitHub (May 3, 2020):

Sorry, is this a request for a clear screen binding? That wasn’t clear from the title.

If you’re using bash, zsh or PowerShell you can use Ctrl+L to clear the screen. Right now, it is the shell’s job to clear the screen.

If you want the terminal to have a reset screen key binding, this is a duplicate of another request. I won’t close this bug until I am certain.

@DHowett-MSFT commented on GitHub (May 3, 2020): Sorry, is this a request for a clear screen binding? That wasn’t clear from the title. If you’re using bash, zsh or PowerShell you can use Ctrl+L to clear the screen. Right now, it is the shell’s job to clear the screen. If you want the terminal to have a reset screen key binding, this is a duplicate of another request. I won’t close this bug until I am certain.
Author
Owner

@dmarinescu commented on GitHub (May 3, 2020):

close it, it does not matter

@dmarinescu commented on GitHub (May 3, 2020): close it, it does not matter
Author
Owner

@DHowett-MSFT commented on GitHub (May 3, 2020):

I’d like to understand your request 😄

@DHowett-MSFT commented on GitHub (May 3, 2020): I’d like to understand your request :smile:
Author
Owner

@dmarinescu commented on GitHub (May 3, 2020):

i would find it useful, regardless on who is handling this in bash, for
windows terminal, especially under cmd personality, to be able to set
ctrl-l to render into a certain string, injected into the input buffer, like
"keybindings": [
{
"command": "closePane",
"keys": [ "ctrl+d" ]
},
{
"command": "cls",
"keys": [ "ctrl+l" ]
}
]

closePan is a member of shortcutactionname enum, but there is not
easy/obvious way to associate (short)keys with commands injected in the
input buffer, just like they were typed by the end looser (as you call them)

"ShortcutActionName": {
"enum": [
"adjustFontSize",
"closePane",
"closeTab",
"closeWindow",
"copy",
"decreaseFontSize",
"duplicateTab",
"moveFocus",
"newTab",
"nextTab",
"openNewTabDropdown",
"openSettings",
"paste",
"prevTab",
"resetFontSize",
"resizePane",
"scrollDown",
"scrollDownPage",
"scrollUp",
"scrollUpPage",
"splitPane",
"switchToTab",
"toggleFullscreen",
"find",
"unbound",

    *"input"*

],
"type": "string"
}

would allow

"keybindings": [
{
"command": "input:cls",
"keys": [ "ctrl+l" ]
}
]

where input would be the new enum member (ugly like hell as it is
statically defined) and cls as being the param...

no biggie

@dmarinescu commented on GitHub (May 3, 2020): i would find it useful, regardless on who is handling this in bash, for windows terminal, especially under cmd personality, to be able to set ctrl-l to render into a certain string, injected into the input buffer, like "keybindings": [ { "command": "closePane", "keys": [ "ctrl+d" ] }, { "command": "cls", "keys": [ "ctrl+l" ] } ] closePan is a member of shortcutactionname enum, but there is not easy/obvious way to associate (short)keys with commands injected in the input buffer, just like they were typed by the end looser (as you call them) "ShortcutActionName": { "enum": [ "adjustFontSize", "closePane", "closeTab", "closeWindow", "copy", "decreaseFontSize", "duplicateTab", "moveFocus", "newTab", "nextTab", "openNewTabDropdown", "openSettings", "paste", "prevTab", "resetFontSize", "resizePane", "scrollDown", "scrollDownPage", "scrollUp", "scrollUpPage", "splitPane", "switchToTab", "toggleFullscreen", "find", "unbound", *"input"* ], "type": "string" } would allow "keybindings": [ { "command": "input:cls", "keys": [ "ctrl+l" ] } ] where input would be the new enum member (ugly like hell as it is statically defined) and cls as being the param... no biggie
Author
Owner

@dmarinescu commented on GitHub (May 3, 2020):

i would like to have an easy way (in settings) to associate a certain key
with a particular / custom design string to be injected in the input
buffer. so i can create (for example) a new keybinding
{
"command": "inject:cls\n",
"keys": [ "ctrl+l" ]
}

or something like that

let's not split hair on syntax semantics... did not look over the source
code

@dmarinescu commented on GitHub (May 3, 2020): i would like to have an easy way (in settings) to associate a certain key with a particular / custom design string to be injected in the input buffer. so i can create (for example) a new keybinding { "command": "inject:cls\n", "keys": [ "ctrl+l" ] } or something like that let's not split hair on syntax semantics... did not look over the source code
Author
Owner

@dmarinescu commented on GitHub (May 3, 2020):

i would like to be able to define a keybinding with the result of replacing
my key (e.g. ctrl-l) with a certain string (e.g. "cls\n" or "cls" or
whatever, syntax is irrelevant)

this why, whatever i may need to be automated (as in i enter ctrl-C and i
get the speed of light in my terminal line buffer)

@dmarinescu commented on GitHub (May 3, 2020): i would like to be able to define a keybinding with the result of replacing my key (e.g. ctrl-l) with a certain string (e.g. "cls\n" or "cls<nl>" or whatever, syntax is irrelevant) this why, whatever i may need to be automated (as in i enter ctrl-C and i get the speed of light in my terminal line buffer)
Author
Owner

@dmarinescu commented on GitHub (May 3, 2020):

that makes two of us, actually.

what about having a new command, allowing, at any time during editing or
current line, if a certain (short) key is detected and if it is not
contradictory with higher order semantics, the key will be replaced by a
certain, configurable string, to be injected in current cursor position, in
the line editor buffer, like a c define? like a macro...

@dmarinescu commented on GitHub (May 3, 2020): that makes two of us, actually. what about having a new command, allowing, at any time during editing or current line, if a certain (short) key is detected and if it is not contradictory with higher order semantics, the key will be replaced by a certain, configurable string, to be injected in current cursor position, in the line editor buffer, like a c define? like a macro...
Author
Owner

@dmarinescu commented on GitHub (May 3, 2020):

very hard to understand, indeed

what about this (now generalized, different feature, potentially)

you are at the end of a very long / ugly line, you press ctrl-f and you get
the long line nicely formatted with ^ line continuation characters for each
little line resulted from beautifying. just an example (not functionally
congruent as this is doing more than a string insertion, but could be
generalized to do both, etc)

@dmarinescu commented on GitHub (May 3, 2020): very hard to understand, indeed what about this (now generalized, different feature, potentially) you are at the end of a very long / ugly line, you press ctrl-f and you get the long line nicely formatted with ^ line continuation characters for each little line resulted from beautifying. just an example (not functionally congruent as this is doing more than a string insertion, but could be generalized to do both, etc)
Author
Owner

@j4james commented on GitHub (May 3, 2020):

This sounds similar to #5273.

@j4james commented on GitHub (May 3, 2020): This sounds similar to #5273.
Author
Owner

@DHowett-MSFT commented on GitHub (May 3, 2020):

Thanks for explaining! I think this is captured in #3799 already -- it's a feature request for a key binding that can send any input into the terminal.

It would probably look something like...

{
    "command": {
        "action": "sendInput",
        "input": "cls\n"
    }
    "keys": "ctrl+shift+l"
}

/dup #3799.

@DHowett-MSFT commented on GitHub (May 3, 2020): Thanks for explaining! I think this is captured in #3799 already -- it's a feature request for a key binding that can send any input into the terminal. It would probably look something like... ```jsonc { "command": { "action": "sendInput", "input": "cls\n" } "keys": "ctrl+shift+l" } ``` /dup #3799.
Author
Owner

@ghost commented on GitHub (May 3, 2020):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (May 3, 2020): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Author
Owner

@dmarinescu commented on GitHub (May 3, 2020):

ok, perfect, thanks bro

@dmarinescu commented on GitHub (May 3, 2020): ok, perfect, thanks bro
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#7898