On 2008-11-10, Pento <[EMAIL PROTECTED]> wrote:
> Hello, everybody!
> 
> Now  for map shortcut for example for :ls in 3 modes I need to add 3
> lines to my ~/.vimrc:
> 
> " F5 - show buffers
> nmap <F5> :ls<cr>:b
> imap <F5> <esc>:ls<cr>:b
> vmap <F5> <esc>:ls<cr>:b
> 
> How can I do this in one line?

Here's one way:

   exe 'nmap <F5> :ls<cr>:b' | exe 'imap <F5> <esc>:ls<cr>:b' | exe 'vmap <F5> 
<esc>:ls<cr>:b'

Or, if you want to avoid repeating the ":ls<cr>:b" portion each 
time:

   exe 'nmap <F5> :ls<cr>:b' | exe 'imap <F5> <esc><F5>' | exe 'vmap <F5> 
<esc><F5>'

See

   :help :|
   :help :execute

Regards,
Gary


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to