prompt-toolkit / prompt-toolkit/python-prompt-toolkit
Start in vi navigation mode
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
Hi. Thanks for prompt-toolkit. It's great.
I'm working on an application that populates the text area and then asks the user to delete parts of it, so the natural way to start is not in InputMode.INSERT but instead in InputMode.NAVIGATION.
I've been playing around with things like this:
app = Application(
key_bindings=kb, layout=Layout(root_container), editing_mode=EditingMode.VI
)
app.vi_state.input_mode = InputMode.NAVIGATION
app.run()
But the app still starts in insert mode. I think that Application is calling reset() which is setting it back to insert mode.
Is there a recommended way to do this?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading Application.reset() in src/prompt_toolkit/application/application.py and the reset logic in src/prompt_toolkit/key_binding/vi_state.py, which the issue identifies as restoring insert mode. Trace the startup sequence and determine how an application can retain InputMode.NAVIGATION; done means the application starts in vi navigation mode after app.run().
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100