Skip to content

feat(vi): support deleting chars backward with X#1067

Open
sim590 wants to merge 1 commit into
nushell:mainfrom
sim590:X-delete-char-before-cursor
Open

feat(vi): support deleting chars backward with X#1067
sim590 wants to merge 1 commit into
nushell:mainfrom
sim590:X-delete-char-before-cursor

Conversation

@sim590
Copy link
Copy Markdown

@sim590 sim590 commented May 5, 2026

Summary

Add support for the X command in vi normal mode, which deletes the character before the cursor and places it in the cut buffer, mirroring the behavior of X in vim.

This partially addresses #621.

Changes

  • Parse X as Command::DeleteCharBackward in the vi command parser
  • In normal mode, emit MoveLeft + CutChar to delete the character before the cursor and place it in the cut buffer
  • In visual mode, emit CutSelection (consistent with x behavior)
  • Add parser tests for X and 2X

Known limitation

When used with a multiplier (e.g. 3X), each character is cut individually, so only the last deleted character remains in the cut buffer. This is a pre-existing limitation shared with x and will be addressed in a follow-up PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant