mirror of
https://github.com/lilydjwg/fcitx.vim.git
synced 2026-05-13 16:38:34 +08:00
fcitx5 vimscript
This commit is contained in:
parent
83519f4ed3
commit
b6fc70ffba
2 changed files with 12 additions and 4 deletions
|
|
@ -10,6 +10,14 @@ if &cp || exists("g:loaded_fcitx") || (
|
||||||
\ && !exists('$FCITX_SOCKET'))
|
\ && !exists('$FCITX_SOCKET'))
|
||||||
finish
|
finish
|
||||||
endif
|
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")
|
if has("python3")
|
||||||
let python3 = 1
|
let python3 = 1
|
||||||
elseif has("python")
|
elseif has("python")
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ endif
|
||||||
if !(exists('$DISPLAY') || has('gui_macvim')) || exists('$SSH_TTY')
|
if !(exists('$DISPLAY') || has('gui_macvim')) || exists('$SSH_TTY')
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
if &cp || exists("g:loaded_fcitx") || !executable("fcitx-remote")
|
if &cp || exists("g:loaded_fcitx") || !executable(g:fcitx_remote)
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let s:keepcpo = &cpo
|
let s:keepcpo = &cpo
|
||||||
|
|
@ -20,16 +20,16 @@ set cpo&vim
|
||||||
" ---------------------------------------------------------------------
|
" ---------------------------------------------------------------------
|
||||||
" Functions:
|
" Functions:
|
||||||
function Fcitx2en()
|
function Fcitx2en()
|
||||||
let inputstatus = system("fcitx-remote")
|
let inputstatus = system(g:fcitx_remote)
|
||||||
if inputstatus == 2
|
if inputstatus == 2
|
||||||
let b:inputtoggle = 1
|
let b:inputtoggle = 1
|
||||||
call system("fcitx-remote -c")
|
call system(g:fcitx_remote . ' -c')
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
function Fcitx2zh()
|
function Fcitx2zh()
|
||||||
try
|
try
|
||||||
if b:inputtoggle == 1
|
if b:inputtoggle == 1
|
||||||
call system("fcitx-remote -o")
|
call system(g:fcitx_remote . ' -o')
|
||||||
let b:inputtoggle = 0
|
let b:inputtoggle = 0
|
||||||
endif
|
endif
|
||||||
catch /inputtoggle/
|
catch /inputtoggle/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue