keymap problem, mapping '2' and '6' to Char

1 view
Skip to first unread message

Kenneth Beesley

unread,
Oct 4, 2007, 5:47:58 PM10/4/07
to vim_mu...@googlegroups.com

I've got a vim keymap problem when trying to map digits to Char

I've got a keymap with mappings like the following, and they work
perfectly:

u <Char-0x1042D>
I <Char-0x1042E>
E <Char-0x1042F>
U <Char-0x10433>
aJ <Char-0x10434>
aY <Char-0x10434>
a <Char-0x10430>
ae <Char-0x10430>

But if I have, in the same keymap, a digit on the left-hand-side, e.g.

6 <Char-0x10431>
2 <Char-0x10432>

then it does NOT work. Rather the 2 or 6 is rendered on the screen
literally,
without mapping to the Unicode (Deseret Alphabet) code point.

And the following doesn't work any better. There's still no mapping.
<Char-0x36> <Char-0x10432>


Bug? or am I doing something wrong?

Thanks,

Ken

Nico Weber

unread,
Oct 5, 2007, 6:01:59 AM10/5/07
to vim_mu...@googlegroups.com
> I've got a vim keymap problem when trying to map digits to Char
>
> But if I have, in the same keymap, a digit on the left-hand-side, e.g.
>
> 6 <Char-0x10431>
> 2 <Char-0x10432>
>
> then it does NOT work. Rather the 2 or 6 is rendered on the screen
> literally,
> without mapping to the Unicode (Deseret Alphabet) code point.
>
> Bug? or am I doing something wrong?

Probably a bug. Which version are you using? It works ok with the
latest version of MacVim and the terminal version that's preinstalled
(both OS X).

Nico

Kenneth Beesley

unread,
Oct 5, 2007, 1:25:26 PM10/5/07
to vim_mu...@googlegroups.com
Nico,

Background: I'm running OS X version 10.4.10

I just installed the latest MacVim and tried it with a version of
DejaVuSansMono.ttf, augmented
with (monowidth) glyphs, the same width as the original
DejaVuSansMono.ttf glyphs,
for the Deseret Alphabet block (U+10400). It doesn't seem to work
for me. When I select my
Deseret Alphabet keymap and try to type Deseret Alphabet, I see
pseudo glyphs in boxes
rendered on the screen.

Yesterday I downloaded, via svn, 7.1.135 and got it compiled and
running on OS X.
I also got 7.1.135 running on Red Hat Linux. These seem to work
better, for my Deseret
Alphabet editing, than MacVim, using the augmented version of
DejaVuSansMono.ttf.
Not perfect yet, but better.

I see the keymap problem (involving digits on the left-hand-side of
mappings) on both
platforms with 7.1.135, and with MacVim. I'm confused to see your
report that it works
for you in the latest version of MacVim.

When using MacVim, it complained about setting 'macatsui' in
my .gvimrc file. It also complained
about setting 'nomacatsui'. So I took out both for the tests.
Would you consider sharing your
.gvimrc file--perhaps there's something in there that makes it work
better with MacVim.

Ken

Tony Mechelynck

unread,
Oct 5, 2007, 2:58:30 PM10/5/07
to vim_mu...@googlegroups.com

The 'macatsui' option exists only in Mac GUI versions and "may become obsolete
in the future". Therefore, you should check for it before using it, e.g.:

if exists('+macatsui')
set nomacatsui
endif

(When the option is present, it defaults to TRUE according to ":help 'macatsui'".)

Best regards,
Tony.
--
Slowly and surely the unix crept up on the Nintendo user ...

Nico Weber

unread,
Oct 8, 2007, 3:14:05 PM10/8/07
to vim mac, vim_mu...@googlegroups.com
Forwarding this as well. How exactly are you setting up your keymaps?
I tried `:imap 2 a`, after that hitting 2 inserts an a in insert
mode. Which keyboard layout are you using? It worked fine for me with
German and Canadian (like US, but other flag ;-) ) layouts.

Nico

Begin forwarded message:

As Tony said, MacVim doesn't have this option.

Kenneth Beesley

unread,
Oct 8, 2007, 4:55:54 PM10/8/07
to vim_mu...@googlegroups.com, vim mac

On 8 Oct 2007, at 13:14, Nico Weber wrote:

>
> Forwarding this as well. How exactly are you setting up your keymaps?
> I tried `:imap 2 a`, after that hitting 2 inserts an a in insert
> mode. Which keyboard layout are you using?


Nico,

Thanks for your help.

I'm not using the :imap command. I'm using vim keymap files, stored
in the standard
place: ~/.vim/keymap/

I define my own keymap files, and the one in question right now is
called deseret-sampa_utf-8.vim
I'll gladly send you (or anyone else) a copy, but I'm reluctant to
attach such a file for
a message going to a distribution list

After the usual header boilerplate, deseret-sampa_utf-8.vim contains
lines like the following:


o <Char-0x1042C>
oW <Char-0x1042C>

u <Char-0x1042D>
I <Char-0x1042E>
E <Char-0x1042F>

a <Char-0x10430>
ae <Char-0x10430>

6 <Char-0x10431>
2 <Char-0x10432>

U <Char-0x10433>

aJ <Char-0x10434>
aY <Char-0x10434>

aW <Char-0x10435>
w <Char-0x10436>

On the left-hand side are ASCII-range input sequences inspired by the
SAMPA
transliteration of the International Phonetic Alphabet. On the right-
hand side are
the code point values of the Deseret Alphabet characters (block
starting U+10400)
with the corresponding phoneme value.

I select this keymap in vim in the usual way

:set keymap=deseret_sampa_utf-8.vim

and everything works as expected except for the lines having '6' and
'2' on the left-hand side.
When I type 2, for example, instead of a U+10432 character being
entered and displayed, as
expected, I see just '2' on the screen.

Ken

Kenneth Beesley

unread,
Oct 12, 2007, 3:29:43 PM10/12/07
to vim_mu...@googlegroups.com

MEA CULPA, MEA MAXIMA CULPA. I found the error in my keymap file,
which was mapping

2 <Char-0x10432>

and later, in the same keymap file, I had

\2 2

with the _intent_ that the latter would allow me to enter a literal 2
by typing
backslash 2. But the single backslash in \2 simply literalizes the 2 in
the keymap (unnecessarily), with the effect of redefining 2. The
correct
entry

\\2 2

allows me to enter a literal 2 by typing backslash 2 in INSERT mode,
fixing the problem.

Thanks to Nico and all others who responded.

Ken

On 8 Oct 2007, at 13:14, Nico Weber wrote:

Tony Mechelynck

unread,
Oct 12, 2007, 4:04:54 PM10/12/07
to vim_mu...@googlegroups.com
Kenneth Beesley wrote:
>
> MEA CULPA, MEA MAXIMA CULPA. I found the error in my keymap file,
> which was mapping
>
> 2 <Char-0x10432>
>
> and later, in the same keymap file, I had
>
> \2 2
>
> with the _intent_ that the latter would allow me to enter a literal 2
> by typing
> backslash 2. But the single backslash in \2 simply literalizes the 2 in
> the keymap (unnecessarily), with the effect of redefining 2. The
> correct
> entry
>
> \\2 2
>
> allows me to enter a literal 2 by typing backslash 2 in INSERT mode,
> fixing the problem.
>
> Thanks to Nico and all others who responded.
>
> Ken

Since the lines after :loadkeymap are mappings (albeit in a special format),
you could also use

<Bslash>2 2 literal digit two


Best regards,
Tony.
--
Kill a commie for Christ!

Reply all
Reply to author
Forward
0 new messages