Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a way to forward-delete in insert-mode in vim? I'm using a MacVim. I tried "Control-D", but it obviously doesn't work. I'm searching the official documentation, but cannot find. Any help would be appreciated.

share|improve this question

4 Answers 4

up vote 3 down vote accepted

Its the fn key and backspace (<X)) or alt and backspace (<X)).

share|improve this answer
    
I think what TK is getting at is a way to forward delete without breaking hand position on home row, in the same quick way you can backspace with Ctrl-H. It's an important capability for maintaining high editing speed and minimizing repetitive strain. I really like Fontaine's answer below to remap Ctrl-D because that already works in Terminal and other places, so it's already in the muscle memory. –  scanny Mar 8 '13 at 10:08
    
@scanny Welcome to Super User and thanks for your reply. However, I don't think the OP is still looking for the answer after nearly 3 years. ;-) Do feel free to up vote the other answers when you can, though! –  BloodPhilia Mar 8 '13 at 10:15

The beauty of Vim is its portability! Keep it agnostic.

inoremap <C-d> <Esc>lxi

edit: KISS even better!

inoremap <C-d> <Del>
share|improve this answer

There's no built-in way, however you can create a key map like this:

:imap <C-d> <Esc>wdiwi
share|improve this answer
    
Lol, it's already solved... Mac has a key set for it, check my answer. –  BloodPhilia Jun 16 '10 at 20:27
1  
I prefer the following (which is portable!): inoremap <C-D> <space><esc>ce. (dfooi can be simplified into cfoo) –  Luc Hermitte Jun 16 '10 at 21:20
    
@ BloodPhilia: Yeah I saw that, just thought someone using a different vim (not MacVim) might want a solution :) –  sml Jun 17 '10 at 3:59
1  
Unfortunately, this particular mapping hides/overrides the default "dedent"/unindent mapping, which is (at least for me), pretty useful. Maybe <key>C-BS</key> instead? –  Jeet Nov 15 '10 at 22:39

You may enter in the quick-command mode (<C-o>) and then forward-delete (<S-c> or <S-d>).

share|improve this answer

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.