Plugin icon

Selected Line Tools

The commands in Edit > Selected Line Tools and in the editor's right-click menu The commands with the Japanese user interface The settings in Tools > Options > Selected Line Tools

Description

Sort, remove adjacent duplicates, trim, join and wrap the selected lines in the Markdown editor. / Markdown エディタで選択した行の並べ替え、連続した重複行と空白の削除、連結、指定位置での改行を行います。

Additional Information

Links:
Maintainers: akiratamcat
Version:1.0.0
Minimum app version:3.7
Downloads: This version:4
Last updated:2026-11-28T21:43:25Z

Selected Line Tools

Sort, remove adjacent duplicates, trim, join and wrap the selected lines in the Joplin Markdown editor.

Run sort, uniq, trim, paste -s and fold-like operations from a menu without leaving your note. Lines in English, in other languages, or in a mix of languages are all handled with the same rules.

日本語:このページの後半(README.ja.md と同じ内容)

The Selected Line Tools commands in Edit > Selected Line Tools and in the editor's right-click menu

More screenshots: Japanese user interface, settings

The commands with the Japanese user interface

The settings in Tools > Options > Selected Line Tools

Features

  • Sort lines: sort the selected lines in ascending or descending order. Descending order is the exact reverse of ascending order.
  • Remove adjacent duplicate lines: when identical lines follow each other, only the first one is kept (like uniq). Identical lines that are not next to each other are kept.
  • Remove leading or trailing whitespace: remove the whitespace at the start or the end of each line, optionally including full-width spaces.
  • Join lines: join the selected lines into one line, with one space, nothing, or one vertical bar (|) between them.
  • Wrap lines at a set width: break lines that are longer than the width into lines of that width (like fold). The width is counted in half-width equivalents (full-width characters count as 2) or in Unicode characters, and the break is either exactly at the width or after the last whitespace within the width. A character (including emoji sequences) is never split.
  • Works on whole lines: every line that is even partly selected is processed. If the selection ends at the very start of a line, that line is not included.
  • One undo: each command can be undone with a single Undo. If nothing would change, the note is not modified.
  • Settings: choose which commands to add to the right-click menu, the sort comparison (language-independent Unicode collation or code point order), case handling, numeric comparison of digits, which whitespace to remove, the join separator, and the wrap width, how to count it and where to break.
  • The user interface is translated with gettext and follows Joplin's display language. Supported languages (11): English, Japanese, Chinese (Simplified and Traditional), Korean, German, French, Spanish, Italian, Portuguese (Brazil) and Russian.

Installation

Open Joplin's plugin screen (Tools → Options → Plugins on Windows and Linux, Joplin → Settings → Plugins on macOS), search for Selected Line Tools, and install it.

You can also download the .jpl file from GitHub Releases and install it with "Install from file" on the plugin screen. To build the plugin yourself, see CONTRIBUTING.md.

Requirements: Joplin 3.7 or later, desktop (Windows, macOS, Linux). Mobile is not supported.

Usage

  1. Select lines in the Markdown editor.
  2. Choose a command from one of these:
    • Edit > Selected Line Tools
    • the editor's right-click menu, for the commands you turn on in the settings (none by default; they are listed there directly)
    • the command palette
Command What it does
Sort selected lines (ascending) Sorts the selected lines in ascending order
Sort selected lines (descending) Sorts the selected lines in descending order
Remove adjacent duplicate lines Turns each run of identical lines into one line
Remove leading whitespace Removes the whitespace at the start of each line
Remove trailing whitespace Removes the whitespace at the end of each line
Join selected lines Joins the selected lines into one line
Wrap selected lines at the set width Breaks lines longer than the width into lines of that width

Settings

Open Tools > Options > Selected Line Tools.

Setting Options Default
Sort: add "Sort selected lines (ascending)" and "Sort selected lines (descending)" to the right-click menu On / Off Off
Sort: comparison method Unicode collation (language-independent) / Code point order (same as LC_ALL=C sort) Unicode collation
Sort: ignore case On / Off (Unicode collation only) Off
Sort: compare digit sequences as numbers On / Off (Unicode collation only; item2 comes before item10) Off
Remove adjacent duplicate lines: add it to the right-click menu On / Off Off
Remove whitespace: add "Remove leading whitespace" and "Remove trailing whitespace" to the right-click menu On / Off Off
Whitespace to remove All Unicode whitespace (including full-width space) / Space and tab only All Unicode whitespace
Join selected lines: add it to the right-click menu On / Off Off
Join: separator between lines One space / None / One vertical bar (|) One space
Wrap selected lines at the set width: add it to the right-click menu On / Off Off
Wrap: width An integer, 1 or more 80
Wrap: how to count the width Half-width equivalent (full-width characters count as 2) / Unicode characters (every character counts as 1) Half-width equivalent
Wrap: where to break Exactly at the width (like fold -w) / After the last whitespace within the width (like fold -s) Exactly at the width

The right-click menu settings apply the next time you right-click (no restart needed). Joplin's right-click menu cannot have sub-menus, so the commands you turn on are listed there directly.

Good to know

  • With no selection, or with several selections (such as a rectangular selection), nothing happens.
  • The commands do not work in the Rich Text editor; the menu items are disabled there.
  • Unicode collation is the language-independent order of the Unicode Collation Algorithm. Language-specific orders, such as sorting kanji by reading, are not supported.
  • Lines that compare equal (for example Apple and apple when ignoring case) are ordered by code point, so the result is always the same.
  • Markdown formatting is not taken into account. The note is treated as plain text.
    • Removing leading whitespace also removes the indentation of nested lists and indented code blocks.
    • Removing trailing whitespace also removes two trailing spaces used as a hard line break.
    • Lines inside tables, lists and code blocks are sorted as plain lines.
    • Joining and wrapping do not take Markdown structure (list markers, table separators) into account either.
  • In half-width equivalents, characters whose East Asian Width (Unicode 17.0) is Fullwidth (F) or Wide (W) count as 2, Ambiguous (A) characters (such as ○, ① and Greek letters) and tabs count as 1, and zero-width characters such as combining marks count as 0. This can differ from the width shown by your font.
  • Joining does not change the lines. To remove leading or trailing whitespace, use the whitespace commands first.

Reporting problems

Please use the Issues page for bugs, questions and requests. English or Japanese is fine. For security problems, see SECURITY.md. To build the plugin or contribute, see CONTRIBUTING.md.

License

Selected Line Tools is released under the MIT License.

The plugin package contains no third-party software. See THIRD_PARTY_NOTICES.md, which is also included in the plugin package.

AI-assisted development

This plugin is developed with extensive use of generative AI (Anthropic's Claude). A large share of the requirements, design, source code, tests, documentation, and translations was produced with Claude. The maintainer reviews each output step by step, decides what to adopt, and makes corrections as needed. The maintainer is responsible for the final content. If you find a problem, please report it on the Issues page.

日本語

Joplin の Markdown エディタで、選択した行の並べ替え、連続した重複行と空白の削除、連結、指定位置での改行を行うプラグインです。

sort、uniq、trim、paste -s、fold と同じような処理を、ノートを離れずにメニューから実行できます。英語とそれ以外の言語が混ざった行も、同じ規則で処理します。

「編集」→「Selected Line Tools」とエディタの右クリックメニューに並ぶ機能(日本語の表示)

ほかの画面:英語の表示、設定画面

英語の表示

「ツール」→「オプション」→「Selected Line Tools」の設定画面(英語の表示)

機能

  • 行のソート:選択した行を昇順または降順に並べ替えます。降順は、昇順の結果をちょうど逆にした順になります。
  • 連続した重複行の削除:同じ内容の行が続いているとき、最初の 1 行だけを残します(uniq と同じ)。離れた位置にある同じ行は残します。
  • 行頭・行末の空白の削除:各行の先頭または末尾にある空白文字を削除します。全角スペースも対象にできます。
  • 行の連結:選択した行を 1 行につなぎます。行と行の間には、半角スペース 1 個、なし、バーティカルバー(|)1 個のどれかを入れます。
  • 指定位置での改行:指定した長さより長い行を、その長さごとに改行します(fold と同じ)。長さは半角換算(全角の文字は 2)か Unicode 文字単位で数え、改行する位置は「指定した長さの位置」か「指定した長さまでの最後の空白の後ろ」から選べます。1 文字(絵文字なども含む)を途中で分けることはありません。
  • 行の単位で処理:一部でも選択されている行が対象になります。選択の終わりが行の先頭にあるときは、その行は対象になりません。
  • 1 回で元に戻せる:1 回の操作は、1 回の「元に戻す」で戻せます。結果が変わらないときは、ノートを変更しません。
  • 設定:右クリックメニューに追加する機能、ソートの比較方式(言語に依存しない Unicode 照合順、またはコードポイント順)、大文字と小文字の扱い、数字を数値として比べるかどうか、削除する空白の範囲、連結の区切り、改行する長さと数え方と位置の決め方を選べます。
  • 画面の文言は gettext で翻訳しており、Joplin の表示言語に従います。対応している言語(11):英語、日本語、中国語(簡体字・繁体字)、韓国語、ドイツ語、フランス語、スペイン語、イタリア語、ポルトガル語(ブラジル)、ロシア語。

インストール

Joplin のプラグインの画面(Windows と Linux は「ツール」→「オプション」→「プラグイン」、macOS は「Joplin」→「設定」→「プラグイン」)で Selected Line Tools を検索して、インストールします。

GitHub Releases から .jpl ファイルをダウンロードし、プラグインの画面の「ファイルからインストール」で入れることもできます。自分でビルドする方法は CONTRIBUTING.ja.md を見てください。

動作環境:Joplin 3.7 以降のデスクトップ版(Windows、macOS、Linux)。モバイル版には対応していません。

使い方

  1. Markdown エディタで、処理したい行を選択します。
  2. 次のどれかで機能を選びます。
    • 「編集」→「Selected Line Tools」
    • エディタの上で右クリックして表示されるメニュー(設定でオンにした機能だけが直接並びます。初期状態では何も追加しません)
    • コマンドパレット
機能 内容
選択行を昇順にソート 選択した行を昇順に並べ替えます
選択行を降順にソート 選択した行を降順に並べ替えます
連続した重複行を削除 続いている同じ行を 1 行にします
行頭の空白文字を削除 各行の先頭の空白を削除します
行末の空白文字を削除 各行の末尾の空白を削除します
選択行を連結 選択した行を 1 行につなぎます
選択行を指定位置で改行 指定した長さより長い行を、その長さごとに改行します

設定

「ツール」→「オプション」→「Selected Line Tools」で変えられます。

設定 選択肢 初期値
ソート:「選択行を昇順にソート」「選択行を降順にソート」を右クリックメニューに追加する オン/オフ オフ
ソート:比較方式 Unicode 照合順(言語に依存しない)/コードポイント順(LC_ALL=C sort と同じ) Unicode 照合順
ソート:大文字と小文字を区別しない オン/オフ(Unicode 照合順のときだけ有効) オフ
ソート:数字の並びを数値として比べる オン/オフ(Unicode 照合順のときだけ有効。item2 を item10 より前に置く) オフ
連続した重複行を削除:右クリックメニューに追加する オン/オフ オフ
空白文字を削除:「行頭の空白文字を削除」「行末の空白文字を削除」を右クリックメニューに追加する オン/オフ オフ
削除する空白文字 Unicode の空白すべて(全角スペースを含む)/半角スペースとタブだけ Unicode の空白すべて
選択行を連結:右クリックメニューに追加する オン/オフ オフ
連結:行と行の間に入れる文字 半角スペース 1 個/なし/バーティカルバー 1 個(|) 半角スペース 1 個
選択行を指定位置で改行:右クリックメニューに追加する オン/オフ オフ
改行:位置(1 行の長さ) 1 以上の整数 80
改行:長さの数え方 半角換算(全角の文字は 2 と数える)/Unicode 文字単位(どの文字も 1 と数える) 半角換算
改行:改行する位置の決め方 指定した長さの位置(fold -w と同じ)/指定した長さまでの最後の空白の後ろ(fold -s と同じ) 指定した長さの位置

右クリックメニューの設定は、次に右クリックしたときから反映されます(再起動はいりません)。Joplin の右クリックメニューには下の階層を作れないため、オンにした機能はメニューに直接並びます。

知っておくとよいこと

  • 何も選択していないとき、または複数の範囲を選択しているとき(矩形選択など)は、何もしません。
  • リッチテキストエディタでは使えません。メニューは無効(グレー表示)になります。
  • Unicode 照合順は、言語に依存しない標準の順(Unicode Collation Algorithm)です。漢字の読みの順や、言語ごとの辞書順には並べません。
  • 比較で等しくなる行(大文字と小文字を区別しないときの Apple と apple など)は、コードポイント順で順番を決めます。そのため、結果はいつも同じになります。
  • Markdown の書式は考慮しません。 ノートをただのテキストとして処理します。
    • 行頭の空白を削除すると、入れ子のリストやインデントしたコードブロックの字下げも消えます。
    • 行末の空白を削除すると、行末の 2 つのスペースによる強制改行も消えます。
    • 表、リスト、コードブロックの中の行も、ただの行として並べ替えます。
    • 連結や改行でも、Markdown の構造(リストの記号、表の区切りなど)は考慮しません。
  • 半角換算では、East Asian Width(Unicode 17.0)が全角(F)と広(W)の文字を 2、曖昧(A)の文字(○、①、ギリシャ文字など)とタブを 1、結合文字などの幅のない文字を 0 と数えます。お使いのフォントでの見た目の幅とは、ずれることがあります。
  • 連結では、行の内容は変えません。行頭や行末の空白を取り除きたいときは、先に空白の削除を使ってください。

問題の報告

不具合、質問、要望は Issues にお寄せください。日本語でも英語でもかまいません。セキュリティの問題は SECURITY.ja.md を見てください。ビルドや開発への参加は CONTRIBUTING.ja.md を見てください。

ライセンス

Selected Line Tools は MIT ライセンスで公開しています。

プラグインのパッケージには、サードパーティのソフトウェアは入っていません。詳しくは THIRD_PARTY_NOTICES.ja.md を見てください(このファイルはプラグインのパッケージにも同梱しています)。

生成 AI の利用について

本プラグインは、生成 AI(Anthropic の Claude)を全面的に用いて開発しています。 要件書、設計書、ソースコード、テスト、ドキュメント、翻訳のかなりの部分を Claude で作成しました。 作者が Claude の出力を逐次確認し、採用するかどうかの判断と修正を行っており、 最終的な内容の責任は作者が負います。問題を見つけた場合は Issue でお知らせください。