Replace Commands

by elowry
5
4
3
2
1
Score: 35/100

Description

This plugin has not been manually reviewed by Obsidian staff. Preconfigure custom search and replace actions using plain text or regex to quickly modify selections or documents.

Reviews

No reviews yet.

Stats

stars
72
downloads
0
forks
1
days
NaN
days
NaN
days
0
total PRs
0
open PRs
0
closed PRs
0
merged PRs
0
total issues
0
open issues
0
closed issues
0
commits

Latest Version

Invalid date

Changelog

README file from

Github

Replace Commands

License: 0-BSD Latest GitHub release

An Obsidian plugin that lets you preconfigure custom search and replace actions using plain text or regex to quickly modify selections or documents.

Whether you need to quickly clean up messy OCR text, standardize markdown formatting, or chain complex regex replacements, this plugin lets you save those sequences as single-click actions.

Features

  • Custom Actions: Create named actions (e.g., "Clean OCR", "Format Tables") that contain one or more search/replace rules.
  • Live Preview Test Bench: Instantly test your rules in settings using a real-time preview. Each rule shows its step-by-step intermediate output before giving the final result.
  • Sequential Processing & Reordering: Chain multiple rules perfectly and easily rearrange their execution order directly in the UI.
  • Smart Targeting: If you highlight text, the action only applies to your selection. If nothing is selected, it applies to the entire document.
  • Single-Step Undo: No matter how many rules are in your action, they are applied as a single atomic transaction. One press of Ctrl+Z undoes the entire operation.
  • Regex & Capture Groups: Full support for JavaScript Regular Expressions. Use capture groups (e.g., $1, $2) in your replacement strings.
  • Custom Regex Flags: Easily add flags like i (case-insensitive) or m (multiline) to your regex rules.
  • Plaintext Escapes: If you turn regex off, you can still search for \n (newlines) and \t (tabs) in plaintext mode.
  • Easy Access: Run your actions directly from the Obsidian Command Palette (Ctrl/Cmd + P), or add them to the right-click Editor Context Menu.

How to Use

  1. Configure an Action: - Go to Settings -> Replace Commands.
    • Click Add new action and give it a name (Example: "Fix spacing").
    • Add your search and replace terms. Toggle "Use regex" if you are using regular expressions.
  2. Apply to Text:
    • Open any note in Obsidian.
    • Targeted: Highlight a specific block of text to only apply the replacement to your selection.
    • Document-wide: Leave your cursor unselected to apply the replacement to the entire note.
  3. Execute:
    • Right-click the editor and select your action from the Custom replace context menu.
    • Alternatively: Open the Command Palette (Ctrl/Cmd + P), type your action's name, and hit Enter.
  4. Undo:
    • Made a mistake? Press Ctrl/Cmd + Z once to undo the entire action instantly.

Installation

  1. Open Obsidian and navigate to Settings → Community plugins.
  2. If Restricted mode is enabled, click Turn off to allow third-party plugins.
  3. Click Browse and search for Replace Commands.
  4. Click Install, and then click Enable.

Manually installing the plugin

To install the plugin manually from GitHub:

  1. Download the latest release from the GitHub Releases page.
  2. Extract the files and copy main.js, manifest.json, and styles.css to your vault at YourVaultFolder/.obsidian/plugins/replace-commands/.
  3. Open Obsidian, go to Settings → Community plugins, and toggle on Replace Commands.

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for details on how to set up the development environment and the contribution guidelines.