blackst0ne
blackst0ne

Reputation: 721

Toggle insert/navigation modes by pressing insert key?

By default when I press insert key, vim switches to the INSERT mode. If I press insert key again, vim switches to the REPLACE mode.

I want to toggle INSERT/NAVIGATION modes by pressing insert key.

I.e.: press insert key -> get INSERT mode. Press insert key again -> get back NAVIGATION mode.

How do I get that?

Upvotes: 1

Views: 212

Answers (2)

ck3g
ck3g

Reputation: 5929

imap <insert> <esc>

Upvotes: 2

Ingo Karkat
Ingo Karkat

Reputation: 172510

To change the meaning of the <Insert> key (that's how it's spelled in Vim's key notation), you define an insert mode mapping. Since you want to leave insert mode, you map the key to <Esc>, which takes you out of insert mode.

:inoremap <Insert> <Esc>

Upvotes: 5

Related Questions