Closed ianyepan closed 1 year ago
It could be your terminal emulator. Your Lua is alright. Where are you running Neovim? Ctrl and Backspace are fiddly to handle in terminal emulators.
Binding <C-bs> works in nvim-qt
and Neovide (two GUI apps) but didn't work in any of the terminal emulators I tried.
Binding <C-h> worked in Windows Terminal and mintty (Git Bash) but didn't work in Alacritty for me.
I was more successful binding Alt+Backspace (<M-bs>) for that. It works consistently across GUIs and terminal emulators, and has the additional benefit of being the default keybinding used to delete words in many shells, REPLs, etc. so I suggest you to try it out
vim.keymap.set('i', '<M-BS>', '<C-w>')
Thanks for the reply. I ended up configuring it at the terminal settings level. I am using Windows Terminal, so I just had to put these lines in the settings.json
file:
{
"keys": "ctrl+backspace",
"command":
{
"action": "sendInput",
"input": "\u0017"
}
}
I've thought about using alt+backspace, but I'm just too used to ctrl+backspace, especially since it's the universal "delete word" shortcut in Windows too.
I'd like to use Ctrl+Backspace to delete a word. So far I've tried:
But none of them seem to work.
Any ideas what I am doing wrong? Thanks!