On Sat, Oct 26, 2013 at 12:50 PM, Bram Moolenaar <[email protected]> wrote:

>
>
> I already said this: It's fine to add so long as it's 100% backwards
> compatible.  That means encoding keys on top of what's already there,
> and falling back to the ordinary key if the key + modifier isn't mapped.
>

I've given this some thought. The backwards compatibility that users
should experience should be as simple as possible.

For example, let's suppose someone has the following in their vimrc.

map <tab> :echo "hello"<cr>

Let me describe how the current behavior works and two possible ways the
future behavior would work.

Currently, pressing <tab> or pressing <c-i> will echo "hello".



*1) The first way this could work in the future*, when vim differentiates
ever key combination, is that pressing <tab> or pressing <c-i> would
continue to echo "hello". However, the user could override the default
<c-i> behavior by adding a new map in which case <c-i> would take on an
all-new behavior:

map <tab> :echo "hello"<cr>
map <c-i> :echo "world"<cr>

<c-i> would no longer echo "hello", it would echo "world". The same would
apply to other aliases.



*2) The second way this could work in the future* is that all possible
keys/combos that can be mapped never act as aliases to another key. If you
make a single mapping

map <tab> :echo "hello."<cr>

then <tab> will echo "hello" but <c-i> will not. In fact, <c-i> will do
nothing at all because it is a new combination available to be mapped that
has never been used before.



Personally, I prefer the second possibility because it's cleaner, but the
first possibility would be more backwards compatible. That being said, if
we went with the second possibility, it'd wouldn't be a huge hassle for
people to rewrite their mappings to use the literal keys instead of
aliases, plus new users will never get confused because literal key
mappings are simply intuitive. Most new users to vim are also new to
terminals, and therefore they (like me) won't know that pressing <tab> is
the same as pressing <c-i>. They'll discover this after having pulled their
hair out over a <c-i> mapping in their vimrc.


> How to detect the modifiers for many terminals in a portable way,
> without requiring installing an obscure library (at least Ubuntu must
> have it), I don't know.


I agree this might be tricky and not fully supported in terminals at
first, but we should at least have this new functionality fully supported
in graphical Vim. As Paul said, it's likely that if vim implements this new
functionality, many terminal developers will incorporate support for the
new key sequences within due time. If at least one terminal emulator
supports it, I'll be extremely happy!



>
> --
> An indication you must be a manager:
> You feel sorry for Dilbert's boss.
>
>  /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net
> \\\
> ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/\\\
> \\\  an exciting new programming language -- http://www.Zimbu.org
>  ///
>  \\\            help me help AIDS victims -- http://ICCF-Holland.org
>  ///
>
> --
> --
> 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
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "vim_dev" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/vim_dev/2bp9UdfZ63M/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Raspunde prin e-mail lui