Vim Tips Wiki
Advertisement
Tip 189 Printable Monobook Previous Next

created January 2, 2002 · complexity basic · author Robert Ames · version 5.7


Put this in your vimrc and then you'll be able to type Control-Backspace to delete the previous word.

" map control-backspace to delete the previous word
:imap <C-BS> <C-W>

References

See also

Comments

In my version of Linux, this works properly in gvim, but not in terminal-vim. My keyboard mapping doesn't have a control-backspace. --Kanliot 08:38, May 28, 2012 (UTC)

Had same problem, did this:
noremap! <C-BS> <C-w>

noremap! <C-h> <C-w>

probably not the best way to do it, but it seems to work. ~~~~

There are some issues with <C-w>. For example it considers the insert mode's point of entry as a word boundary. Also, in readline <C-w> usually means to kill the previous WORD. There is a way to make it more readline-ish:

inoremap <C-w> <C-\><C-o>dB
inoremap <C-BS> <C-\><C-o>db
Advertisement