Line Arrange

approved

by Chitwan Singh

Shuffle, reverse, or sort lines, using either visual width or lexical order.

7 stars5,664 downloadsUpdated 15d agoMIT
View on GitHub

Line Arrange – Obsidian Plugin

Overview

Line Arrange is an Obsidian plugin that lets you rearrange lines, blocks, or headings in different ways: sorting, reversing, and shuffling. Sorting can be done alphabetically or by visual width (how wide the text looks on screen).


Features

Line Operations

Operate on a flat selection of lines. Hierarchy is ignored; each line is treated individually.

  • Sort lines by width – order by rendered text width

  • Sort lines lexically – order alphabetically (A → Z)

  • Shuffle lines – randomize order

  • Reverse lines – flip order top-to-bottom


Block Operations

Operate on paragraphs, lists, or sections. Block hierarchy (headings, indentation) is preserved.

  • Sort blocks by width – order blocks by their widest line

  • Sort blocks lexically – alphabetical order by first line of block

  • Shuffle blocks – randomize block order while keeping sub-blocks grouped

  • Reverse blocks – flip sibling blocks while preserving nesting


How Block Sorting Works

A block = a top-level line together with all its indented children.

When rearranging blocks:

  • Indented or nested items always stay attached to their parent.
  • Sorting, shuffling, and reversing happen independently at each indentation level.
  • Blank lines within a block selection are discarded.
  • Numbered lists are automatically renumbered after reordering.

Blocks are treated as hierarchical units defined by indentation. The tree structure is preserved — only sibling order changes.

Limitations: Complex elements (horizontal rules, tables, code blocks, deeply nested structures) may not behave as expected.


Heading Operations

Operate only on top-level headings in your selection. The heading itself determines the order; everything beneath each heading (subheadings, paragraphs, lists) stays attached.

  • Sort headings by width – order by rendered heading width
  • Sort headings lexically – alphabetical order by heading text
  • Shuffle headings – randomize heading order
  • Reverse headings – flip heading order

Subheadings and content remain intact under their parent heading. These commands only affect the selected heading level (shallowest).


Usage

  1. Select the lines or blocks you want to arrange.
Select Lines Usage
  1. Run a command using one of the following methods:

Command Palette (Ctrl/Cmd + P)

Open the command palette and run a command such as:

  • Sort lines – arranges lines by visual width.
Sort Lines Usage

Editor Context Menu (Right-Click)

You can also right-click the editor and choose:

Line Arrange >

Then select the desired operation.

Context Menu Usage

List of Commands

Lines

  • Lexisort lines – alphabetically sorts selected lines
  • Reverse lines – reverses line order
  • Sort lines – sorts lines by visual width
  • Shuffle lines – randomizes line order

Headings

  • Lexisort headings – alphabetically sorts top-level headings
  • Reverse headings – reverses heading order
  • Sort headings – sorts headings by visual width
  • Shuffle headings – randomizes heading order

Blocks

  • Lexisort blocks – alphabetically sorts text blocks
  • Reverse blocks – reverses sibling block order
  • Sort blocks – sorts blocks by visual width
  • Shuffle blocks – randomizes block order

Installation

From within Obsidian

  1. Open Settings → Community plugins.
  2. Search for Line Arrange.
  3. Click Install, then Enable.

Manual installation

  1. Download the latest release from GitHub Releases.
  2. Extract into your vault at:
YourVault/.obsidian/plugins/lineArrange
  1. Enable the plugin in Obsidian settings.

Notes

  • Works best in source mode or when selections are clean.
  • Supports configurable locales for lexical sorting (so A–Z order respects your language/region).

Contributing

If you find a bug or have a feature request, open an issue on GitHub.

For plugin developers

Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.