From b6fc70ffba65f356e0a981dbec3b51cf471ea2c6 Mon Sep 17 00:00:00 2001 From: meijieru Date: Thu, 31 May 2018 18:45:22 +0800 Subject: [PATCH] fcitx5 vimscript --- plugin/fcitx.vim | 8 ++++++++ so/fcitx.vim | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/plugin/fcitx.vim b/plugin/fcitx.vim index b0c7ab5..882a2f7 100644 --- a/plugin/fcitx.vim +++ b/plugin/fcitx.vim @@ -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") diff --git a/so/fcitx.vim b/so/fcitx.vim index 953010f..45a85a8 100644 --- a/so/fcitx.vim +++ b/so/fcitx.vim @@ -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/