zed/docs/src
Thomas Heartman 084a0233b6
vim: Add exchange (#24678)
Implements [vim-exchange](https://github.com/tommcdo/vim-exchange)
functionality.

Lets you swap the content of one selection/object/motion with another.

The default key bindings are the same as in exchange:
- `cx` to begin the exchange in normal mode. Visual mode does not have a
default binding due to conflicts.
- `cxx` selects the current line
- `cxc` clears the selection
- If the previous operation was an exchange, `.` will repeat that
operation.

Closes #22759

## Overlapping regions

According to the vim exchange readme:

> If one region is fully contained within the other, it will replace the
containing region.

Zed does the following:
- If one range is completely contained within another: the smaller
region replaces the larger region (as in exchange.vim)
- If the ranges only partially overlap, then we abort and cancel the
exchange. I don't think we can do anything sensible with that. Not sure
what the original does, evil-exchange aborts.

## Not implemented: cross-window exchange

Emacs's evil-exchange allows you to exchange across buffers. There is no
code to accommodate that in this PR. Personally, it'd never occurred to
me before working on this and I've never needed it. As such, I'll leave
that implementation for whomever needs it.

As an upside; this allows you to have concurrent exchange states per
buffer, which may come in handy.

## Bonus

Also adds "replace with register" for the full line with `grr` 🐕 This
was an oversight from a previous PR.

Release notes:

- Added an implementation of `vim-exchange`
- Fixed: Added missing default key binding for `Vim::CurrentLine` for
replace with register mode (`grr`)

---------

Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
2025-02-22 20:36:21 +00:00
..
assistant docs: OpenAI settings example fix (#25112) 2025-02-19 11:05:52 -05:00
development Revert "docs: Update msys2 section (#24942)" (#24958) 2025-02-15 18:52:10 +00:00
extensions docs: Update icon theme docs with file_stems and file_suffixes (#24929) 2025-02-15 01:58:19 +00:00
languages docs: Add missing comma in YAML configuration (#25351) 2025-02-21 15:18:11 -05:00
additional-learning-materials.md update docs content (#11374) 2024-05-03 16:24:04 -06:00
channels.md Docs Party 2024 (#15876) 2024-08-09 13:37:54 -04:00
collaboration.md Clarify guests vs collaborators in project sharing docs (#22945) 2025-01-10 15:42:52 +00:00
completions.md docs: Add link to Zeta's Hugging Face profile (#24915) 2025-02-14 22:58:46 +00:00
configuring-languages.md Add per-language settings show_completions_on_input and show_completion_documentation (#21722) 2024-12-09 11:53:50 -07:00
configuring-zed.md Revert "Hide the mouse when the user is typing in the editor (#25040)" (#25393) 2025-02-22 10:19:23 -05:00
development.md Use the development credentials provider in development by default (#25273) 2025-02-20 19:07:16 +00:00
environment.md docs: Fix typo in environment documentation (#19164) 2024-10-13 16:47:09 -04:00
extensions.md docs: Add docs for icon theme extensions (#24155) 2025-02-04 00:23:33 +00:00
fonts.md Fix casing of "macOS" (#17040) 2024-08-28 19:10:49 -04:00
getting-started.md docs: Improve the Getting Started page (#22545) 2025-01-01 17:19:10 +00:00
git.md docs: Update names of supported Git providers (#17436) 2024-09-05 13:42:49 -04:00
globs.md Glob documentation (#18789) 2024-10-15 17:21:04 -04:00
icon-themes.md icon_theme_selector: Add footer and related docs (#25042) 2025-02-20 00:02:24 +00:00
key-bindings.md Migrate keymap and settings + edit predictions rename (#23834) 2025-02-07 21:17:07 +05:30
languages.md docs: Fix broken link for the Odin language (#23421) 2025-01-21 14:20:54 -05:00
linux.md docs: Mention PopOS 24.04 in Linux FAQ for /etc/prime-discrete (#23482) 2025-01-22 19:37:04 +00:00
model-improvement.md docs: Remove GitHub link from model improvement (#25171) 2025-02-19 16:22:13 +00:00
multibuffers.md Fix a typo in the multi buffers documentation (#18535) 2024-09-30 15:28:46 +03:00
outline-panel.md docs: Add tweaks to the outline panel page (#18697) 2024-10-03 12:27:42 -03:00
remote-development.md Add SSH port forwards to settings (#24474) 2025-02-14 14:52:24 -07:00
repl.md docs: Add tweaks to the REPL page (#18000) 2024-09-18 07:34:39 -03:00
snippets.md Add minimal snippets documentation (#14992) 2024-07-22 21:18:39 -04:00
SUMMARY.md icon_theme_selector: Add footer and related docs (#25042) 2025-02-20 00:02:24 +00:00
system-requirements.md Update macOS system requirements in docs (#22248) 2024-12-19 17:55:46 +00:00
tasks.md Fix up tasks documentation (#24991) 2025-02-17 01:03:29 +00:00
telemetry.md Stop sending data to Clickhouse (#21763) 2024-12-10 08:47:29 -07:00
themes.md docs: Example theme_overrides for docstrings as italic (#19694) 2024-10-24 14:37:57 -04:00
vim.md vim: Add exchange (#24678) 2025-02-22 20:36:21 +00:00
windows.md Fix stale Discord invite links (#21074) 2024-11-22 21:10:51 +00:00
workspace-persistence.md Update workspace persistence doc (#25271) 2025-02-20 12:51:56 -05:00