Take the 2-minute tour ×

I currently have this handy toggle for swapping between regular insert and paste mode, while conveniently showing the line numbers only in regular insert mode:

nnoremap <F2> :set nu! paste!<Return>

I'd like to now add a third toggle state (a three-way toggle) which adds this additional state, otherwise identical to the normal insert mode (for writing normal text):

set set linebreak
nnoremap j gj
nnoremap k gk
iab for for

That last one is to counter a for abbreviation in my 'regular' insert mode.

The first thing I tried was to create a VIM function that when called would rotate a variable between three states. Here, I found my first problem. How does one create a variable in VIM that is persistent from call to call?

The second issue I'm running into is the text "insert (special)" on the command line. How does one configure this text?

Thank you.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

The showmode feature is built in: I don't think that you can change its text in anyway. It's supposed to show the mode you are in but you seem to want a new mode that Vim doesn't know about.

The notation for global variables is g:my_variable.

share|improve this answer
Thank you once again Romainl! –  dotancohen Aug 30 '12 at 19:44

Your Answer


