Line Editing Commands

approvedunreviewed

by siulved54

Duplicate, join, sort, reverse and clean up lines, insert blank lines and jump to a line number, with multi-cursor support.

↓ 71 downloadsUpdated 5d agoMIT

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.

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

CommandWhat it does
Duplicate line or selection down / upCopies 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 / aboveAdds 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 linesJoins 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 linesReverses the order of the selected lines.
Remove duplicate lines in selectionKeeps the first of each repeated line.
Delete to line start / endDeletes 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 occurrenceWith 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 occurrencesSelects every occurrence of the selected text, or of the word at the cursor.
Skip this occurrence and select the nextSwaps the selection you added last for the next occurrence.
Add cursor above / belowAdds 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 cursorDrops every other cursor and selection.
Go to line numberOpens 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:

CommandSuggestion
Duplicate line down / upCtrl+Shift+D / Ctrl+Alt+Shift+D
Join linesCtrl+J
Select lineCtrl+L
Go to line numberCtrl+G
Select word or next occurrenceCtrl+D
Select all occurrencesCtrl+Shift+L
Skip this occurrence and select the nextCtrl+Alt+D
Add cursor above / belowCtrl+Alt+Up / Ctrl+Alt+Down
Keep only the main cursorCtrl+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

PluginWhat it doesSource
Shared BlocksWrite 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 CleanupChange 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 TypeCurly quotes, dashes and ellipses as you type, kept out of code and maths, with Backspace to take one back.smart-typography-plugin
Section NumberingNumber headings as an outline (1, 1.1, 1.2) and keep every link to them working when they renumber.section-numbering
Spreadsheet to TablePaste 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 NumbersRelative and hybrid line numbers for Vim-style jumps, where a folded section counts as one line.hybrid-line-numbers
List Item CalloutsColour a single list item as a callout by starting it with a character such as &, ! or ?.list-item-callouts
Folder CountsSee how many notes or files each folder holds, right in the file explorer, with a vault total and folder exclusions.folder-counts
Note Reading TimeReading time of the current note or your selection in the status bar, optionally saved to a property.note-reading-time
Task RolloverRoll unfinished tasks from your last daily note into today's when it is created, with a real undo.task-rollover
Zoom Into SectionZoom 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 PastePaste 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 RadarChecks your installed community plugins for updates in the background, shows what changed, and flags the ones that look abandoned.community-update-checker
Dataview to BasesConvert Dataview queries into Bases blocks, and see which queries in your vault can be converted.dataview-to-bases
Note Mover RulesMove notes into folders by ordered rules on tags, properties, titles and paths, with a preview before any bulk move.note-mover-rules
Tab HistoryKeeps each tab's back and forward history across restarts, and adds commands to move, maximize and close tabs.tab-history
URL CardsShows web addresses as cards with title, description and image, and reads existing cardlink blocks.url-cards
Vim ConfigLoads a vimrc-style file from your vault so your key mappings and editor commands are ready when vim mode starts.vim-config
Task ArchiveMoves completed tasks, with their sub-items, into an archive section or note.task-archive

All of them are in the community directory: Settings -> Community plugins -> Browse, then search for the name.

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.