Vscode: CMD + Backspace while at Col 1 should remove line

Created on 4 Dec 2016  路  15Comments  路  Source: microsoft/vscode

  • VSCode Version: 1.7.2
  • OS Version: macOS 10.12.1

CMD + Backspace at the end of a line properly removes the characters line, leaving the cursor at Col 1. But using the same combo a second time does nothing. You have to release CMD for Backspace to remove the line. You should be able to keep CMD pressed and either remove all the characters in a line, or remove the line itself if the line is empty.

Steps to Reproduce:

  1. Starting at the right of a line of characters, use CMD + Backspace to remove the characters.
  2. Hit the same combo again, and the line isn't removed.
feature-request mac

Most helpful comment

Indeed, reopening to track as a feature request.

All 15 comments

You can use Shift+Cmd+K to delete the current line.

Sure, but I think what I'm explaining is standard for other editors and text areas (like the one I'm typing in now).

Indeed, reopening to track as a feature request.

+1

I have the same issue and I am on mac. The vscode version is 1.12.2.

The cmd+backspace works fine when edit text focused. So, I added a key binding for clear all left action when terminal focus:

[
{ "key": "cmd+backspace",         "command": "deleteAllLeft",
                                     "when": "terminalFocus" }
]

However, the cmd+backspace doesn't work. What did I do wrong? Moreover, the cmd+k also doesn't work when the terminal focused.

@changkun This issue is about the behavior in the text editor when the cursor is at the begin of the line. Please open a separate issue for your request (which might depend on the shell you are using).

Any update on this? Or any short-term fix? TBH it's really the only lingering habit I have that trips me up in Code.

I just found that Cmd + Delete (delete right of cursor) works. (But no update.)

I see that a corresponding pull request is already merged. Can anyone tell me is this already included in release build? I still encounter this issue on the latest editor version.

@poohitan Not sure which pull request you refer to, but the above one seems still pending.

@chrmarti yes, I referred to the one above, I wonder how did I saw it as merged, I guess it was the lack of sleep :). Sorry.

Just switched over from Sublime, wishing this would be fixed :/

Cmd + backspace is the fastest way to delete lines of code in an upward direction.
Really hoping this gets fixed!

Similarly stymied by this after moving from Sublime, I have the following short-term fix. This is a 'close enough' fix to what I am used to, but with one caveat: It doesn't stop at the linebreak like Sublime, but always removes the line break you're up against.

deleteline

  1. Install Macros extension
  2. Create new macro in your settings:
"macros": {
    "deleteLineReturn": [
        "deleteAllLeft",
        "deleteLeft"
    ]
}
  1. Assign key binding:
{
    "key": "cmd+backspace",
    "command": "macros.deleteLineReturn",
    "when": "editorTextFocus && !editorReadonly"
}

I went with deleteAllLeft rather than deleteLine, since you may wish to preserve what's to the right of your cursor.

This is fixed already.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

biij5698 picture biij5698  路  3Comments

borekb picture borekb  路  3Comments

VitorLuizC picture VitorLuizC  路  3Comments

vsccarl picture vsccarl  路  3Comments

DovydasNavickas picture DovydasNavickas  路  3Comments