Monday, August 15, 2011

Re: why "imap ;áo ção" doesn't work? # i.e., imap ;<255>o <231><277>o

On 14/08/11 21:04, Leonardo Barbosa wrote:
>
> Hello everyone,
>
> I'm trying to abbreviate or imap latin caracteres. At first, i tried that:
> imap ;áo ção # imap ;<255>o <231><277>o
> I didn't work.
>
> After doing some searching, I in vain did that
> imap ;áo <C-v>231<C-v>227o # imap ;<255>o <231><277>o
>
> This does not solve too.
> imap ;<C-v>255o <C-v>231<C-v>227o # imap ;<255>o <231><277>o
>
> Does anyone know that I am doing wrong?
>
> Thanks in advance
>
> Leo

In Latin1, a-acute is 225, not 255; a-tilde is 227, not 277; other than
that:

- as Ben said, Vim comments start with a double-quote, not a # mark, and
shouldn't be put after a mapping with whitespace betwwen
- again as Ben said, if the 'fileencoding' of your vimrc is different
from the 'encoding' used by Vim, it should have a :scriptencoding
statement near the top, see :help :scriptencoding
- to represent characters in a mapping by their decimal value, use
<Char-nnn> notation, see :help <Char>

So either of the following ought to work, assuming that (if needed) the
appropriate :scriptencoding statement is present earlier (maybe much
earlier):

" ;áo to ção
imap ;<Char-225>o <Char-231><Char-227>o

or even just
imap ;áo ção

but if you absolutely want the comment on the same line you should use
the following trick, see :help :exe-comment

exe "imap ;áo ção" |" á=225 ã=227 ç=231

If you have a Portuguese keyboard you might be able to type it all at
the keyboard. Otherwise you can use |digraphs| or the |i_CTRL-V_digit|
method:

To get type or
á ^Ka' ^V225
ç ^Kc, ^V231
ã ^Ka? ^V227

where ^K and ^V mean "hit Ctrl-K" and "hit Ctrl-V" respectively (and if
your Ctrl-V has been remapped to the paste operation, you should use
Ctrl-Q instead).


Best regards,
Tony.
--
Harry is heavily into camping, and every year in the late fall, he
makes us all go to Assateague, which is an island on the Atlantic Ocean
famous for its wild horses. I realize that the concept of wild horses
probably stirs romantic notions in many of you, but this is because you
have never met any wild horses in person. In person, they are like
enormous hooved rats. They amble up to your camp site, and their
attitude is: "We're wild horses. We're going to eat your food, knock
down your tent and poop on your shoes. We're protected by federal law,
just like Richard Nixon."
-- Dave Barry, "Tenting Grandpa Bob"

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

No comments: