https://github.com/usernamehw/vscode-remove-empty-lines
Extension for VSCode to remove empty lines from the document.
https://github.com/usernamehw/vscode-remove-empty-lines
formatter remove-empty-lines vscode-extension
Last synced: about 1 year ago
JSON representation
Extension for VSCode to remove empty lines from the document.
- Host: GitHub
- URL: https://github.com/usernamehw/vscode-remove-empty-lines
- Owner: usernamehw
- License: mit
- Created: 2018-12-07T19:11:17.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-02-28T10:10:33.000Z (over 3 years ago)
- Last Synced: 2025-03-18T12:01:48.421Z (about 1 year ago)
- Topics: formatter, remove-empty-lines, vscode-extension
- Language: TypeScript
- Homepage: https://marketplace.visualstudio.com/items?itemName=usernamehw.remove-empty-lines
- Size: 1.38 MB
- Stars: 12
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://marketplace.visualstudio.com/items?itemName=usernamehw.remove-empty-lines)
[](https://marketplace.visualstudio.com/items?itemName=usernamehw.remove-empty-lines)
[](https://marketplace.visualstudio.com/items?itemName=usernamehw.remove-empty-lines)
### Provides 2 commands
* `remove-empty-lines.inDocument` - Removes empty lines in the entire document
* `remove-empty-lines.inSelection` - Removes empty lines in selection. Can be used without selection (will remove all adjacent empty lines)

## Settings (3)
|Setting|Default|Description|
|-|-|-|
|remove-empty-lines.allowedNumberOfEmptyLines|**0**|Number of allowed consecutive empty lines.|
|remove-empty-lines.runOnSave|**false**|Run remove empty lines on document save event.|
|remove-empty-lines.onSaveReason|\{"manual":true,"afterDelay":false,"focusOut":false\}|Controls which save event triggers running the extension (for `#remove-empty-lines.runOnSave#` setting).|
Example: `"remove-empty-lines.allowedNumberOfEmptyLines": 1,`

## Per language setting:
```js
"remove-empty-lines.allowedNumberOfEmptyLines": 0,// allow 0 in all files
"[markdown]": {
"remove-empty-lines.allowedNumberOfEmptyLines": 1,// allow 1 in markdown files
},
```
# ⚠⚠⚠ Extension doesn't define any keyboard shortcuts
[📚 How to open keybindings.json =======>](https://stackoverflow.com/a/45384050/5590193)
### DEMO: Pass allowed number of empty lines as arguments in `keybindings.json`
```js
{
"key": "ctrl+shift+9",
"command": "remove-empty-lines.inDocument",
"args": 0
},
{
"key": "ctrl+shift+9",
"command": "remove-empty-lines.inSelection",
"when": "editorHasSelection",
"args": 0
},
{
"key": "ctrl+shift+8",
"command": "remove-empty-lines.inDocument",
"args": 1
},
{
"key": "ctrl+shift+8",
"command": "remove-empty-lines.inSelection",
"when": "editorHasSelection",
"args": 1
},
```