On 19/01/10 20:40, Tuetschek wrote:
Hi,
I am using gVim 7.2 under Windows 7 and I have customized my En-Us
keyboard using the MS Keyboard Layout Creator, so that it contains
not only English characters, but also Czech ones and others (e.g.
Latin long
vocals), which have diacritical marks. It works perfectly well in all
programs but gVim (even Vim console version and Vim console Cygwin
version work correctly).
The problem is that some of the diacritical marks get just stripped
away, e.g. I type "ř" and get just "r". I noticed this happens only
with characters outside of the Latin-1 (or CP1252?) charset (e.g. I
can type "ä" all right), but it doesn't depend on the encoding, file
encoding, terminal encoding or language setting in gVim.
Could anyone help me how to solve or at least understand the problem?
Thanks,
Tuetschek
It can be an OS configuration problem, a Vim configuration problem, or
(especially in console mode) a misunderstanding between the OS and Vim,
as follows:
OS configuration problems
-------------------------
The keyboard can only generate keys which are in your system locale, as
known in Unix parlance as $LC_CTYPE, and, at Vim startup and before
running any scripts (including not only your own vimrc but possibly also
a "system vimrc" of which not every user is aware), as 'encoding' and
possibly v:ctype
Vim configuration problems
--------------------------
* Vim can only accept into memory characters which exist in the charset
defined by the present value of 'encoding'
* Vim can only display glyphs which are in your present font. In console
mode this means the console font (which is out of Vim's control), in GUI
mode it is your present 'guifont', see
http://vim.wikia.com/wiki/Setting_the_font_in_the_GUI
* Vim can only write to a disk file characters which exist in the file's
'fileencoding'
* When reading an existing file, Vim tries to determine the file's
'fileencoding' (singular) with the help of the global option
'fileencodings' (plural). You can bypass this heuristic if you know the
"right" value, see :help ++enc
* When creating a new file, Vim sets its 'fileencoding' to the option's
global value (again, unless you override it, e.g. with ++enc). An empty
'fileencoding' (the default) means: use 'encoding'.
Misunderstandings between the OS and Vim
----------------------------------------
Vim believes that the characters sent by the keyboard (and, in console
mode, those accepted by the display) are in the charset defined by
'termencoding'. The default value of 'termencoding' is (except in GUI
mode in gvim with GTK2 GUI) the empty string, which means: use
'encoding' (IIUC in GUI mode on Win32 gvim always gets keyboard input in
Unicode regardless of 'termencoding'). This empty string is OK at
startup because the default value of 'encoding' is your locale's ctype
charset, but it is probably not OK if you have changed 'encoding', for
instance in order to edit Unicode. In that case I recommend to set
'termencoding' (if it was empty) to the "old" value of 'encoding' before
you set a "new" one. (This won't harm in the cases where Vim disregards
the value, and it is essential when it doesn't.)
To check the "actual" value of a character which may be displayed
differently (e.g. because the console cannot display the actual value,
or because Vim "thinks" that it can't) put the Normal-mode cursor on the
character and type ga (then look at bottom left of the Vim screen).
Inputting characters not in your OS locale
------------------------------------------
Vim can accept into memory any character present in 'encoding', even
those not accepted by your OS locale. There are several ways to do it:
- Keymaps (but you say you don't want them)
- Character value in hex, or, for single-byte characters, also in
decimal or octal, see :help i_CTRL-V_digit
- Digraphs: see :help digraph.txt and in particular :help
digraphs-default. IMHO these are best for sporadic Latin accented
characters not on your keyboard, and to a lesser degree even for
sporadic non-Latin characters for which a digraph exists. (By sporadic I
mean: just a few at a time, not long sentences of them.)
For details, see http://vim.wikia.com/wiki/Working_with_Unicode as well
as the help topics mentioned there.
Best regards,
Tony.
--
Information Center, n.:
A room staffed by professional computer people whose job it is
to tell you why you cannot have the information you require.
--
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
To unsubscribe from this group, send email to vim_use+unsubscribegooglegroups.com or
reply to this email with the words "REMOVE ME" as the subject.