Vscode: Terminal | Ctrl + Backspace

Created on 24 Feb 2020  路  9Comments  路  Source: microsoft/vscode

Can we have an option to be able to delete left words in the vscode integrated terminal by Ctrl + Backspace ? In the windows shell it doesn't work. I know this might not a priority but it's frustrating not being able to do so.

I know there's a current feature request open for this, but we can't comment of give any feedbacks about it. Any idea when would this be implemented or how to do it differently on Windows?

integrated-terminal needs more info windows

Most helpful comment

Updating to PowerShell 7 fixes the issue for me 馃帀

All 9 comments

And CTRL + Left Arrow. Works in ISE but not VScode.

@AllElbows Ctrl+Left/Right Arrows does work for me

If the shell accepts something to delete a word to the left you can make a keybinding to send it:

{
    "key": "ctrl+backspace",
    "command": "workbench.action.terminal.sendSequence",
    "when": "terminalFocus",
    "args": {
        "text": "something"
    }
}

This would be the best VS Code core could do as well as, just sending stuff to the shell. @TylerLeonhardt there's nothing we can send to powershell for this right?

In PSReadLine we added additional keybinding for VS Code:
https://github.com/PowerShell/PSReadLine/blob/ebfe4ce0db94d7dc507c87e412b747def5a1c6e6/PSReadLine/KeyBindings.cs#L232-L235

So as long as you have a newer version of PSReadLine, Ctrl+Backspace should "just work".

Which version of PSReadLine do you have?

In PowerShell 6+:

Get-Module PSReadLine

In Windows PowerShell:

# Run both
Get-Module PSReadLine
Get-Module PSReadLine | % { $_.PrivateData.PSData }

If you don't have the 2.0.0 _stable_ version of PSReadLine, please follow these steps to update:
https://github.com/PowerShell/PSReadLine#upgrading

Then this should "just work"

Now for Ctrl+Arrow keys, I'm not sure how VS Code sends those to the shell. @Tyriar do you know?

Doesn't work for me?

image

You can see what gets sent by enabling escape sequence logging: https://github.com/microsoft/vscode/wiki/Terminal-Issues#enabling-escape-sequence-logging

Note for ctrl+backspace there is this default keybinding:

{ "key": "ctrl+backspace",        "command": "workbench.action.terminal.deleteWordLeft",
    "when": "terminalFocus" },

This binds the same as ctrl+w:

https://github.com/microsoft/vscode/blob/9fea64a934a9c00f7b38ef2519baaa188bcb2567/src/vs/workbench/contrib/terminal/browser/terminalActions.ts#L196-L197

Updating to PowerShell 7 fixes the issue for me 馃帀

Thanks it does work now!

Was this page helpful?
0 / 5 - 0 ratings