On Tue, Jul 18, 2006 at 11:49:52AM +0200, Eric Smith wrote: > How do I implement a conditional to test if in insert or normal mode? > > Thanks
If I am doing anything at all complicated, I use a function: :map <F4> :call Foo()<CR> If I want to do something slightly different depending on the mode, I add a flag to the argument list: :nmap <F4> :call Foo('n')<CR> :imap <F4> :call Foo('i')<CR> function! Foo(mode) if a:mode == 'n' " set up for Normal mode elseif a:mode == 'i' " set up for Insert mode else " oops! return endif " lots more stuff endfun HTH --Benji Fisher