Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've recently started using vim. From previous editors I'm used to delete 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 :P ). 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?

share|improve this question
Welcome in Vim hell. – romainl Feb 25 at 13:07
1  
I like the fact that this hell is quite productive and can be improved with patches. – Ingo Karkat Feb 25 at 13:10
BTW, I'm collecting these kind of questions to hopefully be able to make a case that this particular problem is tackled in a Vim 8.0. I really want more and more uniform mapping candidates, too. – Ingo Karkat Feb 25 at 13:13

1 Answer

up vote 2 down vote accepted

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.

share|improve this answer
Thanks for the quick answer. I guess I'll just have to get used to using ctrl-w for vim and ctrl-backspace for browsers. – user1026044 Feb 25 at 13:35
The good thing about Ctrl-W is that it also works in Bash etc. – Ingo Karkat Feb 25 at 14:09
Yeah, I know. But you still have to use ctrl-backspace for everything else, and the fact that ctrl-w seems to be standard for closing tabs and windows everywhere else makes it annoying. I'll probably get used to it after a while though. – user1026044 Feb 25 at 14:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.