Skip to content

Commit

Permalink
init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
humiaozuzu committed Feb 14, 2012
0 parents commit 0bb1a14
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Fcitx 输入法自动切换
===================

在离开/重新进入插入模式时自动切换输入法状态,以便在普通模式下始终是英文输入模式,切换回插入模式时恢复离开时的输入法输入模式。仅仅是将[通过命令控制Fcitx](http://fcitx.github.com/handbook/chapter-remote.html)里面的代码变成了插件形式。

要求
---

建议 fcitx 4.0 以上

安装
----

直接安装即可
20 changes: 20 additions & 0 deletions plugin/fcitx.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
let g:input_toggle = 0
function! Fcitx2en()
let s:input_status = system("fcitx-remote")
if s:input_status == 2
let g:input_toggle = 1
let l:a = system("fcitx-remote -c")
endif
endfunction

function! Fcitx2zh()
let s:input_status = system("fcitx-remote")
if s:input_status != 2 && g:input_toggle == 1
let l:a = system("fcitx-remote -o")
let g:input_toggle = 0
endif
endfunction

set timeoutlen=150
autocmd InsertLeave * call Fcitx2en()
autocmd InsertEnter * call Fcitx2zh()

0 comments on commit 0bb1a14

Please sign in to comment.