I am writing a Vim plugin for installing iBus engines and input methods. So far I can change the engines using the code below:
function! im#setEngine(name)
python << EOF
try:
import ibus,vim
bus = ibus.Bus()
ic = ibus.InputContext(bus, bus.current_input_contxt())
name = vim.eval("a:name")
engines = bus.get_engines_by_names([name])
size = len(engines)
if size <= 0:
print "Could not find engine %s"%name
else:
engine = engines[0]
ic.set_engine(engine)
except Exception, e:
print "Failed to connect to iBus"
print e
EOF
endfunction
function! im#listEngines()
let l:engines = []
python << EOF
try:
import ibus,dbus,vim
bus = ibus.Bus()
names = []
for engine in bus.list_engines():
names.append(str(engine.name))
vim.command("let l:engines = %s"% names)
except Exception, e:
print "Failed to connect to iBus"
print e
EOF
return l:engines
endfunction
Now I am also trying to set the input method for the engines, but I cannot find how to do it. IBus documentation is not yet available.
Can anyone provide pointers or examples of how to programmatically (Python) change an iBus input method? You could also get a list of supported input methods for each engine.
====
From now on, I will try to provide more context on the problem I'm trying to solve. Skip if you are not interested.
vim-im, Vim. , Vim , iBus ascii. vim , , .., .
, iBus 1.5 /, , . Ubuntu <= 13.04, Debian Jessie , , Ubuntu.
, , - iBus iBus , Vim .