Vim: Make `:w` execute "Save Without Formatting" (or introduce new command)

Created on 14 Jan 2020  Â·  1Comment  Â·  Source: VSCodeVim/Vim

Is your feature request related to a problem? Please describe.

In "real" vim, by default, the command :w saves the document without applying any language-specific formatting rules to the active buffer.

However, in VSCodeVim, :w performs the default Save action (i.e. cmd+s), which formats the document before saving it.

Describe the solution you'd like

VSCode offers a separate action in the command palette called "File: Save without formatting," which will save your file as-is.

It's my opinion that :w should invoke _that_ save method.

Describe alternatives you've considered
So that behavior doesn't change for existing users, perhaps a separate command could be introduced that invokes the "File: Save without formatting" command, for instance: :wwo, (i.e. write without)

Additional context

I've been working with a team on a Javascript project, where all other developers are using Sublime or Atom.

VSCode has an expansive set of formatting rules that are applied on a "regular" file save. It ends up converting things like function(foo) { } into function (foo) {}. These changes are extremely unimportant to me, and to my team. However, I end up saving my work (out of habit) with :w — subtle changes get made that add a ton of bloat to my pull requests, which are a hassle to unwind individually with git add --patch .

kinenhancement

Most helpful comment

Is there a compelling reason you can't disable editor.formatOnSave? Or remap this yourself?

>All comments

Is there a compelling reason you can't disable editor.formatOnSave? Or remap this yourself?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gerardmrk picture gerardmrk  Â·  3Comments

ghost picture ghost  Â·  3Comments

cckowin picture cckowin  Â·  3Comments

ACollectionOfAtoms picture ACollectionOfAtoms  Â·  3Comments

lucastheisen picture lucastheisen  Â·  3Comments