cht電腦資訊gcingcin分享
adm Find login register

怎樣在gvim的normal/insert mode之間自動切換IM?

kanzen22
joined: 2017-01-14
posted: 2
promoted:
bookmarked:
1subject: 怎樣在gvim的normal/insert mode之間自動切換IM?Promote 0 Bookmark 02017-01-14quote  

請問有辦法在退出insert mode時關閉IM,進入insert mode時開啟IM嗎?

我試過

set imactivatekey=C-space

但是這設定在只會在進入insert mode時切換IM開關 (關變開,開變關),而退出時沒動作。這並不是想要的效果。

我使用Ubuntu 16.04 vim-gtk3。

eliu

joined: 2007-08-09
posted: 11468
promoted: 617
bookmarked: 187
新竹, 台灣
2subject: Promote 0 Bookmark 02017-01-15quote  

用 vi 輸入中文很困難

samwhelp
joined: 2016-10-21
posted: 26
promoted:
bookmarked:
3subject: 研究方向Promote 0 Bookmark 02017-01-15quote  


提供一個可以研究的方向。

我印象中以前好像有看過解法,不過當時沒有去嘗試。

剛用「fcitx vim」查了一下,可以查到一些文章,是採用「fcitx.vim
我是使用「fcitx-chewing」,剛測試「fcitx.vim」是OK的。

要注意的是,
若是在「Vim Input Mode」並且已經是「fcitx-chewing 中文輸入」的狀態下,
回到「Vim Normal Mode」要使用「Ctrl+[」,
使用「Esc」,會是「fcitx-chewing」的另一個功用,


您可以參考「fcitx.vim」原始碼的作法

vim觸發的機制是下方的

" Autocmds:
au InsertLeave * call Fcitx2en()
au InsertEnter * call Fcitx2zh()

fcitx的文件,也有相關的說明

不過要搭配vim這個機制,需要gcin提供「指令」來切換目前的輸入法,
例如:
在「fcitx」使用「fcitx-remote (原始碼) 」來做切換,我之前在另一個「討論串」有提到這個指令

在「ibus」使用「ibus (原始碼) 」來做切換,我之前在另一個「討論串」有紀錄相關用法


## 相關的連結


* https://www.zhihu.com/question/29518135
* https://blog.lilydjwg.me/tag/fcitx
* https://blog.lilydjwg.me/2011/10/7/fcitx-vim-1-0-released.30049.html
* https://github.com/vim-scripts/fcitx.vim
* https://github.com/lilydjwg/fcitx.vim
* http://www.vim.org/scripts/script.php?script_id=3764
* http://fcitx.github.io/handbook/chapter-remote.html
* https://www.ubuntu-tw.org/modules/newbb/viewtopic.php?post_id=351838#forumpost351838
* http://vimdoc.sourceforge.net/htmldoc/autocmd.html

 



edited: 4

cht電腦資訊gcingcin分享
adm Find login register
views:9251