Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Emacs fixup-whitespaceNew to Visual Studio Code? Get it now.
Emacs fixup-whitespace

Emacs fixup-whitespace

Brad Spencer

|
69 installs
| (0) | Free
A command to emulate Emacs' fixup-whitespace function to collapse whitespace around the cursor.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

emacs-fixup-whitespace

This emulates the behaviour of the versitile fixup-whitespace Emacs command with extra support for Visual Studio Code's features.

Demo

The emacs-fixup-whitespace.fixupWhitespace command deletes all whitespace at, before, and after the cursor. Then, if it finds the cursor not at the start or end of the line, it adds a single space.

Features

  • Quickly collapse whitespace around the cursor into a single space, as shown in the demo above

  • Multiple cursor support.

    Multiple Cursor Demo

  • Multiple cursors can be on the same line. If they're in the same whitespace region, they collapse.

    Multiple Cursor Together Demo

  • Selection is preserved.

    Selection Demo

  • Use it when joining lines to delete the extra whitespace.

    Join Demo

Extension Settings

You must manually add a key binding for the new command. For example:

    {
      "key": "ctrl+f9",
      "command": "emacs-fixup-whitespace.fixupWhitespace",
      "when": "editorFocus && !editorReadonly"
    }

Known Issues

Please report any bugs.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft