5

New to vim/gvim, but I know that if I use C-w in insert mode, I can delete the word behind the cursor and from the beginning of the line to the cursor with C-u. Is there an easy way to do the rest forward of the character? How about to the end of the block? I try to use native commands as far as possible before remapping.

7

Insert mode is best used for just that, inserting text. While there are a few exceptions (Ctrlw and Ctrlu being among them), most text manipulation should occur in Normal mode.

Ctrlo will drop you into Normal mode and let you execute one Normal mode command, then return to Insert mode. You could do the following:

Use Ctrlo to drop to Normal mode for one command, then dw to delete the rest of the word after the cursor, or D to delete the rest of the line, leaving you in Insert mode at the current cursor position.


Relevant Help:

:h i_CTRL-O
:h Insert
:h Normal
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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