Version 1.2

support to specify fcitx socket file by environment variable $FCITX_SOCKET
This commit is contained in:
lilydjwg 2012-07-27 00:00:00 +00:00 committed by Able Scraper
parent 4904d73230
commit 6b07b1e728
3 changed files with 19 additions and 64 deletions

View file

@ -1,49 +0,0 @@
" fcitx.vim 记住插入模式小企鹅输入法的状态
" Author: lilydjwg
" Maintainer: lilydjwg
" Last Change: 2010-11-18
" Note: 另有使用 Python3 接口的新版本
" ---------------------------------------------------------------------
" Load Once:
if (has("win32") || has("win95") || has("win64") || has("win16"))
" Windows 下不要载入
finish
endif
if !exists('$DISPLAY')
" 没有 X不要载入
finish
endif
if &cp || exists("g:loaded_fcitx") || !executable("fcitx-remote")
finish
endif
let s:keepcpo = &cpo
let g:loaded_fcitx = 1
set cpo&vim
" ---------------------------------------------------------------------
" Functions:
function Fcitx2en()
let inputstatus = system("fcitx-remote")
if inputstatus == 2
let b:inputtoggle = 1
call system("fcitx-remote -c")
endif
endfunction
function Fcitx2zh()
try
if b:inputtoggle == 1
call system("fcitx-remote -o")
let b:inputtoggle = 0
endif
catch /inputtoggle/
let b:inputtoggle = 0
endtry
endfunction
" ---------------------------------------------------------------------
" Autocmds:
au InsertLeave * call Fcitx2en()
au InsertEnter * call Fcitx2zh()
" ---------------------------------------------------------------------
" Restoration And Modelines:
let &cpo=s:keepcpo
unlet s:keepcpo
" vim:fdm=expr:fde=getline(v\:lnum-1)=~'\\v"\\s*-{20,}'?'>1'\:1