an independent Chinese IME is available

classic Classic list List threaded Threaded
70 messages Options
1234
Reply | Threaded
Open this post in threaded view
|

Re: an independent Chinese IME is available

panshizhu

anhnmncb 写道:
>> On Tue, 06 Jan 2009 13:06:25 +0800, Sean wrote:
>>
>> Feedback is always welcome.
>
> 1. Maybe need to define an autocmd so that
> when leave from insert mode, then disable ChineseIME?
>
> 2. Why not name your script to "vim" i.e. Vim Input Method for Chinese? :)
>
The name ChineseIM.vim contains an vim already.

But for the name, I think a Capitalized filename creates unnecessary
inconveniences when edited in command line. Especially for
case-sensitive file systems.

Since vim is designed for cross-platform I think it might be better to
use only lowercase filename, which works well in all platforms. For
example: inputmethod.vim would be a lot better since this can be used to
input much more than just Chinese character.


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

Reply | Threaded
Open this post in threaded view
|

Re: an independent Chinese IME is available

Tony Mechelynck

On 06/01/09 07:43, pansz wrote:

> anhnmncb 写道:
>>> On Tue, 06 Jan 2009 13:06:25 +0800, Sean wrote:
>>>
>>> Feedback is always welcome.
>> 1. Maybe need to define an autocmd so that
>> when leave from insert mode, then disable ChineseIME?
>>
>> 2. Why not name your script to "vim" i.e. Vim Input Method for Chinese? :)
>>
> The name ChineseIM.vim contains an vim already.
>
> But for the name, I think a Capitalized filename creates unnecessary
> inconveniences when edited in command line. Especially for
> case-sensitive file systems.
>
> Since vim is designed for cross-platform I think it might be better to
> use only lowercase filename, which works well in all platforms. For
> example: inputmethod.vim would be a lot better since this can be used to
> input much more than just Chinese character.

If you really want _all_ platforms, use an 8.3 name in single case.
However in this case 8.3 is probably irrelevant since IIRC Dos versions
of Vim, if still used, almost never have +multi_byte.

Best regards,
Tony.
--
"I'd love to go out with you, but there are important world issues that
need worrying about."

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

Reply | Threaded
Open this post in threaded view
|

Re: an independent Chinese IME is available

Sean-130

>> Technically, nothing more can be done there, as the algorithm for
>> searching is now doing no scanning, no loop, and no cache at all.
>
> Maybe it can be done in this way? If search for, say, "w",
> then ChineseIME will just search the list that
> starting from "w" and consisting just one or two charactors long.
> And if search for "ww", it searches the lists
> that start with "ww" and just two or three charactors long

Good idea! I just implemented it, and uploaded another new version :)

Improved performance when searching by one or two alphabets:
(1) to limit search where short characters are typed
(2) the default setting is hard-coded to be 2
(3) for example, a<C-^> only shows maps for a only, not 'aiqing'

Sean

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

Reply | Threaded
Open this post in threaded view
|

Re: top/bottom posting [Re: an independent Chinese IME is available]

Sean-130
In reply to this post by Tony Mechelynck

> > set editor="vim -c \"set spell tw=70 et\" \"+call search('^$')\""
>
> > FWIW I use mutt.
>
> Depending on how the mail is passed to the external editor (and by what
> mail useragent program), the first blank line might actually be the
> boundary between the headers and the body, i.e., the top of the message
> proper.
>
> The bottom of the quoted message (before you compose your reply) should
> be the bottom of what is passed to the external editor, so I recommend

I have not used any standalone mail client for years. I read this
thread on firefox, by the way.

To reply, I simply did copy/paste to vim, from where I did another
copy/paste back to browser.

Among other things, I have never lost my typing :)

Sean

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

Reply | Threaded
Open this post in threaded view
|

Re: an independent Chinese IME is available

anhnmncb-2
In reply to this post by Sean-130

On Tue, 06 Jan 2009 15:52:59 +0800, Sean wrote:

>
>>> Technically, nothing more can be done there, as the algorithm for
>>> searching is now doing no scanning, no loop, and no cache at all.
>>
>> Maybe it can be done in this way? If search for, say, "w",
>> then ChineseIME will just search the list that
>> starting from "w" and consisting just one or two charactors long.
>> And if search for "ww", it searches the lists
>> that start with "ww" and just two or three charactors long
>
> Good idea! I just implemented it, and uploaded another new version :)
>
> Improved performance when searching by one or two alphabets:
> (1) to limit search where short characters are typed
> (2) the default setting is hard-coded to be 2
> (3) for example, a<C-^> only shows maps for a only, not 'aiqing'

Yes, now the speed is great :) But...

Still need some improves, say if "ww" has no Chinese charator but "www"  
has,
then it should search the longer list instead of saying no pattern found.

I'm so glad that ChineseIME is better and better everyday!

>
> Sean
>
> >
>



--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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

Reply | Threaded
Open this post in threaded view
|

Re: top/bottom posting [Re: an independent Chinese IME is available]

scott-268
In reply to this post by Sean-130

>
> I have not used any standalone mail client for years. I read this
> thread on firefox, by the way.
>
> To reply, I simply did copy/paste to vim, from where I did another
> copy/paste back to browser.
>
> Among other things, I have never lost my typing :)

you might want to check out the "It's All Text" plugin for
firefox -- it allows you to use gvim to edit any editable
thing in firefox -- it just might save you some copying and
pasting

sc



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

Reply | Threaded
Open this post in threaded view
|

Re: an independent Chinese IME is available

anhnmncb-2
In reply to this post by Sean-130

On Tue, 06 Jan 2009 15:52:59 +0800, Sean wrote:

>
>>> Technically, nothing more can be done there, as the algorithm for
>>> searching is now doing no scanning, no loop, and no cache at all.
>>
>> Maybe it can be done in this way? If search for, say, "w",
>> then ChineseIME will just search the list that
>> starting from "w" and consisting just one or two charactors long.
>> And if search for "ww", it searches the lists
>> that start with "ww" and just two or three charactors long
>
> Good idea! I just implemented it, and uploaded another new version :)
>
> Improved performance when searching by one or two alphabets:
> (1) to limit search where short characters are typed
> (2) the default setting is hard-coded to be 2
> (3) for example, a<C-^> only shows maps for a only, not 'aiqing'

Would you consider my following advices please?

1. If the charactor that cursor is on isn't non-black-space ascii,
then <space> just do normal <space> i.e. insert a real <space>
instead of saying "pattern not found" that is really useless.

2. add an autocmd to toggle IME off when escape from insert mode.

Both of them aren't hard to implement I think.

>
> Sean
>
> >
>



--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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

Reply | Threaded
Open this post in threaded view
|

Re: an independent Chinese IME is available

anhnmncb-2

A weird problem that I can't figure it out, ChineseIME just works
when I start a new vim, and use it in [no name] buffer,
then after I edit other files, <C-\> has no any effect, why?
My .vimrc just has one line relative to ChineseIME:

        let g:ChineseIME_Toggle_InertMode=1

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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

Reply | Threaded
Open this post in threaded view
|

Re: top/bottom posting [Re: an independent Chinese IME is available]

Dominique Pellé
In reply to this post by bill lam

bill lam wrote:

> I don't think email client is a good excuse for top (or bottom) post.
> Anyway if vim is configured as an external editor for composing email.
> It can search for the first blank line and that should be the bottom
> of quoted message.
>
> set editor="vim -c \"set spell tw=70 et\" \"+call search('^$')\""
>
> FWIW I use mutt.

A tad shorter and doing the same:

set editor="vim +'/^$/' -c 'set spell tw=70 et'"

-- Dominique

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

Reply | Threaded
Open this post in threaded view
|

Re: top/bottom posting [Re: an independent Chinese IME is available]

Dotan Cohen
In reply to this post by bill lam
2009/1/6 bill lam <[hidden email]>:
> I don't think email client is a good excuse for top (or bottom) post.

Exactly. I use Gmail, which uses top post and has no option to change.
So I _move_the_cursor_down_manually_. Takes a lot of effort, let me
tell you!

--
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il

א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
ا-ب-ت-ث-ج-ح-خ-د-ذ-ر-ز-س-ش-ص-ض-ط-ظ-ع-غ-ف-ق-ك-ل-م-ن-ه‍-و-ي
А-Б-В-Г-Д-Е-Ё-Ж-З-И-Й-К-Л-М-Н-О-П-Р-С-Т-У-Ф-Х-Ц-Ч-Ш-Щ-Ъ-Ы-Ь-Э-Ю-Я
а-б-в-г-д-е-ё-ж-з-и-й-к-л-м-н-о-п-р-с-т-у-ф-х-ц-ч-ш-щ-ъ-ы-ь-э-ю-я
ä-ö-ü-ß-Ä-Ö-Ü

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

Reply | Threaded
Open this post in threaded view
|

Re: top/bottom posting [Re: an independent Chinese IME is available]

bill lam
In reply to this post by Dominique Pellé
On Tue, 06 Jan 2009, Dominique Pelle wrote:
> set editor="vim +'/^$/' -c 'set spell tw=70 et'"

I once used that but it raises an error message when there is no empty
line.

--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩191 杜甫  詠懷古跡五首之二
    搖落深知宋玉悲  風流儒雅亦吾師  悵望千秋一灑淚  蕭條異代不同時
    江山故宅空文藻  雲雨荒臺豈夢思  最是楚宮俱泯滅  舟人指點到今疑

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

Reply | Threaded
Open this post in threaded view
|

Re: an independent Chinese IME is available

anhnmncb-2
In reply to this post by anhnmncb-2

On Tue, 06 Jan 2009 16:51:22 +0800, anhnmncb <[hidden email]> wrote:

> A weird problem that I can't figure it out, ChineseIME just works
> when I start a new vim, and use it in [no name] buffer,
> then after I edit other files, <C-\> has no any effect, why?
> My .vimrc just has one line relative to ChineseIME:
>
> let g:ChineseIME_Toggle_InertMode=1
>

I find the problem, the script use a local imap for <C-\> at line 237 of  
the script, you'd better to change it from:

     imap <buffer> <C-\>  <C-O>:call ChineseIME_Toggle_InertMode()<CR>

to:

     imap <C-\>  <C-O>:call ChineseIME_Toggle_InertMode()<CR>


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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

Reply | Threaded
Open this post in threaded view
|

Re: top/bottom posting [Re: an independent Chinese IME is available]

Sean-130
In reply to this post by bill lam

An updated version of ChineseIM.vim and data file are available.
Following are improvements:

(1) Made new naming
    (a) Plugin File =>  ChineseIM.vim
    (b) Data File =>  http://maxiangjiang.googlepages.com/ChineseIM.dict
    (c) global-variable =>  g:ChineseIM_InsertMode_Toggle
    (d) global-variable =>  g:ChineseIM_Ctrl6_Toggle

(2) Added a quick demo, to play without data file installed.
    (a) Assumption: vim is configured to show Chinese
    (b) source this script file by :source %
    (c) when in Insert mode, type:
        ma<C-X><C-U>
        chin<C-X><C-U>

(3) Showing more information on the popup menu:
    It is great when we have English Data File.
    To demo the usage, I added 2 entries ("english", "chinese") to the
new data file.  Now type:
        engl<C-X><C-U>
        chin<C-X><C-U>

(4) In ChineseIM_InsertMode, made punctuation intelligent :))

    ,  ==> Chinese , plus <Space>
    .  ==> Chinese . plus <Space>
    :  ==> Chinese : plus <Space>
    ;  ==> Chinese ; plus <Space>
    ?  ==> Chinese ? plus <Space>
    \  ==> Chinese \ plus <Space>

(5) In ChineseIM_InsertMode, added one more indication
    (a) cursor color turns to green
    (d) Status line shows  " -- INSERT (lang) --"

(6) uploaded a new data file, adding pinyin with tones to limit
selection.
    For example, "ma1", "ma2", "ma3", "ma4" works now

(7) Downloading:
    (a) Data File:  http://maxiangjiang.googlepages.com/ChineseIM.dict
    (b) Plugin:  http://vim.sourceforge.net/scripts/script.php?script_id=2506

Again, feedback is always welcome.

Thanks

Sean



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

Reply | Threaded
Open this post in threaded view
|

Re: top/bottom posting [Re: an independent Chinese IME is available]

Sean-130

New screenshot:

http://maxiangjiang.googlepages.com/ChineseIM.gif
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: top/bottom posting [Re: an independent Chinese IME is available]

Yue Wu
In reply to this post by Sean-130

On Wed, 07 Jan 2009 09:48:05 +0800, Sean <[hidden email]> wrote:

>
> An updated version of ChineseIM.vim and data file are available.
> Following are improvements:
>
> (1) Made new naming
>     (a) Plugin File =>  ChineseIM.vim
>     (b) Data File =>  http://maxiangjiang.googlepages.com/ChineseIM.dict
>     (c) global-variable =>  g:ChineseIM_InsertMode_Toggle
>     (d) global-variable =>  g:ChineseIM_Ctrl6_Toggle
>
> (2) Added a quick demo, to play without data file installed.
>     (a) Assumption: vim is configured to show Chinese
>     (b) source this script file by :source %
>     (c) when in Insert mode, type:
>         ma<C-X><C-U>
>         chin<C-X><C-U>
>
> (3) Showing more information on the popup menu:
>     It is great when we have English Data File.
>     To demo the usage, I added 2 entries ("english", "chinese") to the
> new data file.  Now type:
>         engl<C-X><C-U>
>         chin<C-X><C-U>
>
> (4) In ChineseIM_InsertMode, made punctuation intelligent :))
>
>     ,  ==> Chinese , plus <Space>
>     .  ==> Chinese . plus <Space>
>     :  ==> Chinese : plus <Space>
>     ;  ==> Chinese ; plus <Space>
>     ?  ==> Chinese ? plus <Space>
>     \  ==> Chinese \ plus <Space>
>
> (5) In ChineseIM_InsertMode, added one more indication
>     (a) cursor color turns to green
>     (d) Status line shows  " -- INSERT (lang) --"
>
> (6) uploaded a new data file, adding pinyin with tones to limit
> selection.
>     For example, "ma1", "ma2", "ma3", "ma4" works now
>
> (7) Downloading:
>     (a) Data File:  http://maxiangjiang.googlepages.com/ChineseIM.dict
>     (b) Plugin:  
> http://vim.sourceforge.net/scripts/script.php?script_id=2506

Didn't you see my reply? your script still use imap-local
so it would work just for [no name] buffer or the file
you start vim to edit from command line.

>
> Again, feedback is always welcome.

1. I think you can define a variable to toggle inputting Chinese
or English punctations.

2. The searching still need some improvings, say if "ww" and "www"
has no Chinese charator but "wwww" has, then typing "ww" should search for
the longer list instead of saying no pattern found.

3. If the charactor that cursor is on isn't non-black-space ascii,
then <space> just do normal <space> i.e. insert a real <space>
instead of saying "pattern not found" that is really useless. And I think
it's more intelligent.

4. Add an autocmd to toggle IME off when escape from insert mode.
Something like this:

au InsertLeave * call ChineseIM_InsertMode_ToggleOff()

function ChineseIM_InsertMode_ToggleOff()
     " -----------------------------------  options
     let &pumheight=s:saved_pumheight
     let &completeopt=s:saved_completeopt
     let &lazyredraw=s:saved_lazyredraw
     " -----------------------------------  IM mode indication
     let &iminsert=s:saved_iminsert
     highlight Cursor guifg=bg guibg=fg
     " -----------------------------------  <Space>
     imap <Space> <Space>
     " -----------------------------------  bracket
     imap (  (
                 imap )  )
     imap <  <
     imap >  >
     imap [  [
     imap ]  ]
     " -----------------------------------  punctuation
     imap ,  ,
     imap .  .
     imap :  :
     imap ;  ;
     imap ?  ?
     imap \\ \\
     " -----------------------------------
     let s:n += 1
endfunction


--
Regards,
Van.

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

Reply | Threaded
Open this post in threaded view
|

Re: top/bottom posting [Re: an independent Chinese IME is available]

bill lam
In reply to this post by Sean-130
On Tue, 06 Jan 2009, Sean wrote:
> Again, feedback is always welcome.

Does it (or will it) support wildcard?
eg,
ap?e will match ape, apple but not apply as key.

--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩155 許渾  早秋
    遙夜汎清瑟  西風生翠蘿  殘螢栖玉露  早雁拂銀河
    高樹曉還密  遠山晴更多  淮南一葉下  自覺老煙波

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

Reply | Threaded
Open this post in threaded view
|

Re: top/bottom posting [Re: an independent Chinese IME is available]

Sean-130

> Does it (or will it) support wildcard?
>> eg, ap?e will match ape, apple but not apply as key.

Yes! I can certainly make vim do it, and much more.

The problem is performance. It takes time to load the whole data
file into cache, and build data tree there.

As of now, I tried to make it work as fast as possible without full
table scan or huge cache. I also want to avoid making it as a dedicate
IM editor unless we explicitly pick up the option.

These are my design goals with Chinese IM plugin:

(1) without any negative impact to vim if we don't use the IM
(2) with decent performance if we start to use the IM

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

Reply | Threaded
Open this post in threaded view
|

Re: top/bottom posting [Re: an independent Chinese IME is available]

bill lam
On Tue, 06 Jan 2009, Sean wrote:
> (2) with decent performance if we start to use the IM

Can the dict be pre-compiled to speed up load time?

--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩166 崔塗  孤雁
    幾行歸塞盡  片影獨何之  暮雨相呼失  寒塘欲下遲
    渚雲低暗渡  關月冷相隨  未必逢矰繳  孤飛自可疑

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

Reply | Threaded
Open this post in threaded view
|

Re: top/bottom posting [Re: an independent Chinese IME is available]

Sean-130

>> (2) with decent performance if we start to use the IM
>Can the dict be pre-compiled to speed up load time?

Well, data file in binary is not an option. The data file format
used is the simplest one, while readable and editable.

The only "overhead" for vimim plugin is to load the data file into
vim list, and nothing more. That is the minimum requirement if we
want to input Chinese after all.

Another thing is about utf-8 encoding, which takes 30% more space
for multi-bytes. But, vim is doing utf-8 internally anyway.

How about any other editors, say, emacs? I don't believe they can be
loading faster and searching faster than vimim does.

Sean

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

Reply | Threaded
Open this post in threaded view
|

Re: top/bottom posting [Re: an independent Chinese IME is available]

Antony Scriven-3

On Thu, Jan 8, 2009 at 10:09 PM, Sean <[hidden email]> wrote:

 > > > [...]
 > > [...]
 >
 > Well, data file in binary is not an option. [...]

Which is nothing to do with the subject line. C'mon
people, get it together! --Antony

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

1234