prompt-toolkit / prompt-toolkit/python-prompt-toolkit

shortcut next_history not working on windows

Open
#1,788 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.6k
Forks
815
PR merge metrics
No merged PRs in 30d

Description

reproduce

add below code to ~/.ipython/profile_default/startup/00-keybindings.py

from IPython import get_ipython
from prompt_toolkit.enums import DEFAULT_BUFFER
import prompt_toolkit.key_binding.bindings.named_commands as nc
from prompt_toolkit.filters import HasFocus, ViInsertMode

ip = get_ipython()

if getattr(ip, 'pt_app', None):
    registry = ip.pt_app.key_bindings

    registry.add_binding('c-j',
                         filter=(HasFocus(DEFAULT_BUFFER)
                                 & ViInsertMode()))(nc.next_history)

Above setting works on WSL, but not working on Window ipython open in powershell.

But shortcut like previous_history works both on WSL and Windows.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the binding from ~/.ipython/profile_default/startup/00-keybindings.py in IPython running in Windows PowerShell, then compare it with the working WSL behavior. Start from the registry.add_binding call and the nc.next_history command; done means c-j invokes next_history on Windows while previous_history continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.