> On Fri, Jul 30, 2010 at 8:37 PM, Tony Mechelynck
> <antoine.mechelynck@gmail.com> wrote:
>> On 31/07/10 00:12, Jakson A. Aquino wrote:
>>>
>>> Hi,
>>>
>>> I maintain a filetype plugin to R and the user can change the default
>>> key bindings by putting in the vimrc commands like:
>>>
>>> map<F2> <Plug>RStart
>>>
>>> How can I know in the ftplugin/r.vim what key is bound to
>>> <Plug>RStart? The plugin adds a menu to gui versions of Vim and I
>>> would like to tell in the menu all the key bindings, even the
>>> customized ones.
>>>
>>> Thanks,
>>>
>>> Jakson Aquino
>>>
>>> Note: the plugin is here:
>>> http://www.vim.org/scripts/script.php?script_id=2628
>>>
>>
>> It is possible to get a list of all mappings i.e. all user-defined key
>> bindings, see the thread "Writing :map and :map! to text file or something"
>> started 2010-07-26 09:42 -0700 by someone named "Gary".
>>
>> For default bindings it's harder: you would have to compile a list from the
>> various lists at ":help index.txt", write that statically that into your
>> script (and update it whenever that helpfile changes), and, at runtime,
>> *remove* from the list the keybindings which also have a user-defined
>> mapping in the same mode.
>
> Thanks for answering! This was rather a wish than an important thing
> to my plugin. I think it's overly complex to write the output of :map
> to a file and then search the file for all<Plug>Something that my
> plugin has just to know if there are a few custom key bindings. The
> goal was to help users of GVim to remember the key binds by looking at
> the menu, but I will assume that users who customize key bindings are
> advanced enough to either remember them or do ':map' if any was
> forgotten. i have already put in the plugin's documentation:
>
> Custom key bindings are not shown in Vim's menu, but you can
> type :map to see the list of current mappings.
>
> Best regards,
>
> Jakson Aquino
>
You can easily know _if_ there is a map to <Plug>something:
if hasmapto("\<Plug>",'nvoilc') || hasmapto("\<Plug>",'nvoilc',1)
echo 'there is a mapping or abbrev to ''<Plug>something'''
endif
see :help hasmapto()
Similarly, to know if some particular {lhs} (let's say <F2> has ben used,
:map <F2>
and/or
:map! <F2>
will show you any mappings beginning with <F2>; you can capture the
output even if using :silent, see :help :redir
Best regards,
Tony.
--
Electricity is actually made up of extremely tiny particles,
called electrons, that you cannot see with the naked eye unless you
have been drinking. Electrons travel at the speed of light, which in
most American homes is 110 volts per hour. This is very fast. In the
time it has taken you to read this sentence so far, an electron could
have traveled all the way from San Francisco to Hackensack, New Jersey,
although God alone knows why it would want to.
The five main kinds of electricity are alternating current,
direct current, lightning, static, and European. Most American homes
have alternating current, which means that the electricity goes in one
direction for a while, then goes in the other direction. This prevents
harmful electron buildup in the wires.
-- Dave Barry, "The Taming of the Screw"
--
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