Skip to content

Instantly share code, notes, and snippets.

@omps
Last active January 22, 2022 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omps/daf6234af41d9ed3c103ca48884e1e28 to your computer and use it in GitHub Desktop.
Save omps/daf6234af41d9ed3c103ca48884e1e28 to your computer and use it in GitHub Desktop.
Visual Studio Code - Ctrl + Backspace set to deleteWordBefore
Based on the latest comment https://github.com/microsoft/vscode/issues/68167 I have modified JerryGoyal's answer so we don't have to modify bindings:
Put the following at the top of your Microsoft.PowerShell_profile.ps1 config file (type $profile in the terminal to find it, you might have to create one if it doesn't exist already)
```PowerShell_profile
if ($env:TERM_PROGRAM -eq "vscode") {
Set-PSReadLineOption -EditMode Emacs
}
This works for me (vscode 1.43)
The command you want is called deleteWordEndLeft. From experimentation, this deletes, to the left, all contiguous non-whitespace characters, followed by all contiguous whitespace characters.
Before:
this is some example text
^
cursor (to left of 'm')
After deleteWordEndLeft:
this is somemple text
^
cursor (to left of 'm')
Hopefully that's the behavior you want! (Sorry for getting it wrong initially.)
To bind it, go into the key bindings (File → Preferences → Keyboard Shortcuts) and use the search box to search for deleteWordEndLeft. That will show you the existing key binding (if any; it is not bound by default on Windows). You can change the keybinding by right-clicking on the binding and choosing Change Keybinding (if bound) or Add Keybinding (if not).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment