Skip to content

Serpl Commands

Comprehensive Serpl terminal UI commands for project-wide search and replace operations.

Installation

CommandDescription
cargo install serplInstall via Cargo (Rust)
brew install serplInstall via Homebrew (macOS)
nix-env -i serplInstall via Nix
pacman -S serplInstall on Arch Linux
Download from GitHub ReleasesPre-built binaries available
serpl --versionShow Serpl version

Basic Usage

CommandDescription
serplLaunch Serpl in current directory
serpl --search-text "oldFunc"Launch with pre-filled search term
serpl --replace-text "newFunc"Launch with pre-filled replacement
serpl --search-path ./srcSearch in specific directory
serpl --hiddenInclude hidden files in search
serpl --ignore-caseCase-insensitive search
ShortcutDescription
jMove down in results list
kMove up in results list
gJump to first result
GJump to last result
/Search within results list
EnterSelect/confirm action
EscapeCancel/go back
qQuit Serpl

Mode Switching

ShortcutDescription
TabSwitch between search and replace fields
Ctrl + NToggle between search and replace modes
Ctrl + BOpen help dialog
Ctrl + CQuit application

Search Operations

ShortcutDescription
Type in search fieldLive search across all files
Ctrl + NToggle search mode
Case-sensitive modeMatch exact case
Case-insensitive modeIgnore case differences
Regex modeUse regular expressions
AST Grep modeStructural code search

Replace Operations

ShortcutDescription
Ctrl + OProcess replace for ALL files
dDelete selected file or line from results
Simple replaceReplace all occurrences directly
Preserve case replaceMaintain original casing pattern
AST Grep replaceStructural code replacement

Replace Modes

ModeDescription
SimpleDirect text replacement
Preserve CaseMatches case pattern of original text
AST GrepSyntax-tree-aware replacement

Search Modes

ModeDescription
Fixed StringLiteral text matching
RegexRegular expression matching
AST GrepStructural code pattern matching

File Operations

ShortcutDescription
dRemove file/line from results (skip)
Ctrl + OApply replacements to all remaining files
Review changes per fileSee preview before applying
Undo is not availableChanges are permanent—use Git

Configuration

SettingDescription
~/.config/serpl/config.jsonConfiguration file location
Custom key bindingsOverride default shortcuts
Search mode defaultSet preferred search mode
Replace mode defaultSet preferred replace mode
File pattern filtersConfigure which files to include
Ignore patternsConfigure which files to exclude

Example Configuration

{
  "key_bindings": {
    "quit": "q",
    "navigate_up": "k",
    "navigate_down": "j",
    "go_to_top": "g",
    "go_to_bottom": "G",
    "delete": "d",
    "process_replace": "Ctrl+o",
    "toggle_help": "Ctrl+b",
    "search_in_list": "/"
  },
  "search_mode": "fixed_string",
  "replace_mode": "simple"
}

Common Workflows

WorkflowDescription
Rename variableSearch old name → Replace with new name
Update import pathsSearch old path → Replace with new path
Migrate API callsSearch deprecated → Replace with new API
Fix typos across projectSearch misspelling → Replace with correct
Update config valuesSearch old value → Replace with new value

Integration with Git

WorkflowDescription
git diff after serplReview all changes made
git stash before serplSave current work first
git checkout -- . to undoRevert all changes if needed
Work in a branchIsolate search-replace changes
git add -p after serplSelectively stage changes

Comparison with Alternatives

FeatureSerplsedVS Code
Interactive previewYesNoYes
TUI interfaceYesNoGUI
Preserve caseYesManualYes
AST GrepYesNoExtension
Works over SSHYesYesNo
Regex supportYesYesYes

Tips and Best Practices

TipDescription
Always use GitCommit before running replacements
Preview before applyingReview each change in the TUI
Use AST Grep for codeStructural matching avoids false positives
Use preserve caseMaintains camelCase, PascalCase, etc.
Remove false positivesUse d to skip unwanted matches
Search specific pathsUse --search-path to narrow scope
Check hidden filesUse --hidden flag when needed