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.

In VIM, I find myself reflexively hitting the insert key, before entering text.
Normally because I have been doing some reading and often, but not always, I'll have switched out to do a search or something. (into normal mode). When I am already in insert mode, hitting the insert key put me into replace mode.

For my personal workstyle, and the kind of work I am doing, I almost never want to be in replace mode.

Ideally I would like the behavour of the insert key to be:

Insert: If in insert mode, do nothing,
If not in insert mode, change to insert mode.

I would like to make the behavour of

Shift+Insert: Change to Replace Mode
(I don't use shift insert for pasting -  i've got tused to using P for that

How can I do this? I've sure it can be done with one of the many many remap commands, in my .vimrc.

share|improve this question
    
Force yourself to abandon your bad habits instead of looking for ways to mitigate their effects. –  romainl Mar 9 at 9:33
    
@romainl: Why? (I honestly want a explaination, you might be onto something.) –  Oxinabox Mar 9 at 9:34
    
When you have a disease that causes large green star-shaped stains to appear on your limbs, the solution is not to cover them with clothes or make-up: the solution is to treat the disease. Your bad habit is causing unwanted effects, the solution is not to hide those effects: it's to fight your bad habits. –  romainl Mar 9 at 12:27
    
I think romainl is trying to say there are MUCH better ways to enter insert mode than pressing the "insert" key. The usual way to enter insert mode would be using i or a to enter insert mode at the cursor; I or A to enter insert mode at the beginning/end of the line; o or O to start insert mode on a new line; cc or S to clear the current line and start inserting there; etc. There is also the consideration of WHY you don't realize you're already in insert mode. There is a pretty prominent cursor difference, there is a mode indicator near the status line, etc. –  Ben Mar 9 at 15:42
    
It is also possible to make it REALLY obvious by changing colorscheme, etc. in insert mode. But that's probably overkill. –  Ben Mar 9 at 15:42
show 1 more comment

1 Answer 1

up vote 4 down vote accepted

Try these:

imap <Insert> <Nop>
inoremap <S-Insert> <Insert>
share|improve this answer
add comment

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.