Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Right arrow hotkey doesn't work for IPython:auto_suggest.accept #14117

Open
NightMachinery opened this issue Jul 17, 2023 · 3 comments
Open

Right arrow hotkey doesn't work for IPython:auto_suggest.accept #14117

NightMachinery opened this issue Jul 17, 2023 · 3 comments
Labels
autosuggestions Related to fish-like autosuggestion feature (as opposed to the tab-completions) needs-info

Comments

@NightMachinery
Copy link

Pressing the right arrow key does not accept a suggestion. It does move between typed characters.

from IPython import get_ipython

# Get the current IPython instance.
shell = get_ipython()

The following makes alt+right work correctly:

shell.shortcuts = [{'command': 'IPython:auto_suggest.accept_token', 'new_keys': ["escape", "right"]}]

But when I do:

shell.shortcuts = [{'command': 'IPython:auto_suggest.accept', 'new_keys': ['right']}]
ValueError: Multiple shortcuts matching {'command': 'IPython:auto_suggest.accept'} found, please add keys/filter to select one of: [Binding(command=<function accept at 0x7f2b6bdbb010>, keys=['c-f'], condition='has_suggestion & default_buffer_focused & emacs_like_insert_mode'), Binding(command=<function accept at 0x7f2b6bdbb010>, keys=['right'], condition='has_suggestion & default_buffer_focused & emacs_like_insert_mode')]
@krassowski
Copy link
Member

In what IPython version?

@krassowski krassowski added autosuggestions Related to fish-like autosuggestion feature (as opposed to the tab-completions) needs-info labels Jul 30, 2023
@ferdinandyb
Copy link

I get the same error, my ipython config is this:

c = get_config()  # noqa
c.TerminalInteractiveShell.confirm_exit = False

c.TerminalIPythonApp.display_banner = False
c.TerminalInteractiveShell.shortcuts = [
    {
        "command": "IPython:auto_suggest.accept",
        "new_keys": ["c-z"],
    }
]
ipython --version
8.14.0

@ferdinandyb
Copy link

Ok, so I've managed to figure out that for a command that already has a shortcut you need to use match_keys instead of new_keys, see the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosuggestions Related to fish-like autosuggestion feature (as opposed to the tab-completions) needs-info
Projects
None yet
Development

No branches or pull requests

3 participants