mirror of
https://github.com/lilydjwg/fcitx.vim.git
synced 2025-12-26 18:14:57 +08:00
add a function for current IM name
for showing info e.g. on the status line. closes #32.
This commit is contained in:
parent
7f06ccfa8a
commit
d79d816e24
3 changed files with 17 additions and 0 deletions
|
|
@ -18,6 +18,9 @@ class FcitxComm():
|
|||
def deactivate(self):
|
||||
self.fcitx.Deactivate()
|
||||
|
||||
def current(self):
|
||||
return self.fcitx.CurrentInputMethod()
|
||||
|
||||
class FcitxRimeComm():
|
||||
def __init__(self):
|
||||
bus = dbus.SessionBus()
|
||||
|
|
@ -33,6 +36,9 @@ class FcitxRimeComm():
|
|||
def deactivate(self):
|
||||
self.fcitx.SetAsciiMode(True)
|
||||
|
||||
def current(self):
|
||||
return self.fcitx.GetCurrentSchema()
|
||||
|
||||
try:
|
||||
if vim.eval('get(g:, "fcitx5_rime")') == '1':
|
||||
FcitxComm = FcitxRimeComm
|
||||
|
|
@ -69,3 +75,7 @@ def fcitx2zh():
|
|||
vim.command('let b:inputtoggle = 0')
|
||||
else:
|
||||
vim.command('let b:inputtoggle = 0')
|
||||
|
||||
@may_reconnect
|
||||
def fcitx_current_im():
|
||||
return Fcitx.current()
|
||||
|
|
|
|||
|
|
@ -44,6 +44,9 @@ elseif has('python3')
|
|||
function Fcitx2zh()
|
||||
py3 fcitx2zh()
|
||||
endfunction
|
||||
function FcitxCurrentIM()
|
||||
return py3eval('fcitx_current_im()')
|
||||
endfunction
|
||||
|
||||
let g:loaded_fcitx = 1
|
||||
endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue