diff --git a/plugin/fcitx.py b/plugin/fcitx.py index 5de12bb..546e9f9 100644 --- a/plugin/fcitx.py +++ b/plugin/fcitx.py @@ -27,6 +27,11 @@ def fcitxtalk(command=None): sock.send(FCITX_OPEN) else: raise ValueError('unknown fcitx command') + except struct.error: + # if there's a proxy of some kind, connect and send *will* succeed when + # fcitx isn't there. + vim.command('echohl WarningMsg | echo "fcitx.vim: socket error" | echohl NONE') + return finally: sock.close() diff --git a/plugin/fcitx.vim b/plugin/fcitx.vim index 295ede2..9c63f3d 100644 --- a/plugin/fcitx.vim +++ b/plugin/fcitx.vim @@ -1,11 +1,13 @@ scriptencoding utf-8 " fcitx.vim remember fcitx's input state for each buffer " Author: lilydjwg -" Version: 1.2 +" Version: 1.2.3 " URL: http://www.vim.org/scripts/script.php?script_id=3764 " --------------------------------------------------------------------- " Load Once: -if &cp || exists("g:loaded_fcitx") || !exists('$DISPLAY') || exists('$SSH_TTY') || has('gui_macvim') +if &cp || exists("g:loaded_fcitx") || ( + \ (!exists('$DISPLAY') || exists('$SSH_TTY') || has('gui_macvim')) + \ && !exists('$FCITX_SOCKET')) finish endif if has("python3") diff --git a/so/fcitx.vim b/so/fcitx.vim index 507fb4a..6fc96bd 100644 --- a/so/fcitx.vim +++ b/so/fcitx.vim @@ -1,7 +1,6 @@ " fcitx.vim 记住插入模式小企鹅输入法的状态 " Author: lilydjwg " Maintainer: lilydjwg -" Last Change: 2010-11-18 " Note: 另有使用 Python3 接口的新版本 " --------------------------------------------------------------------- " Load Once: @@ -9,8 +8,7 @@ if (has("win32") || has("win95") || has("win64") || has("win16")) " Windows 下不要载入 finish endif -if !exists('$DISPLAY') - " 没有 X,不要载入 +if !exists('$DISPLAY') || exists('$SSH_TTY') || has('gui_macvim') finish endif if &cp || exists("g:loaded_fcitx") || !executable("fcitx-remote")