sc, I had about 8 such mappings in my ~/.vimrc.

On 11 нояб, 23:29, sc <[EMAIL PROTECTED]> wrote:
> On Tuesday 11 November 2008 2:09 pm, Pento wrote:
>
>
>
>
>
> > I wrote it! :)
>
> > function SMap(key, action, ...)
> >     let modes = " vi"
> >     if (a:0 > 0)
> >         let modes = a:{1}
> >     endif
> >     if (match(modes, '\Ii') != -1)
> >         execute 'imap ' . a:key . ' <Esc>' . a:action
> >     endif
> >     if (match(modes, '\Nn') != -1)
> >         execute 'nmap ' . a:key . ' <Esc>' . a:action
> >     endif
> >     if (match(modes, ' ') != -1)
> >         execute 'map ' . a:key . ' <Esc>' . a:action
> >     endif
> >     if (match(modes, '\Vv') != -1)
> >         execute 'vmap ' . a:key . ' <Esc>' . a:action
> >     endif
> > endfunction
>
> > call SMap("<F3>", ":ls<cr>")
>
> but Pento:  you've written 18 lines of function to save about 4 lines in 
> .vimrc --
> seems like a net loss to me
>
> sc
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to