Skip to content

Allow a key sequence binding like j,k to not prevent user from insert j #1701

Open
@dhatch48

Description

@dhatch48

Description of the new feature/enhancement

You can bind a key sequence like j,k to a function or script block by Set-PSReadLineKeyHandler -Key 'j,k' -ViMode Insert -Function ViCommandMode, but a user cannot insert a character j after that.

Proposed technical implementation details (optional)

Quoted from #1701 (comment)

In vim, jk or jj to exit insert mode is super common. Usually it works like this:

  1. You press j
  2. j is written to the buffer
  3. A timer starts
  4. If you press the next key in the sequence before the timer is up, the j is removed from the buffer and the command fires
  5. If the key you press next isn't in the sequence, or the timer is up then it's treated like a literal

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions