Skip to content

Repository files navigation

Sort & Unique Lines

A VS Code extension that sorts and removes duplicate lines instantly. Select specific lines or leave unselected to process the entire file, then press Alt+W.

Package mgr · Bun Language · TypeScript Lint · Biome VS Code Marketplace

Requirements

VS Code 1.130 or newer. Older builds will not list or install this extension.

Installation

From Marketplace

Install from VS Code Marketplace

Or search "Sort & Unique Lines" in the Extensions view (Ctrl+Shift+X).

From VSIX

Download the .vsix file from releases, then:

code --install-extension sort-unique-lines-1.2.0.vsix

From Source

git clone https://github.com/LabinatorSolutions/sort-unique-lines.git
cd sort-unique-lines
bun install
bun run compile
bun run package
code --install-extension sort-unique-lines-*.vsix

Usage

  1. Select lines in any editor (or select nothing to process the entire file)
  2. Press Alt+W
  3. The selection is replaced with sorted, deduplicated lines
  4. Undo with Ctrl+Z as usual

With multiple cursors, every selection is sorted independently in a single undo step. Selections that land on the same lines are merged first.

Features

  • Sorts lines ascending or descending
  • Removes duplicate lines (case-insensitive dedup by default)
  • Trims leading/trailing whitespace (configurable)
  • Strips blank lines (configurable)
  • Case-sensitive mode available
  • Works on a selection, several multi-cursor selections, or the entire file
  • Settings are language-overridable, so .txt can behave differently from source files
  • Zero runtime dependencies

Configuration

All settings live under File > Preferences > Settings → search "Sort & Unique Lines".

Setting Type Default Description
sort-unique-lines.sortOrder "ascending" | "descending" "ascending" Sort direction
sort-unique-lines.caseSensitive boolean false Treat uppercase/lowercase as different
sort-unique-lines.removeBlankLines boolean true Strip empty and whitespace-only lines
sort-unique-lines.trimLines boolean true Trim whitespace from each line before sorting

All four are language-overridable — scope them per language with a "[markdown]": { ... } block in your settings.

Keybinding

Default: Alt+W
Change it in File > Preferences > Keyboard Shortcuts → search "Sort & Unique Lines".

Development

bun install          # install dependencies
bun run compile      # compile TypeScript → out/
bun test             # run unit tests
bun run lint         # lint with Biome
bun run format       # format with Biome
bun run ci           # lint + format check, no writes (used in CI)
bun run package      # build .vsix
bun run build        # format, lint, compile, test, package

Requires Bun.

Built with Bun + TypeScript + Biome. Zero runtime dependencies.

Credits

Built by Labinator.

Powered by Bun, TypeScript, and Biome.

License

AGPL-3.0

About

A VS Code extension that sorts and removes duplicate lines instantly. Select specific lines or leave unselected to process the entire file, then press Alt+W.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Contributors

Languages