Sort, deduplicate, reverse, shuffle, and clean up lines without leaving the editor.
Features
Linetidy adds six line-wrangling commands:
Linetidy: Sort Lines (A→Z) — sort the lines alphabetically, ascending.
Linetidy: Sort Lines (Z→A) — sort the lines alphabetically, descending.
Linetidy: Remove Duplicate Lines — keep the first occurrence of each line and drop the rest, preserving order.
Linetidy: Reverse Lines — flip the line order top to bottom.
Linetidy: Shuffle Lines — randomly reorder the lines.
Linetidy: Remove Blank Lines — delete lines that are empty or whitespace-only.
Sorting and duplicate detection are case-insensitive by default. Set linetidy.caseSensitive to true in your settings to compare lines with case taken into account.
Usage
Open a file and (optionally) select the lines you want to act on. A partial selection is automatically expanded to cover whole lines.
Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P).
Type Linetidy and pick the command you want.
If nothing is selected, the command runs on the entire document. With a selection, it runs only on the selected lines.
Settings
linetidy.caseSensitive (boolean, default false) — controls whether sorting and duplicate detection are case-sensitive.
License
Released under the MIT License. See the LICENSE file for details.