Michael Henry wrote:
> >> I'd like to advocate the deprecation of the use of :vmap
> >> command [...] This leads to unintended interference with
> >> Select mode's defined behavior, which is especially
> >> noticeable with "snippets" plugins (such as UltiSnips) that
> >> use select mode extensively.
>
> > Did you read :help Select-mode-mapping ?
> > When a :vmap is used in Select mode Vim temporarily switches
> > to Visual mode. Quite often this works as expected.
>
> Yes, I read that section of the help. For those cases where a
> :vmap is appropriate, Vim's switching from Select mode to Visual
> mode does indeed ensure things work as expected, such that a
> single right-hand side works for both Visual and Select modes.
> I think it's OK to have Select-mode mappings for non-printable
> characters, in which case :vmap could be appropriate (such as
> for mapping CTRL-C to copy to the clipboard).
>
> However, I'm advocating that :vmap should not be used to map
> printable characters, as it interferes with the user's
> fundamental expectations of Select-mode behavior. Select mode
> and Visual mode are different and have different purposes, so
> it's reasonable that they might not always have the same
> mappings.
>
> For example, the popular matchit plugin uses :vnoremap as
> follows:
>
> vnoremap <silent> % :<C-U>call <SID>Match_wrapper('',1,'v') <CR>m'gv``
>
> This has the undesirable effect of creating a Select-mode
> mapping for the "%" character, which breaks the user's
> expectation that pressing "%" should delete the selection and
> insert a "%" character.
>
> For plugins like UltiSnips, the user is prompted with some
> default text highlighted in Select mode. If the user presses
> <Tab>, the text is kept and the cursor jumps to the next
> "tabstop"; to override the default text, the user simply types
> the new text. This works well unless printable characters are
> mapped in Select mode, in which case the user can end up quite
> surprised (for example, by pressing "%" and finding that the
> cursor has jumped unexpectedly due to the matchit plugin's
> Select-mode mapping).
>
> 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.
OK, now I get your remark. I first thought you were complaining that
the mapping didn't work. The problem actually is that the mapping does
work, which is unexpected in Select mode.
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.
Perhaps you can go over all existing plugins that use :vmap and ask them
to change to :xmap where needed.
--
I still remember when I gave up Smoking, Drinking and Sex. It was the
most *horrifying* hour of my life!
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---