summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-01-01 17:09:51 -0500
committerKyle Meyer <kyle@kyleam.com>2014-01-01 17:09:51 -0500
commit02d56a9878c07cca3f1d856be2929afe28d33033 (patch)
tree97bfbbef4554f06748acd5171e5efd30ec008f32
parent29ffcd9c3814c0f5aa0459d38a99f78a6b91e09d (diff)
downloademacs.d-02d56a9878c07cca3f1d856be2929afe28d33033.tar.gz
Add query and replace command to projectile
-rw-r--r--init/km-projectile.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/init/km-projectile.el b/init/km-projectile.el
index 2ad41b1..98bb837 100644
--- a/init/km-projectile.el
+++ b/init/km-projectile.el
@@ -21,3 +21,21 @@ I have set `projectile-switch-project-action' to
'km/projectile-switch-project-to-file)
(setq projectile-use-git-grep t)
+
+(defun km/projectile-query-and-replace (from to &optional delimited)
+ "Peform query and replace on current project files.
+
+Core logic taken from `dired-do-query-replace-regexp', replacing
+the marked dired file list with the list from
+`projectile-current-project-files'."
+ (interactive
+ (let ((common
+ (query-replace-read-args
+ "Query replace regexp in project files" t t)))
+ (list (nth 0 common) (nth 1 common) (nth 2 common))))
+ (projectile-with-default-dir (projectile-project-root)
+ (tags-query-replace from to delimited
+ '(projectile-current-project-files))))
+
+(define-key projectile-mode-map (kbd "C-c p q")
+ 'km/projectile-query-and-replace)