fcitx5 vimscript

This commit is contained in:
meijieru 2018-05-31 18:45:22 +08:00
parent 83519f4ed3
commit b6fc70ffba
2 changed files with 12 additions and 4 deletions

View file

@ -10,6 +10,14 @@ if &cp || exists("g:loaded_fcitx") || (
\ && !exists('$FCITX_SOCKET'))
finish
endif
if executable('fcitx5-remote')
" currently python version does not support fcitx5
let g:fcitx_remote = 'fcitx5-remote'
runtime so/fcitx.vim
finish
else
let g:fcitx_remote = 'fcitx-remote'
endif
if has("python3")
let python3 = 1
elseif has("python")

View file

@ -11,7 +11,7 @@ endif
if !(exists('$DISPLAY') || has('gui_macvim')) || exists('$SSH_TTY')
finish
endif
if &cp || exists("g:loaded_fcitx") || !executable("fcitx-remote")
if &cp || exists("g:loaded_fcitx") || !executable(g:fcitx_remote)
finish
endif
let s:keepcpo = &cpo
@ -20,16 +20,16 @@ set cpo&vim
" ---------------------------------------------------------------------
" Functions:
function Fcitx2en()
let inputstatus = system("fcitx-remote")
let inputstatus = system(g:fcitx_remote)
if inputstatus == 2
let b:inputtoggle = 1
call system("fcitx-remote -c")
call system(g:fcitx_remote . ' -c')
endif
endfunction
function Fcitx2zh()
try
if b:inputtoggle == 1
call system("fcitx-remote -o")
call system(g:fcitx_remote . ' -o')
let b:inputtoggle = 0
endif
catch /inputtoggle/