Skip to content

Vim Mode :w interferes with format-on-save & autosave on focus loss #28732

@Sushisource

Description

@Sushisource

Summary

When using :w to save in vim mode, the : triggers the vim command modal, which causes the buffer to save, which formats, and then the vim save command interferes with the newly-written buffer.

Description

I have seen this with both Python & ruff, and with Typescript/prettier. The behavior is timing sensitive. If you do the :w fast enough, or slow enough, things work. You seemingly have to time it such that you wait for the auto-format to happen after you type : but then you need to do w<enter> immediately after that.

Steps to reproduce:

  1. Use the "autosave": "on_focus_change" setting along with "format_on_save": "on" for any language server
  2. Try to save a buffer with :w
  3. You can trigger a "This file has changed on disk since you started editing it..."

Expected Behavior: No saving conflicts
Actual Behavior: Saving conflicts

Zed Version and System Specs

Zed: v0.181.5 (Zed)
OS: Linux Wayland arch unknown
Memory: 62.6 GiB
Architecture: x86_64
GPU: NVIDIA GeForce RTX 2070 SUPER || NVIDIA || 570.133.07

Metadata

Metadata

Assignees

Labels

area:parity/vimFeedback for Vim parity featuresstate:reproducibleVerified steps to reproduce included and someone on the team managed to reproduce

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions