Releases: Jason-Bai/search-replace.nvim
Releases · Jason-Bai/search-replace.nvim
v0.4.0
✨ What's New
🏗️ Architecture Refactoring
-
Modular Design: Refactored monolithic codebase into clean, maintainable modules
- Reduced
init.luafrom 984 lines to 514 lines (-48%) - Extracted specialized engine components for better separation of concerns
- Improved testability and code organization
- Reduced
-
New Engine Modules:
engine/preview_manager.lua- Preview generation with intelligent cachingengine/replacement_engine.lua- Replacement execution with parallel supportengine/event_handlers.lua- Centralized keyboard event handling
⚡ Performance Improvements
Preview Generation: 33x Faster
- Before: 50 matches rendered in ~500ms
- After: 50 matches render in ~15ms
- Cache hits: <1ms (500x+ faster for repeated views)
How?
- Batch replacement: processes entire file in one shell call instead of per-line calls
- Intelligent caching: repeated previews are nearly instant
- Automatic cache invalidation on input changes
Parallel Replacement Execution: 3-5x Faster
- Before: 100 files completed in ~10s
- After: 100 files complete in ~2-3s
Features:
- Concurrent file processing using
plenary.job - Configurable concurrency (default: 20 files)
- Real-time progress notifications for large operations (>10 files)
- Smart backup strategy with atomic operations
- Full data integrity with error recovery
🐛 Bug Fixes
Keybinding Fix: <C-i> → <C-t>
Fixed case sensitivity toggle not working due to terminal key code collision:
- Issue:
<C-i>and<Tab>send identical ASCII code (0x09) in terminals - Solution: Changed to
<C-t>(mnemonic: Toggle) - Affected: Case sensitivity toggle in Search and Flags fields
- Impact: Toggle functionality now works correctly in all terminal environments
🧪 Testing
- Added integration tests for refactored modules
- Added performance benchmarks
- Added smoke tests for module loading
📊 Performance Comparison
| Operation | Before | After | Speedup |
|---|---|---|---|
| Preview (50 matches) | ~500ms | ~15ms | 33x |
| Preview (cached) | ~500ms | <1ms | 500x+ |
| Replace 100 files | ~10s | ~2-3s | 3-5x |
🔧 Breaking Changes
<C-i> to <C-t>
If you have custom keybindings that rely on <C-i>, please update them to <C-t>.
v0.3.0
✨ What's New
Realtime Search
- No Enter required - Search triggers automatically as you type
- Debounced - 300ms delay to prevent excessive searches
- Match count - Shows
[42]in Search title bar
Case Sensitivity Controls
<C-i>in Search field - Toggle search pattern case<C-i>in Flags field - Toggle glob filter case
Regex Mode (Default)
- Regex patterns work out of the box
- Capture groups supported:
$1,$2 - Example:
print\(([^)]+)\)→logger.info($1)
Visual Selection Pre-fill
- Select text in visual mode, press
<leader>sr - Search field auto-fills with selection
🔧 Configuration
require("search-replace").setup({
realtime = {
enabled = true,
debounce_ms = 300,
min_chars = 2,
},
})v0.2.0
✨ What's New
Browse Mode
- Press
oin Results to enter Browse Mode - Navigate with
n/Nto jump between matches (just like Vim's search!) - See full context - Review each match in its surrounding code
- Smart position tracking - Title bar shows
Browse [3/8] - filename:42 - Auto-exit on Tab - Clean state management when switching focus
Why use Browse Mode?
- 👀 Review before replace - See matches in full context before making changes
- 🎯 Quick navigation - Jump through all occurrences with familiar
n/Nkeys - ✅ Better decisions - Choose exactly which files need replacement
🎹 Keybindings
In Results:
o- Enter Browse Mode
In Browse Mode:
n- Next matchN- Previous matchq- Exit Browse ModeTab/Shift-Tab- Switch focus (auto-exits Browse Mode)
🐛 Bug Fixes
- Fixed border buffer validation errors
- Fixed "Buffer is not 'modifiable'" errors during focus switching
- Fixed state conflicts when switching between different files
- Simplified Results title bar for better visibility
🛠️ Technical Improvements
- Added
lua/search-replace/core/browse.luamodule (370+ lines) - Implemented namespace-based highlighting (no conflicts with user's
/search) - Added buffer-local keymaps with automatic cleanup
- Improved defensive programming for robust state management
v0.1.1
Fixed
- Fixed keymap not working with lazy.nvim default configuration
- Fixed Enter key closing the dialog in Results window
Documentation
- Added detailed lazy.nvim installation examples (lazy=false and keys spec)
- Updated Vim help documentation
- Added Browse Mode design document for future v0.2.0
Installation
See README for updated installation instructions.
Full Changelog: v0.1.0...v0.1.1