Sunday, April 11, 2010

Re: Vim accented characters in text based console

On 11/04/10 11:57, Luis P. Mendes wrote:
> Hi Tony,
>
> thank you very much for your help and time trying to help me.
>
> Here are the results I got from vim.
>
> In X, vim (not gvim which I don't use) returns:

I thought you had used gvim before, with no error.

> encoding=latin1
> termencoding=
>
> lang: Current language:
> "LC_CTYPE=pt_PT;
------------^
This one specifies (system-wise) what "national settings" to use for
character sets; IIUC when Vim sees this at startup it sets 'encoding' to
latin1. ('termencoding' empty means "use 'encoding'" and is the default.)

> LC_NUMERIC=C;
> LC_TIME=pt_PT;
> LC_COLLATE=pt_PT;
> LC_MONETARY=pt_PT;
> LC_MESSAGES=pt_
> PT;LC_PAPER=pt_PT;
> LC_NAME=pt_PT;
> LC_ADDRESS=pt_PT;
> LC_TELEPHONE=pt_PT;
> LC_MEASUREMENT=pt_PT;
> LC_IDENTIFICATION=pt_PT"
>
> keymap=
> iminsert=0
>
> Ctrl-V followed by 233 é
>
> Ctrl-K then e then an apostrophe é
> and if I key: Ctrl-K then e then the accent mark followed by a space I
> get a é

Hm. Normally the accent mark followed by e (without the Ctrl-K prefix)
ought to give é then. If it doesn't, there may be something
misconfigured, either in X (for Vim in xterm, konsole, gnome-terminal
etc.) or in the kernel's keymap setting (for the Linux console). I don't
know Slackware (my Linux system is openSUSE, which is loosely based on
RedHat) so I wouldn't venture to tell you where to look for that.

>
>
> In text console the results are the same.
>
> Another information:
> I tried pico text editor in X, and am able to use accented characters.
> In text mode console, I can't. The symptoms are identical to vim's.
> To use accented characters, I just have to press the accent first (ex.
> ') and the base character I want accented (like e).
>
> So, I guess I have to check my Slackware system configuration instead of vim's.
>
>
> Luis

Well, in the meantime you can use digraphs, see
:help digraph.txt
:help digraphs-default

and in particular
Ctrl-K e apostrophe gives é (e-acute)
Ctrl-K a exclamation-mark gives à (a-grave)
Ctrl-K o question-mark gives õ (o-tilde)
Ctrl-K c comma gives ç (c-cedilla)
etc. Of course any precomposed character present on your keyboard should
normally also be usable (my Belgian keyboard has a lot of these, see
http://users.skynet.be/antoine.mechelynck/other/keybbe.htm )

Or you can use
:setlocal keymap=accents

and use the dead-key prefixes defined in that keymap: apostrophe-e means
e-acute, backtick-a means a-grave, tilde-o (with a spacing tilde) means
o-tilde (with the tilde above the o), etc.: see
:view $VIMRUNTIME/keymap/accents.vim
:help 'keymap'
:help mbyte-keymap

Of course, if you want to use an apostrophe followed by a vowel then,
you will have to either switch the keymap temporarily off beforehand
(see below), or else "break" the mapping, either by waiting for a
timeout (by default one second, see :help 'timeoutlen', but 'timeout'
[q.v.] must be on [not the default] for that) after the apostrophe, or
by inserting some "do-nothing" key-sequence after the apostrophe, for
instance <Left><Right>.
To toggle between the keymap and your "normal" Portuguese keyboard (for
Insert-Replace and Command-line modes, and the operands of Normal
commands r f F t T ), use:
- in Insert and Command-line modes: Ctrl-^
- in Normal mode: :let &imi = !&imi
see
:help i_CTRL-^
:help c_CTRL-^
:help 'iminsert'
:help 'imsearch'
I recommend to set 'imsearch' to -1 (not the default) in your vimrc, so
/ and ? search commands use the same keyboard (your usual or the keymap)
as in Insert mode at any particular time.


Best regards,
Tony.
--
"In defeat, unbeatable; in victory, unbearable."
-- Winston Curchill, of Montgomery

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