Vim Tips Wiki

Map Ctrl-Backspace to delete previous word

Revision as of 00:46, November 3, 2013 by (Talk)

1,619pages on
this wiki
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>


See also


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)

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

Around Wikia's network

Random Wiki