def __init__(self, key): self.key = key self.callbacks = {} if isinstance(key, keybindings.Keys): string = key.value else: string = key self.callbacks[Mode.insert] = partial(text.add_string, string) vx.bind(self.key, self)
@vbind(vx.keys.A) def eol_append(): '''Move to end of line and enter insert mode''' move.eol() insert() # hjkl vbind(vx.keys.h, move.left) vbind(vx.keys.j, move.down) vbind(vx.keys.k, move.up) vbind(vx.keys.l, move.right) vbind('0', move.bol) vbind('^', move.bol) # FIXME should move to first non-ws char vbind('$', move.eol) @vx.bind(vx.keys.escape) def escape(): '''Return to normal mode''' vx.window.focused.mode = Mode.normal vx.print_printable = False # quit vx.bind('C-x', vx.quit) # vx prompt vx.bind(';', vx.exec_prompt) # FIXME add vigor prompt