ZIm/crates/vim/src
Peter Finn 08ce230bae
vim: Add some forced motion support (#27991)
Closes https://github.com/zed-industries/zed/issues/20971

Added `v` input to yank and delete to override default motion. The
global vim state tracking if the forced motion flag was passed handled
the same way that the count is. [The main chunk of code maps the motion
kind from the default to the overridden
kind](https://github.com/zed-industries/zed/pull/27991/files#diff-2dca6b7d1673c912d14e4edc74e415abbe3a4e6d6b37e0e2006d30828bf4bb9cR1249-R1254).
To handle the case of deleting a single character (dv0) at the start of
a row I had to modify the control flow
[here](https://github.com/zed-industries/zed/pull/27991/files#diff-2dca6b7d1673c912d14e4edc74e415abbe3a4e6d6b37e0e2006d30828bf4bb9cR1240-R1244).
Then to handle an exclusive delete till the end of the row (dv$) I
[saturated the endpoint with a left
bias](https://github.com/zed-industries/zed/pull/27991/files#diff-2dca6b7d1673c912d14e4edc74e415abbe3a4e6d6b37e0e2006d30828bf4bb9cR1281-R1286).

Test case: dv0


https://github.com/user-attachments/assets/613cf9fb-9732-425c-9179-025f3e107584

Test case: yvjp


https://github.com/user-attachments/assets/550b7c77-1eb8-41c3-894b-117eb50b7a5d

Release Notes:

- Added some forced motion support for delete and yank
2025-04-11 11:12:30 -06:00
..
digraph Add Vim digraphs (#14887) 2024-07-28 22:44:32 -06:00
normal vim: Add some forced motion support (#27991) 2025-04-11 11:12:30 -06:00
test vim: Add some forced motion support (#27991) 2025-04-11 11:12:30 -06:00
change_list.rs vim: Add some forced motion support (#27991) 2025-04-11 11:12:30 -06:00
command.rs vim: Add some forced motion support (#27991) 2025-04-11 11:12:30 -06:00
digraph.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
helix.rs Temporarily disable helix tests (#28279) 2025-04-07 21:50:35 +00:00
indent.rs vim: Add some forced motion support (#27991) 2025-04-11 11:12:30 -06:00
insert.rs vim: Add some forced motion support (#27991) 2025-04-11 11:12:30 -06:00
mode_indicator.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
motion.rs vim: Add some forced motion support (#27991) 2025-04-11 11:12:30 -06:00
normal.rs vim: Add some forced motion support (#27991) 2025-04-11 11:12:30 -06:00
object.rs chore: Bump Rust edition to 2024 (#27800) 2025-03-31 20:55:27 +02:00
replace.rs vim: Add some forced motion support (#27991) 2025-04-11 11:12:30 -06:00
rewrap.rs vim: Add some forced motion support (#27991) 2025-04-11 11:12:30 -06:00
state.rs vim: Add some forced motion support (#27991) 2025-04-11 11:12:30 -06:00
surrounds.rs vim: Add some forced motion support (#27991) 2025-04-11 11:12:30 -06:00
test.rs editor: Refactor EditorMode::Full (#28546) 2025-04-10 23:22:27 +00:00
vim.rs vim: Add some forced motion support (#27991) 2025-04-11 11:12:30 -06:00
visual.rs vim: Add some forced motion support (#27991) 2025-04-11 11:12:30 -06:00