Merge pull request #6 from meijieru/fcitx5

[RDY] fcitx5 vimscript
This commit is contained in:
依云 2018-05-31 18:51:01 +08:00 committed by GitHub
commit 49983f1c49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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/