A.J.Mechelynck wrote:
Thanks for this detailed description. This may mean that on your
terminal, meta-CR is also the start of the key sequence used to
represent some other key. Try the following:
vim -u NONE -N
:set timeout timeoutlen=3000 ttimeoutlen=250
:imap <M-CR> Insert-Meta-CR
Then i or a to start Insert mode, followed by Alt-Enter. Wait at least
one-quarter of a second. Does something get inserted?
1. mac, console-mode Vim: Pressing option-Enter results in the
equivalent of Escape followed by CR (goes to normal mode, then moves to
the next line).
2. mac, GUI Vim: option-CR results in plain CR.
3. Windows, GUI Vim: alt-CR results in plain CR.
4. Ubuntu Linux, console-mode Vim: alt-CR results in Escape, CR.
5. Ubuntu Linux, GUI Vim: alt-CR does nothing at first (waited at least
6 seconds); the next arbitrary keypress inserts A-with-circumflex
regardless of the keypress.
Another experiment (after the above): hit Esc to go back to Normal mode,
then
:redir @"
:map
:redir END
p
Your mapping should get inserted into the current [No Name] buffer. Move
the cursor to the character (black box or anything) representing the
{lhs} of the mapping, then hit
ga
What does Vim reply on the bottom line? (If the {lhs} is represented by
more than one character, repeat it for each of them.)
What is 'encoding' set to? If it is set to some Unicode encoding (such
as utf-8) repeat with g8 instead of ga
(Note: I had to replace the :map command with :imap to get the
insert-mode mappings to show - not sure why.)
1. mac, console-mode Vim: the six characters <M-CR> were inserted into
the buffer (not a single UNICODE character). The line looked like this:
i <M-CR> Insert-Meta-CR
encoding=latin1
2. mac, GUI-mode: same as mac, console-mode. The six characters <M-CR>
were inserted.
encoding=latin1
3. Windows, GUI Vim: The line looked like this:
i {black-box} Insert-Meta-CR
g8 on the black-box character returns 8d. ga shows the following:
<{black-box}> <~M> <M-^M> 141, Hex 8d, Octal 215
encoding=latin1
4. Ubuntu Linux, console-mode Vim: The line looked like this:
i <8d> Insert-Meta-CR
g8 on the single-character-wide <8d> showed "c2 8d". ga showed this line:
<<8d>> 141, Hex 008d, Octal 215
encoding=utf-8
5. Ubuntu Linux, GUI Vim: the results were identical to console-mode Vim
on Ubuntu (including the encoding setting).
So my results on Ubuntu match Tony's results on openSUSE. The results
are similar on Windows and mac.
Michael Henry