Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VIM - How to delete a word in the INSERT mode?

Tags:

vim

How to delete a word in the INSERT mode? I'm usually using CTRL+W to delete from the cursor to the beginning of the previous word. Is there a shortcut to do the same but with opposite direction?

like image 781
whitesiroi Avatar asked Aug 22 '15 09:08

whitesiroi


People also ask

How do I delete one word in Vim?

To delete a word, position the cursor at the beginning of the word and type dw . The word and the space it occupied are removed. To delete part of a word, position the cursor on the word to the right of the part to be saved. Type dw to delete the rest of the word.

How do you delete and insert in Vim?

Or, you could perhaps use the key sequence bdwi to delete the current word and go into INSERT mode. You can use bcw to go to the beginning of the current word then change the word, which leaves you insert mode. If your cursor is already on the first character of the word, that will end up deleting the previous word.


1 Answers

There's no built-in command for that but you can create your own easily:

inoremap <key> <C-o>de
like image 123
romainl Avatar answered Oct 24 '22 23:10

romainl