On 12/10/09 23:11, Bram Moolenaar wrote:
>
> Michael Henry wrote:
>> I'm proposing that the documentation make a strong statement
>> deprecating the use of :vmap for printable characters (and only
>> printable characters). The statement would need to carefully
>> explain the negative effects of :vmap with printable characters,
>> and contrast this with appropriate use cases for :vmap.
>
> Let's add a note:
>
> *mapmode-x* *mapmode-s*
> Some commands work both in Visual and Select mode, some in only one. Note
> that quite often "Visual" is mentioned where both Visual and Select mode
> apply. |Select-mode-mapping|
> NOTE: Mapping a printable character in Select mode may
> confuse the user. It's better to explicitly use :xmap and
> :smap for printable characters.
This note would help, but I'd like to add more substantial
comments to the help to make it clear what's wrong with using
:vmap, showing an example of the negative effects, and show
the recommended way a plugin author should handle the problem.
I'd like to volunteer to come up with some verbiage and see what
you think of it.
Tony pointed out something I'd not considered:
On 10/12/2009 07:48 PM, Tony Mechelynck wrote:
> I shall add (to Bram's remark above) that the :xmap and :smap commands
> (and also ::xmenu and :smenu) are relatively recent (previously there
> were only :vmap and :vmenu) so it is possible that plugins which existed
> prior to their introduction have not yet been updated.
>
> Where plugins, especially ones not part of the Vim distribution, still
> use :vmap or :vmenu, it would probably be better to wrap any change in
> "if exists(':xmap') == 2" or in "if exists(':xmenu') == 2" to avoid
> unexpected errors in older versions of Vim.
I took up Vim in earnest at Vim 7. Checking :help version7.txt,
I discovered that :xmap and :smap are new with Vim 7.
So I'd make sure the new documentation mentioned the
compatibility issues. What would the recommended method for
retaining pre-Vim 7 compatibility? One idea would be to suggest
the plugin author define his own Xmap something like this:
if exists(':xmap') == 2
command -bang -nargs=* Xmap xmap<bang> <args>
else
command -bang -nargs=* Xmap vmap<bang> <args>
endif
Or, if there's a different recommendation for plugin authors,
I'd be happy to include it in map.txt. For example, it might
not be good to define a global :command like this, but without
it I'm not sure how to avoid having the plugin author duplicate
each of his mappings.
Looking through the map.txt help file again, I can see where the
pre-Vim 7 flavor is still there. As part of the proposed new
help text, I'd suggest the following:
- Restructure section 1.3 MAPPING AND MODES to treat Visual and
Select modes separately.
- Update this comment:
Note that quite often "Visual" is mentioned where both Visual
and Select mode apply. |Select-mode-mapping|
I presume this comment is just an acknowledgment that map.txt
hasn't been updated to use the term "Visual" more precisely
now that :xmap and :smap treat Visual and Select modes
differently. I'd ensure that throughout map.txt, Visual is
used exclusively to mean Visual mode, and where comments would
apply to both Visual and Select modes, I'd mention that
explicitly.
- Add a suggestion to define :Xmap for plugin authors, or
whatever other compatibility work-around is considered to be
best practice.
There would probably be other cleanup related to this change, if
there is interest in having me take a crack at a re-write.
Also, how would I best provide new verbiage? Should I post to
the list and attach the new map.txt file, with or without a diff
between the old and new files? Should I start a new Wiki page
with the suggested verbiage (and if so, where)? Guidance on the
method would be appreciated.
Bram continued:
> Perhaps you can go over all existing plugins that use :vmap and ask them
> to change to :xmap where needed.
I'd been planning to email the authors of plugins which I use,
once there is agreement on the pre-Vim 7 compatibility question
and we have something that plugin authors can read to understand
the issue. I'm not sure how to tackle the other nearly three
thousand plugins :-) Perhaps if we had a Wiki page explaining
the issue and sent a general call via the mailing list, the
active plugin developers would take care of their plugins, and
users would know enough about the issue to request fixes for the
other plugins.
Thanks,
Michael Henry
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---