On Wed, 30 Sep 2009 02:50:25 +0900, Hari Krishna Dara <[email protected]>
wrote:
>> Recently I need to copy a key mapping to enhance my plugin. It defines
>> another kind of key mappings which is expanded when multiple keys are
>> simultaneously pressed. These key mappings can coexist with ordinary
>> key mappings even if both {lhs}es conflict with each other, but it's
>> a bit difficult or troublesome to resolve conflicts manually. I want to
>> resolve conflicts automatically, but it's not possible to realize
>> without the way to copy existing key mappings.
>
> I am not clear on your use case. Were you going to backup some maps
> and unmap them to help resolve conflicts? Is the functionality of this
> plugin somehow similar to my execmap plugin
> (http://www.vim.org/scripts/script.php?script_id=598)?
Almost same. For example, there are quite a few users who prefer display line
motions (gj/gk) to logical line motions (j/k), so they put the following in
their vimrc:
noremap j gj
noremap k gk
While I want to :join with an operator. But there is no suitable key sequence
to assign the operator in my environment. So I assign it to a combination of
keys as follows:
Arpeggio noremap oj <Plug>(operator-join)
With the above setting, <Plug>(operator-join) is executed if o and j are
simultaneously pressed, while solely pressed o and j do the same as their
default actions. (Here <Plug>(operator-join) is an operator to :join, and
:Arpeggio is a command provided by my plugin arpeggio.
http://www.vim.org/scripts/script.php?script_id=2425 )
But arpeggio defines key mappings for o and j to check whether the keys are
simultaneously pressed or not. So "noremap j" and "Arpeggio nnoremap oj"
conflict. One of them is overridden depending on the order of them.
There is a way to resolve this conflict. Arpeggio defines
<Plug>(arpeggio-default:{X}) to customize the action for solely pressed {X}.
So this conflict can be resolved with the following:
noremap <Plug>(arpeggio-default:j) gj
But as I define other arpeggio key mappings, the number of conflicts with
ordinary key mappings are increased rapidly. It's a boring work to resolve
these conflicts manually.
If there are functions to copy/list key mappings, these conflicts can be
resolved automatically.
--
To Vim, or not to Vim.
http://whileimautomaton.net/
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---