spacemod

A text search-and-replace tool optimized for code refactoring

Download

Get the latest version of spacemod from our releases page:

Download from Codeberg Releases

What is spacemod?

spacemod is a text search-and-replace tool optimized towards refactoring code. It features a custom pattern-matching language that makes it easier to deal with whitespace and provides an interactive TUI for reviewing changes.

Example Usage

# Use spacemod's custom pattern-matching language to deal with whitespace easier.
# Without -S, normal regex patterns are assumed.

$ spacemod -S \
  'copy_file ( to_file= (.*) , from_file= (.*) )' \
  'copy_file($2, $1)' \
  example.py

# spacemod will open interactive TUI and ask for approval of diffs. Use
# --accept-all to use spacemod non-interactively.