Sunday, May 2, 2010

Re: Which is the best way of doing some mapping reuse?

On May 2, 10:45 pm, Raúl Núñez de Arenas Coronado <raul...@gmail.com>
wrote:
> First one is copying and pasting the map...

How about a level of indirection using :exe :

let mapped = "<silent><buffer> <LocalLeader>KEY "
let mapping = "m'gg\"+yG\""
exe 'nnoremap ' . mapped . mapping
exe 'inoremap ' . mapped . '<esc>' . mapping . 'i'

I don't know how usable this is, I just checked :map output to see
that the mappings had been made.

You could extend this to a general function, f. ex.
call Makemaps(mapped, mapping, modes)

Regards, John

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment