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

Vi-mode `cw` inconsistent with actual vi

Open
#394 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

In Vi,

"cw" and "cW" are treated like "ce" and "cE" if the cursor is on a non-blank. This is because "cw" is interpreted as change-word, and a word does not include the following white space.
-- http://vimdoc.sourceforge.net/htmldoc/motion.html#word-motions

This means that, if I type "brew search xonsh" in Vi(m), with my cursor placed at the beginning of 'search'; cw will allow me to type install<esc> to change the sentence to "brew install xonsh".

In prompt_toolkit however, the same process would result in "brew installxonsh".

It may sound trivial, but since vim-users will spend more time using vim commands in vim than anywhere else, it's hard to remember the different behaviour and may cause problems.

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

Start at the Vi-mode handling for cw and cW, using the reported brew search xonsh sequence to reproduce the difference from Vim. Trace how the change operation selects trailing whitespace, then verify that completing the command produces brew install xonsh rather than brew installxonsh.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.