Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply Vim Macros on Selection / Range #21198

Open
1 task done
equt opened this issue Nov 26, 2024 · 1 comment
Open
1 task done

Apply Vim Macros on Selection / Range #21198

equt opened this issue Nov 26, 2024 · 1 comment
Labels
enhancement [core label] vim

Comments

@equt
Copy link

equt commented Nov 26, 2024

Check for existing issues

  • Completed

Describe the feature

By using the normal command in Vim, it is possible to apply the macro on the selection lines or a specific range.

:5,10norm! @a

would execute the macro stored in register a on lines 5 through 10 (quoted from the Stack Overflow answer).

Since Zed open command palette on colon instead, a command like apply macro to selection should help.

Environment

Zed: v0.162.5 (Zed)
OS: macOS 15.1.1
Memory: 64 GiB
Architecture: aarch64

If applicable, add mockups / screenshots to help present your vision of the feature

No response

@equt equt added admin read Pending admin review enhancement [core label] triage Maintainer needs to classify the issue labels Nov 26, 2024
@notpeter notpeter added vim and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Nov 26, 2024
@ConradIrwin
Copy link
Member

Thanks for reporting! If you'd like to pair with me on a fix: https://calendly.com/ConradIrwin/pairing

I think it's not too hard to add :norm, the main question is how to interpret what the user writes after it.

  • Use Zed's
  • Use Vim's
  • Use a best-effort mashup of the two.

The advantage of Vim's is that it's shorter (and vim users are familiar with it), but it's a bit inconsistent with how we do everything else.

The primary disadvantage of zed's is that it requires a space between each character.

Maybe the mix up that makes most sense is:

  • Individual characters are treated as themselves, like vim; so no spaces are needed.
  • <> is used to wrap keys with modifiers.
  • We support both <C-X>, <S-X>, vim-style, and <ctrl-X>, <alt-X> zed-style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement [core label] vim
Projects
None yet
Development

No branches or pull requests

3 participants