Line Editing Commands

by siulved54
5
4
3
2
1
Score: 50/100

Description

Obsidian: duplicate, join, sort, reverse lines, insert blank lines, go to line, multi-cursor aware.

Reviews

No reviews yet.

Stats

3
stars
530
downloads
0
forks
48
days
6
days
40
days
18
total PRs
0
open PRs
0
closed PRs
18
merged PRs
0
total issues
0
open issues
0
closed issues
20
commits

Latest Version

a month ago

Changelog

  • “Join lines” with a cursor on each of the last two lines now joins the one above.
  • After “Sort” or “Reverse” moves an empty line to the end of the block, running the command again works on the same lines.

README file from

Github

Line Editing Commands

Line-level editing commands for Obsidian's editor: duplicate, join, sort, reverse, insert blank lines, select a line, delete to the start or end of a line, jump to a line number, and build multiple cursors the way code editors do (select next occurrence, select all, skip, add cursor above or below). Every command works with several cursors at once, and a single Undo reverts it.

Sorting selected lines A to Z with Line Editing Commands

Obsidian already has commands to swap a line up or down, delete a paragraph and toggle lists, so this plugin only adds what is missing.

Commands

Command What it does
Duplicate line or selection down / up Copies the selected lines (or the line with the cursor) below or above. Down moves your selection to the copy; up keeps it on the upper copy.
Insert blank line below / above Adds an empty line next to the cursor's line, keeping its indentation, and puts the cursor on it.
Select line (repeat to extend) Selects the whole line. Run it again to add the next line.
Join lines Joins the cursor's line with the next one, or all selected lines, with a single space. The indentation of each joined line is dropped; empty lines are skipped.
Sort selected lines (A to Z) / (Z to A) Sorts the selected lines. Ignores case and compares numbers by value, so item2 comes before item10.
Reverse selected lines Reverses the order of the selected lines.
Remove duplicate lines in selection Keeps the first of each repeated line.
Delete to line start / end Deletes from the cursor to the start or end of its line. It works from the cursor position (the end of a selection that was dragged), so a selection itself is not deleted.
Select word or next occurrence With no selection, selects the word at each cursor. With a selection, adds the next place with the same text (case-sensitive, wrapping around the note) as a new selection and scrolls to it. Repeat to keep adding.
Select all occurrences Selects every occurrence of the selected text, or of the word at the cursor.
Skip this occurrence and select the next Swaps the selection you added last for the next occurrence.
Add cursor above / below Adds a cursor on the line above or below each cursor, at the same column (or at the end of a shorter line).
Keep only the main cursor Drops every other cursor and selection.
Go to line number Opens a small window. Type 42 or 42:7 (line and column). A number past the end goes to the last line.

The cursor commands only move selections; they never change the note. Letters of any script count as word characters, as do digits and _.

Sort, reverse and remove-duplicates need a selection that spans more than one line; they never touch a single line. A selection that ends at the very start of a line does not include that line. Where several cursors share a line, that line is edited once.

There are no default hotkeys, so nothing clashes with your own. Assign them in Settings → Hotkeys. Suggested starting points, if you are coming from other editors:

Command Suggestion
Duplicate line down / up Ctrl+Shift+D / Ctrl+Alt+Shift+D
Join lines Ctrl+J
Select line Ctrl+L
Go to line number Ctrl+G
Select word or next occurrence Ctrl+D
Select all occurrences Ctrl+Shift+L
Skip this occurrence and select the next Ctrl+Alt+D
Add cursor above / below Ctrl+Alt+Up / Ctrl+Alt+Down
Keep only the main cursor Ctrl+Alt+Shift+M

Notes

  • Nothing is sent over the network and the plugin has no settings.
  • It works in the editor only (Source mode and Live Preview), on desktop and mobile.

Installation

In Obsidian, open Settings → Community plugins → Browse and search for "Line Editing Commands".

More plugins by Siulved54

Plugin What it does Source
Shared Blocks Write a block of text once and reuse it in any note. Edit the source and every reference re-renders live. shared-blocks
Text Case and Cleanup Change case, make camelCase or slugs, sort lines and remove duplicates, and repair text pasted out of a PDF, without touching code or URLs. text-format
Typography as You Type Curly quotes, dashes and ellipses as you type, kept out of code and maths, with Backspace to take one back. smart-typography-plugin
Section Numbering Number headings as an outline (1, 1.1, 1.2) and keep every link to them working when they renumber. section-numbering
Spreadsheet to Table Paste cells from Excel or Google Sheets as a Markdown table with a real header, insert CSV files, and copy tables back out. spreadsheet-to-table
Hybrid Line Numbers Relative and hybrid line numbers for Vim-style jumps, where a folded section counts as one line. hybrid-line-numbers
List Item Callouts Colour a single list item as a callout by starting it with a character such as &, ! or ?. list-item-callouts
Folder Counts See how many notes or files each folder holds, right in the file explorer, with a vault total and folder exclusions. folder-counts
Note Reading Time Reading time of the current note or your selection in the status bar, optionally saved to a property. note-reading-time
Task Rollover Roll unfinished tasks from your last daily note into today's when it is created, with a real undo. task-rollover
Zoom Into Section Zoom into a heading or list item to see only it and its contents, with a breadcrumb bar to climb back out. zoom-into-section
Link Title on Paste Paste a web address and get a Markdown link with the page's title, fetched in the background and undone in one step. link-title-on-paste
Update Radar Checks your installed community plugins for updates in the background, shows what changed, and flags the ones that look abandoned. community-update-checker
Dataview to Bases Convert Dataview queries into Bases blocks, and see which queries in your vault can be converted. dataview-to-bases
Note Mover Rules Move notes into folders by ordered rules on tags, properties, titles and paths, with a preview before any bulk move. note-mover-rules
Tab History Keeps each tab's back and forward history across restarts, and adds commands to move, maximize and close tabs. tab-history
URL Cards Shows web addresses as cards with title, description and image, and reads existing cardlink blocks. url-cards
Vim Config Loads a vimrc-style file from your vault so your key mappings and editor commands are ready when vim mode starts. vim-config
Task Archive Moves completed tasks, with their sub-items, into an archive section or note. task-archive
Revisit Later Link the current note into a future daily note, with a date typed in plain English, so it comes back when you want to review it. revisit-later
Explorer Colors Plus Color files and folders in the file explorer, with a palette, cascading to children, and import from File Color. explorer-colors-plus
Book Lookup Create book notes from Open Library or Google Books, with cover images, ISBN search and Book Search compatible templates. book-lookup
Web Search Menu Search the web for selected text or the note title from the right-click menu, with engines you define. web-search-menu
Word Lookup Look up any word in a sidebar dictionary with definitions, phonetics, synonyms and antonyms, or create a note for it. word-lookup
Quick Translate Translate the selection or a whole note into another language with no account, keeping links, code and front matter untouched. quick-translate
Dice Rolls Inline dice rolls you click to reroll, in Live Preview and Reading view, with full dice notation, a roll dialog and a roll history. Reads Dice Roller notes. dice-rolls
Claude Studio Notion-style AI writing, chat and vault tools powered by your local Claude Code CLI. claude-studio
Book Studio Turn notes into a print-ready paperback PDF and an EPUB 3, entirely on your device. book-studio
Emoji Search Insert emojis from a searchable picker or by typing a :shortcode. emoji-search
Inline TOC Show a live table of contents inside any note with a toc code block, or insert a plain Markdown one. inline-toc

All of them are in the community directory: Settings -> Community plugins -> Browse, then search for the name. Demos and install links for every one: the catalog.

Follow new plugins and updates on X: @luenpereza