This is an automated archive made by the Lemmit Bot.
The original was posted on /r/neovim by /u/retrodanny on 2024-11-07 18:27:05+00:00.
I use Ctrl+Backspace
pretty much everywhere to delete back one word. I can’t type properly without it, so I really needed to make it work in Vim. (I know Ctrl+W
does this natively, but ask yourself: how many times have you accidentally closed your browser tab or made a mistake in another app because of this?).
It took me a while to figure it out, so just wanted to share my solution here for anyone in the same situation:
Note: I’m using Windows Terminal + Neovim
You can’t just map to in your vimrc, you have to configure this at the terminal level.
First, go to the Windows Terminal settings and Open JSON file (settings.json), add the following under actions:
{ "keys": "ctrl+backspace", "command": { "action": "sendInput", "input": "\u0017" } }
The above will map to and it should work now inside Vim. However, Ctrl+BS no longer works in Powershell, it just adds ^W^W^W
to your command line.
To fix this, add the following line to your Powershell $profile:
Set-PSReadLineKeyHandler -Chord Ctrl-w -Function BackwardDeleteWord
And that’s it, Ctrl+Backspace works as intended in all your applications, powershell, and Vim!