Function: projectile-replace-mode
projectile-replace-mode is an interactive and byte-compiled function
defined in projectile.el.
Signature
(projectile-replace-mode)
Documentation
Major mode for reviewing and applying a project-wide replacement.
Each match starts enabled and can be toggled on or off; only the
enabled matches are applied. Besides toggling and applying, the search
itself can be reshaped without leaving the buffer: toggle case
sensitivity (c (projectile-replace--toggle-case)),
literal/regexp matching (x (projectile-replace--toggle-regexp)) or whole-word
matching (w (projectile-replace--toggle-word)) to re-scan, and
narrow the shown matches by keeping or flushing them against a regexp
matched on the context line (k (projectile-replace--keep-matches) / d (projectile-replace--flush-matches)) or the file name
(K (projectile-replace--keep-files) / D (projectile-replace--flush-files)). Re-searching (g (projectile-replace--refresh)) rebuilds the list from scratch,
undoing any filtering.
Applying with ! (projectile-replace--apply) needs no external package. If you prefer the
grep/wgrep workflow, e (projectile-replace--export) exports the shown matches to a grep-mode
buffer that wgrep or Emacs 31's grep-edit-mode can turn editable and
write back to the files.
! projectile-replace--apply
C-c C-c projectile-replace--apply
D projectile-replace--flush-files
K projectile-replace--keep-files
M-n projectile-replace--goto-next-file
M-p projectile-replace--goto-prev-file
RET projectile-replace--visit
SPC projectile-replace--toggle
c projectile-replace--toggle-case
d projectile-replace--flush-matches
e projectile-replace--export
f projectile-replace--toggle-file
g projectile-replace--refresh
k projectile-replace--keep-matches
n projectile-replace--goto-next-match
p projectile-replace--goto-prev-match
q projectile-replace--quit
r projectile-replace--set-replacement
t projectile-replace--toggle
w projectile-replace--toggle-word
x projectile-replace--toggle-regexp
In addition to any hooks its parent mode special-mode might have
run, this mode runs the hook projectile-replace-mode-hook, as the
final or penultimate step during initialization.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(define-derived-mode projectile-replace-mode special-mode "Projectile-Replace"
"Major mode for reviewing and applying a project-wide replacement.
Each match starts enabled and can be toggled on or off; only the
enabled matches are applied. Besides toggling and applying, the search
itself can be reshaped without leaving the buffer: toggle case
sensitivity (\\<projectile-replace-mode-map>\\[projectile-replace--toggle-case]),
literal/regexp matching (\\[projectile-replace--toggle-regexp]) or whole-word
matching (\\[projectile-replace--toggle-word]) to re-scan, and
narrow the shown matches by keeping or flushing them against a regexp
matched on the context line (\\[projectile-replace--keep-matches] / \\[projectile-replace--flush-matches]) or the file name
(\\[projectile-replace--keep-files] / \\[projectile-replace--flush-files]). Re-searching (\\[projectile-replace--refresh]) rebuilds the list from scratch,
undoing any filtering.
Applying with \\[projectile-replace--apply] needs no external package. If you prefer the
grep/wgrep workflow, \\[projectile-replace--export] exports the shown matches to a `grep-mode'
buffer that wgrep or Emacs 31's `grep-edit-mode' can turn editable and
write back to the files.
\\{projectile-replace-mode-map}"
(setq-local truncate-lines t)
;; killing the buffer mid-scan must not leave a dangling chunk timer
(add-hook 'kill-buffer-hook #'projectile-replace--cancel-scan nil t)
(buffer-disable-undo))