forked from humiaozuzu/fcitx-status
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0bb1a14
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 以上 | ||
|
||
安装 | ||
---- | ||
|
||
直接安装即可 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |