unicode

37 views
Skip to first unread message

Zura Kutchava

unread,
Jan 4, 2012, 5:01:22 PM1/4/12
to vim-mu...@vim.org, v...@vim.org
To:

Dear friends

finding and trying everything that supports unicode in gvim in windows xp or 2003. No fonts, no digraphs, no countless encodings help to display
unicode symbols from 10d0 to 10f0 (georgian)

may be somebody have any idea?

i little programming in c/c++ so if it will be good i can try to help

thanks beforehand

zkutch

mattn

unread,
Jan 4, 2012, 9:05:59 PM1/4/12
to vim_mu...@googlegroups.com, vim-mu...@vim.org, v...@vim.org
Do you mean that "How to write unicode without input method" ?
Then, One of solution is "<c-r>=nr2char(0x10d0)". However nr2char depend on &encoding. So you can use following utility function.

---------------
function! s:nr2byte(nr)
  if a:nr < 0x80
    return nr2char(a:nr)
  elseif a:nr < 0x800
    return nr2char(a:nr/64+192).nr2char(a:nr%64+128)
  elseif a:nr < 0x10000
    return nr2char(a:nr/4096%16+224).nr2char(a:nr/64%64+128).nr2char(a:nr%64+128)
  elseif a:nr < 0x200000
    return nr2char(a:nr/262144%16+240).nr2char(a:nr/4096/16+128).nr2char(a:nr/64%64+128).nr2char(a:nr%64+128)
  elseif a:nr < 0x4000000
    return nr2char(a:nr/16777216%16+248).nr2char(a:nr/262144%16+128).nr2char(a:nr/4096/16+128).nr2char(a:nr/64%64+128).nr2char(a:nr%64+128)
  else
    return nr2char(a:nr/1073741824%16+252).nr2char(a:nr/16777216%16+128).nr2char(a:nr/262144%16+128).nr2char(a:nr/4096/16+128).nr2char(a:nr/64%64+128).nr2char(a:nr%64+128)
  endif
endfunction

function! encutil#nr2enc_char(charcode)
  if &encoding == 'utf-8'
    return nr2char(a:charcode)
  endif
  let char = s:nr2byte(a:charcode)
  if strlen(char) > 1
    let char = strtrans(iconv(char, 'utf-8', &encoding))
  endif
  return char
endfunction
--------------- 

<c-r>=encutil#nr2enc_char(0x10d0)

Alexandru Pănoiu

unread,
Jan 4, 2012, 9:30:48 PM1/4/12
to vim_mu...@googlegroups.com
Use DejaVu fonts, they are free and have Georgian characters (http://dejavu-fonts.org/).

:set guifont=DejaVu_Sans_Mono
:set enc=utf-8

All the best,

AlexP

--
You received this message from the "vim_multibyte" maillist.
For more information, visit http://www.vim.org/maillist.php

Tony Mechelynck

unread,
Jan 7, 2012, 2:42:54 AM1/7/12
to vim_mu...@googlegroups.com, Zura Kutchava, vim-mu...@vim.org, v...@vim.org

About fonts in gvim, see
http://vim.wikia.com/Setting_the_font_in_the_GUI
On Windows, the command
:set gfn=*
allows you to choose a font by a menu. It's been too long since I've
left Windows to remember, but maybe the display on the bottom of that
dialog is actually an input area, where you can paste any text (e.g.
Georgian text) from the clipboard and see how it would be displayed in
that font.

About using Unicode in Vim (in General), see
http://vim.wikia.com/Working_with_Unicode

To input Georgian characters, you can:
- use a keymap (and create your own if there is no satisfactory one), see
:help 'keymap'
:help keymap-file-format

- use digraphs (and create your own if there are no satisfactory ones)
see
:help :digraph

- and if nothing else avails, you can always use the method described under
:help i_CTRL-V_digit


Best regards,
Tony.
--
ARTHUR: Right! Knights! Forward!
ARTHUR leads a charge toward the castle. Various shots of them
battling on,
despite being hit by a variety of farm animals.
"Monty Python and the Holy Grail" PYTHON (MONTY)
PICTURES LTD

Zura Kutchava

unread,
Jan 8, 2012, 5:13:15 AM1/8/12
to vim_mu...@googlegroups.com, antoine.m...@gmail.com, Alexandru Pănoiu, matt...@gmail.com
thanks everybody for comprehensive answers

i find very simply solution

when i install gvim 7.3.386 then i can type Georgian(from 10d0 to 10f0) in input mode without more changes. _gvimrc is same for both.

but when install gvim 7.3.42 Georgian is seen only in digraph method

i dont deeg deeply, maybe experts can see reason easy, i'll be gratefull for explantion


--- On Sat, 1/7/12, Tony Mechelynck <antoine.m...@gmail.com> wrote:

Tony Mechelynck

unread,
Jan 8, 2012, 7:31:16 PM1/8/12
to Zura Kutchava, vim_mu...@googlegroups.com, Alexandru Pănoiu, matt...@gmail.com
On 08/01/12 11:13, Zura Kutchava wrote:
> thanks everybody for comprehensive answers
>
> i find very simply solution
>
> when i install gvim 7.3.386 then i can type Georgian(from 10d0 to 10f0) in input mode without more changes. _gvimrc is same for both.
>
> but when install gvim 7.3.42 Georgian is seen only in digraph method
>
> i dont deeg deeply, maybe experts can see reason easy, i'll be gratefull for explantion

Well, maybe tou'll find something "interesting" between the lines
7.3.042 (excluded) and 7.3.386 (included) in
ftp://ftp.vim.org/pub/vim/patches/7.3/README

Best regards,
Tony.
--
O give me a home,
Where the buffalo roam,
Where the deer and the antelope play,
Where seldom is heard
A discouraging word,
'Cause what can an antelope say?

Kenneth Reid Beesley

unread,
Jan 9, 2012, 1:57:27 PM1/9/12
to vim_mu...@googlegroups.com
> To input Georgian characters, you can:
> - use a keymap (and create your own if there is no satisfactory one), see
> :help 'keymap'
> :help keymap-file-format


zkutch,

RE: gvim, Unicode, Georgian mxedruli

Here's how I have implemented Georgian mxedruli in gvim. Corrections and suggestions
would be welcome.

For displaying Georgian mxedruli, the DejaVu Sans Mono font has the glyphs (and is a good
general Unicode mono font, suitable for gvim). You will have to install this font (or a similar
Unicode mono font) on Windows wherever you install fonts so that they are visible to gvim.

Keymap

I assume here that you want to use a keymap, which allows you to type Roman letters,
and simple sequences (bigraphs, trigraphs, etc.) of Roman letters on your keyboard. These
are intercepted by the keymap and turned into mxedruli characters before being entered
into the buffer. You type an unambiguous Roman _transliteration_ of mxedruli, so the keymap
(below) is titled mxedruli-translit_utf-8.vim. This mxedruli-translit_utf-8.vim file should be
installed in your ~/.vim/keymap/ directory (or the equivalent for Windows).

Key points:
1. You have to tell gvim to use DejaVu Sans Mono (or another Unicode-encoded
mono font that contains the mxedruli glyphs).
2. You want gvim to store/encode text internally in utf-8 (a default encoding of Unicode)
3. You want gvim to save buffers to file in utf-8 and read files in utf-8
4. You want easy ways to activate and de-activate the mxedruli keymap when you type
You do this via commands in your .gvimrc file.


I'm not a Windows user, but something close to the following should work for you.

In your .gvimrc file, add the lines:

if has ("multi_byte") " i.e. compiled for multi_byte, needed for Unicode
if &encoding !~? '^u' " if encoding does not start u or U
if &termencoding=='' " don't clobber keyboard locale
let &termencoding=&encoding
endif
set encoding=utf-8 " how vim should represent text internally
endif
" fileencodings, tried in order when opening an existing file
set fileencodings=ucs-bom,utf-8,iso-8859-1
setglobal bomb
" fileencoding is the encoding vim will use to write files
setglobal fileencoding=utf-8
else
echomsg 'Warning: Multibyte support not compiled in.'
endif

set anti guifont="DejaVu Sans Mono:h14

" input sequences to activate the mxedruli keymap
nmap ,m :setlocal keymap=mxedruli-translit_utf-8<Enter>
imap ,m <Esc>:setlocal keymap=mxedruli-translit_utf-8<Enter>a

" toggle keymaps (to previous and back) N.B. <C-^> works only in Insert mode
" and in command-line mode
nmap ,. i<C-^><Esc>
imap ,. <C-^>
cmap ,. <C-^>

" return to the neutral keymap
nmap ,, :setlocal keymap="neutral"<Enter>
imap ,, <Esc>:setlocal keymap="neutral"<Enter>a

" end of additions to .gvimrc

Put the mxedruli-translit_utf-8.vim file (below) in your ~/.vim/keymap/ directory
(or equivalent for Windows).

" mxedruli-translit_utf-8.vim
"
" Maintainer: Kenneth R. Beesley krbeesley ATT gmail DOTT com
" Created: 2008-09-21
" Last Changed: 2012-01-09

" vim keymap (input method) for entering Georgian mxedruli

" Installation: place this file in ~/.vim/keymap/

" Selection inside gvim
" :setlocal keymap=mxedruli-translit_utf-8
"
" or, in your .gvimrc file, include the commands
" nmap ,m :setlocal keymap=mxedruli-translit_utf-8<Enter>
" imap ,m <Esc>:setlocal keymap=mxedruli-translit_utf-8<Enter>a
"
" nmap ,. i<C-^><Esc>
" imap ,. <C-^>
" cmap ,. <C-^>

" nmap ,, :setlocal keymap="neutral"<Enter>
" imap ,, <Esc>:setlocal keymap="neutral"<Enter>a
"
" so that you can activate the mxedruli input method by typing ,m
" toggle back and forth by typing ,.
" and return to the "neutral" keymap by typing ,,

" **************************************************************

" this short name is for display in the status line
let b:keymap_name="mxedruli-translit"

" change the lCursor color (the color when this keymap is active)
highlight lCursor guifg=NONE guibg=Cyan

loadkeymap

a <Char-0x10D0>
b <Char-0x10D1>
g <Char-0x10D2>
d <Char-0x10D3>
e <Char-0x10D4>
v <Char-0x10D5>
z <Char-0x10D6>
t <Char-0x10D7>
i <Char-0x10D8>
k' <Char-0x10D9>
l <Char-0x10DA>
m <Char-0x10DB>
n <Char-0x10DC>
o <Char-0x10DD>
p' <Char-0x10DE>
Z <Char-0x10DF>
r <Char-0x10E0>
s <Char-0x10E1>
t' <Char-0x10E2>
u <Char-0x10E3>
p <Char-0x10E4>
k <Char-0x10E5>
G <Char-0x10E6>

q' <Char-0x10E7>
q <Char-0x10E7> " no q vs. q' distinction

S <Char-0x10E8>
tS <Char-0x10E9>
ts <Char-0x10EA>
dz <Char-0x10EB>
ts' <Char-0x10EC>
tS' <Char-0x10ED>

x <Char-0x10EE>
X <Char-0x10EE> " x and X the same

dZ <Char-0x10EF>
h <Char-0x10F0>

" literalize with preceding backslash
" (seldom needed)

\p <Char-0x10E4>
\t <Char-0x10D7>
\k <Char-0x10E5>
\d <Char-0x10D3>
\s <Char-0x10E1>
\S <Char-0x10E8>
\z <Char-0x10D6>
\Z <Char-0x10DF>
\' '


" literalize the backslash itself
\\ \

" end of mxedruli-translit_utf-8.vim

With this setup, when you launch gvim, you just need to type

,m

i.e. a comma followed immediately by an m, to activate the
mxedruli keymap. While this mode is active, you just type
a, e, i, o and u to enter the obvious vowels, and (as far as
possible) you type the obvious Roman equivalents for the
consonants. Ejectives are entered with a roman consonant
followed by a single quote: e.g. p', t', k'. See the keymap
above for other mapping details.

See
http://en.wikipedia.org/wiki/Georgian_alphabet
for the Unicode code point values.

You can of course modify the keymap to your taste by changing
the input sequences on the left side, as long as each input sequence is unique.

To toggle between the mxedruli keymap and the previous
keymap, just type ,. (i.e. comma followed immediately by
a period).

To return to the default/normal keymap, just type
,,
i.e. two commas together.


Good luck,

Ken

> --
> You received this message from the "vim_multibyte" maillist.
> For more information, visit http://www.vim.org/maillist.php


******************************
Kenneth R. Beesley, D.Phil.
P.O. Box 540475
North Salt Lake, UT
84054 USA

Zura Kutchava

unread,
Jan 10, 2012, 7:49:40 AM1/10/12
to vim_mu...@googlegroups.com, krbe...@gmail.com
Thanks a lot

i check your keymap and setting and, of course, it works for gvim73-46

i also changed keymap (put in attachment) to coincide it with windows georgian keyboard, for that people who use georgian keyboard in windows. It came from old (befor computers) georgian printing press keyboard. So for 73-46 users everything is ready.

the good side of this keyboard is that it's possible to type one key for one georgian letter. Hope it will be usefull for georgian keyboard users.

let me repeat that most easy is install gvim-7-3-386 and in it directly switch keyboard layots

zkutch

--- On Mon, 1/9/12, Kenneth Reid Beesley <krbe...@gmail.com> wrote:

georgian_windows_unicode.vim
Reply all
Reply to author
Forward
0 new messages