Hari Krishna Dara schrieb:
> I went ahead and did a POC for this feature and am attaching the
> patch. This adds a new set of commands such as :dupmap (for "duplicate
> mapping") and it seems to work nicely for a few simple cases that I
> tried.
> The general usage of :dupmap is same as :map, and it behaves identical
> to :map when {rhs} is missing. But with both {lhs} and {rhs}, it
> copies the existing {rhs} value of the specified {lhs} into the
> specified {rhs} (probably better referred to as {newlhs}).
>
> Here is a list of all the new commands:
>
> :dupmap {lhs} {rhs} |mapmode-nvo| *:dup*
> *:dupmap*
> :ndup[map] {lhs} {rhs} |mapmode-n| *:ndup*
> *:nupmap*
> :vdup[map] {lhs} {rhs} |mapmode-v| *:vdup*
> *:vupmap*
> :xdup[map] {lhs} {rhs} |mapmode-x| *:xdup*
> *:xupmap*
> :sdup[map] {lhs} {rhs} |mapmode-s| *:snor*
> *:supmap*
> :odup[map] {lhs} {rhs} |mapmode-o| *:odup*
> *:oupmap*
> :dup[map]! {lhs} {rhs} |mapmode-ic| *:dup!*
> *:dupmap!*
> :idup[map] {lhs} {rhs} |mapmode-i| *:idup*
> *:iupmap*
> :ldup[map] {lhs} {rhs} |mapmode-l| *:ldup*
> *:lupmap*
> :cdup[map] {lhs} {rhs} |mapmode-c| *:cdup*
> *:cupmap*
>
> I chose "dup" as the prefix instead of "copy" as suffix (like in
> :mapcopy) to imitate the existing scheme (like :unmap and :noremap),
> but couldn't call it "copymap" because that would conflict with :cmap
> (unless the code is changed further). We can discuss if someone can up
> with a better naming scheme that doesn't conflict with the existing
> ones.
>
> The documentation is not complete, the changes were intended to mainly
> list the commands. Please give it a try and let me know what you
> think.
Thanks for the build, here are a few things I tried with it:
"|This is a line of command output in the echo area.
map j gj
dupmap j <Plug>mem_j
dupmap j <Plug>mem_j
dupmap j <Plug>mem_j
map <Plug>mem_j
"| <Plug>mem_j gj
"| <Plug>mem_j gj
"| <Plug>mem_j gj
"
" Expected: one line of output
unmap <Plug>mem_j
map <Plug>mem_j
"|No mapping found
"
" Ok
ndupmap j <Plug>mem_j
map <Plug>mem_j
"| <Plug>mem_j gj
"
" Expected: <Plug>mem_j only mapped for Normal mode:
"|n <Plug>mem_j gj
--
Andy
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---