def cli_bindings():
    key_binding_manager = KeyBindingManager(
        enable_open_in_editor=True,
        enable_system_bindings=True,
        enable_auto_suggest_bindings=True,
        enable_search=True,
        enable_abort_and_exit_bindings=True)
    @key_binding_manager.registry.add_binding(Keys.F2)
    def _(event):
        _logger.debug('Detected F2 key.')
        buf = event.cli.current_buffer
        buf.completer.smart_completion = not buf.completer.smart_completion
    @key_binding_manager.registry.add_binding(Keys.F3)
    def _(event):
        _logger.debug('Detected F3 key.')
        buf = event.cli.current_buffer
        buf.always_multiline = not buf.always_multiline
    @key_binding_manager.registry.add_binding(Keys.F4)
    def _(event):
        _logger.debug('Detected F4 key.')
        if event.cli.editing_mode == EditingMode.VI:
            event.cli.editing_mode = EditingMode.EMACS
        else:
            event.cli.editing_mode = EditingMode.VI
    @key_binding_manager.registry.add_binding(Keys.Tab)
    def _(event):
        _logger.debug('Detected <Tab> key.')
        b = event.cli.current_buffer
        if b.complete_state:
            b.complete_next()
        else:
            event.cli.start_completion(select_first=True)
    @key_binding_manager.registry.add_binding(Keys.ControlSpace)
    def _(event):
        _logger.debug('Detected <C-Space> key.')
        b = event.cli.current_buffer
        if b.complete_state:
            b.complete_next()
        else:
            event.cli.start_completion(select_first=False)
    @key_binding_manager.registry.add_binding(Keys.ControlJ, filter=HasSelectedCompletion())
    def _(event):
        _logger.debug('Detected <C-J> key.')
        event.current_buffer.complete_state = None
        b = event.cli.current_buffer
        b.complete_state = None
    return key_binding_manager