Mapping ctrl-backspace in terminator
I've recently started using Vim. From previous editors, I'm used to deleting a whole word by pressing Ctrl-Backspace. After looking at the documentation I found that this was done by pressing Ctrl-w in Vim. The problem is that after getting used to pressing Ctrl-w, I've started closing tabs and chats every time I misspell a word (while writing this question I closed this tab 5 times). So I checked how to map keys in Vim and tried this:
:imap <C-BS> <C-w>
Unfortunately, it didn't work. After a bit of research I found that the terminal does not distinguish between Ctrl-Backspace and Backspace. I saw some hacks and patches to fix this issue, but I couldn't get them to work on terminator (which is the emulator I want to use).
Is there any way to map Ctrl-Backspace in Vim when using terminator?
Due to the way that the keyboard input is handled internally, this unfortunately isn't generally possible today. Some key combinations, like Ctrl + non-alphabetic cannot be mapped, and Ctrl + letter vs. Ctrl + Shift + letter cannot be distinguished. (Unless your terminal sends a distinct termcap code for it, which most don't.) In insert or command-line mode, try typing the key combination. If nothing happens / is inserted, you cannot use that key combination. This also applies to <Tab>
/ <C-I>
, <CR>
/ <C-M>
/ <Esc>
/ <C-[>
etc. (Only exception is <BS>
/ <C-H>
.) This is a known pain point, and the subject of various discussions on vim_dev and the #vim IRC channel.
Some people (foremost Paul LeoNerd Evans) want to fix that (even for console Vim in terminals that support this), and have floated various proposals, cp. http://groups.google.com/group/vim_dev/browse_thread/thread/626e83fa4588b32a/bfbcb22f37a8a1f8
But as of today, no patches or volunteers have yet come forward, though many have expressed a desire to have this in a future Vim 8 major release.