diff --git a/SublimeIBusFallBackCommand.sublime-settings b/SublimeIBusFallBackCommand.sublime-settings new file mode 100644 index 0000000..a220ef5 --- /dev/null +++ b/SublimeIBusFallBackCommand.sublime-settings @@ -0,0 +1,12 @@ +{ + "backspace": { "command": "left_delete" }, + "left": { "command": "move", "args": {"by": "characters", "forward": false} }, + "right": { "command": "move", "args": {"by": "characters", "forward": true} }, + "up": { "command": "move", "args": {"by": "lines", "forward": false} }, + "down": { "command": "move", "args": {"by": "lines", "forward": true} }, + "enter": { "command": "insert", "args": {"characters": "\n"} }, + "pageup": { "command": "move", "args": {"by": "pages", "forward": false} }, + "pagedown": { "command": "move", "args": {"by": "pages", "forward": true} }, + "home": { "command": "move_to", "args": {"to": "bol", "extend": false} }, + "end": { "command": "move_to", "args": {"to": "eol", "extend": false} } +} diff --git a/sublimeibusplugin.py b/sublimeibusplugin.py index 1bcbec2..3468ec9 100644 --- a/sublimeibusplugin.py +++ b/sublimeibusplugin.py @@ -136,7 +136,12 @@ def ibus_hide_preedit_text_cb(self, id_no): pass def ibus_process_key_event_cb(self, id_no, handled): - pass + if handled == 0: + settings = sublime.load_settings('SublimeIBusFallBackCommand.sublime-settings') + cmd = settings.get(status.key) + if cmd is not None: + status.view.run_command(cmd.get('command', None), + cmd.get('args', None)) class IbusToggleCommand(sublime_plugin.TextCommand): @@ -159,6 +164,7 @@ def run(self, edit, key, alt=False, ctrl=False, shift=False, super=False): keysym = self.table.get(key, None) if keysym is not None: + status.key = key command.process_key(keysym)