Skip to content

Copy and trim collapses newlines in vim mode #48869

@everdrone

Description

@everdrone

Reproduction steps

  1. Open a rust file with the following code:
pub fn no_indentation() {
    todo!()
}

impl WithIndentation {
    pub fn example() {
        todo!()
    }
    
    pub fn after_whitespace() {
        todo!()
    }
}
  1. set "vim_mode": true
  2. move to pub fn after_whitespace() {
  3. use j twice expand the selection downwards, up to the function's closing brace }
  4. cmd-shift-p, copy and trim
  5. cmd-n for a new buffer
  6. p will paste the following: `pub fn after_whitespace() { todo!()}

With "vim_mode": false I didn't notice any issue.

repro.mp4

Current vs. Expected behavior

Current behavior: pasted text doesn't have newlines
Expected behavior: pasted text is just trimmed and newlines are preserved

Zed version and system specs

Zed: v0.222.4+stable.147.b385025df963c9e8c3f74cc4dadb1c4b29b3c6f0 (Zed)
OS: macOS 15.7
Memory: 16 GiB
Architecture: aarch64

Attach Zed log file

Zed.log

Relevant Zed settings

settings.json

Relevant Keymap

keymap.json

(for AI issues) Model provider details

No response

If you are using WSL on Windows, what flavor of Linux are you using?

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:parity/vimFeedback for Vim parity featuresfrequency:alwaysBug that happens for everyone on every platform no matter how they use Zedpriority:P3Papercuts, minor issues with a clear workaround, cosmetic bugsstate:reproducibleVerified steps to reproduce included and someone on the team managed to reproduce

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions