For backward compatibility reasons, existing <>-notation should be
considered ambiguous, but we should come up with an extension of this
notation to be considered specific. Perhaps just adding an extra
character after the opening '<'--for instance <!Enter> could mean
Enter, specifically. When interpreting keypresses, specific keypresses
would trigger specific mappings, or ambiguous mappings if no
corresponding specific one exists; ambiguous keypresses would never
trigger a specific mapping. This means you could map <Enter> and it
would work in dumb terminals and the GUI, and existing plugins would
keep working in both, too, including when you actually press Ctrl-M.
However, in the GUI/smart terminal, you could override that
default/ambiguous map, by mapping <!C-M> which would take precedence,
but only be active when we are sure Ctrl-M was pressed and not Enter.
Do others think this approach would work?

Possibly better: the LHS of a mapping if using <>-notation could map it
both specifically and ambiguously, and when used for stuffing keys into
the buffer (including RHS of mappings), <>-notation could always be
specific. This would mean if you mapped both <C-M> and <Enter>, each
specific key would trigger the appropriate mapping, but ambiguous keys
would still trigger whichever mapping was defined last. So old stuff
would continue to work as expected, but new stuff would work somewhat as
expected, too. The <!Whatever> notation, or perhaps some mapping
modifier like <specific> could be used to indicate that only the
specific LHS should be mapped, not ambiguous, giving a way of avoiding
accidentally affecting <Enter> when mapping <C-M>.

Ben.



--
You received this message from the "vim_dev" 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

Raspunde prin e-mail lui