Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Delete blank lines for VS CodeNew to Visual Studio Code? Get it now.
Delete blank lines for VS Code

Delete blank lines for VS Code

Ömer Kasapoğlu

|
2 installs
| (0) | Free
port of emacs delete-blank-lines command, trim blank lines till next block
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Delete Blank Lines for VS Code

A VS Code extension inspired by Emacs' delete-blank-lines command.
Trim multiple consecutive blank lines.

![first call](https://github.com/oakasapoglu/delete-blank-lines-for-vscode/raw/HEAD/<images/first call.gif>)


Features

Trim Blank Lines / Delete Blank Lines

  • Behavior:
    • Cursor on a blank line: collapses contiguous blank lines to one.
    • If the blank line is isolated, deletes it.
    • Cursor on a non-blank line: deletes all immediately following blank lines.

Delete consecutive blank lines

![first call](https://github.com/oakasapoglu/delete-blank-lines-for-vscode/raw/HEAD/<images/first call.gif>)

If there is just only one blank line, delete it.

![alt text](https://github.com/oakasapoglu/delete-blank-lines-for-vscode/raw/HEAD/<images/second call.gif>)

On a non empty line, delete all blank lines under

![alt text](https://github.com/oakasapoglu/delete-blank-lines-for-vscode/raw/HEAD/<images/non-empty line.gif>)

Cut Line to Clipboard

  • Behavior:
    • Cuts the current line including newline.

![alt text](https://github.com/oakasapoglu/delete-blank-lines-for-vscode/raw/HEAD/<images/cut line.gif>)

Commands & Keybindings

Function Command Keybinding Description
Trim / Delete Blank Lines delete-blank-lines-for-vscode.trim Ctrl+Shift+Backspace Trim blank lines around cursor: collapse blocks or remove isolated blank lines.
Cut Line to Clipboard delete-blank-lines-for-vscode.cutLine Shift+Backspace Cut current line and append to clipboard if consecutive.

Note: The “Trim Blank Lines” and “Delete Blank Lines” commands are the same function.

Commands & Keybindings

Function Command Keybinding
Delete Blank Lines delete-blank-lines-for-vscode.trim Ctrl+Shift+Backspace
Trim Blank Lines delete-blank-lines-for-vscode.trim Ctrl+Shift+Backspace
Cut Line to Clipboard delete-blank-lines-for-vscode.cutLine Shift+Backspace

⚠️ Note: “Trim Blank Lines” and “Delete Blank Lines” are two labels for the same function. Both uses delete-blank-lines-for-vscode.trim for their implementation.

Trim Blank Lines / Delete Blank Lines

Collapses contiguous blank lines into one, deletes isolated blank lines, or removes all immediately following blank lines if the cursor is on a non-blank line.

Cut Line to Clipboard

Cuts the current line and copies it to the clipboard.


Installation

  1. Open VS Code.
  2. Go to Extensions (Cmd+Shift+X).
  3. Search for Delete Blank Lines for VS Code.
  4. Click Install.
  5. Use the commands via keyboard shortcuts or Command Palette.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft