Last active
December 12, 2017 13:45
-
-
Save ayang/656b0fa1f4eeef254a51 to your computer and use it in GitHub Desktop.
Auto change fcitx input method status for vim different mode
This file contains hidden or 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
let w:insert_input_active = 0 | |
function FcitxLeaveInsert() | |
let s:input_status = system("fcitx-remote") | |
if s:input_status == 2 | |
let w:insert_input_active = 1 | |
let l:a = system("fcitx-remote -c") | |
endif | |
endfunction | |
function FcitxEnterInsert() | |
if !exists(w:insert_input_active) | |
let w:insert_input_active = 0 | |
endif | |
if w:insert_input_active != 0 | |
let l:a = system("fcitx-remote -o") | |
let w:insert_input_active = 0 | |
endif | |
endfunction | |
autocmd InsertLeave * call FcitxLeaveInsert() | |
autocmd InsertEnter * call FcitxEnterInsert() | |
set timeoutlen=15 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It works fine mostly but behaves bad when I have multiple panes opened. It yields following error when entering insert mode and hooks my cursor onto it.