init-wgrep.el 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. ;; this lets you use an emacs grep command to look for something,
  2. ;; then in that grep buffer, you are can freely modify the text.
  3. ;; you can also use this in ag-mode. COOL!
  4. ;; You can edit the text in the *grep* buffer after typing C-c C-p.
  5. ;; After that the changed text is highlighted.
  6. ;; The following keybindings are defined:
  7. ;; C-c C-e : Apply the changes to file buffers.
  8. ;; C-c C-u : All changes are unmarked and ignored.
  9. ;; C-c C-d : Mark as delete to current line (including newline).
  10. ;; C-c C-r : Remove the changes in the region (these changes are not
  11. ;; applied to the files. Of course, the remaining
  12. ;; changes can still be applied to the files.)
  13. ;; C-c C-p : Toggle read-only area.
  14. ;; C-c C-k : Discard all changes and exit.
  15. ;; C-x C-q : Exit wgrep mode.
  16. ;; * To save all buffers that wgrep has changed, run
  17. ;;
  18. ;; M-x wgrep-save-all-buffers
  19. ;; * To save buffer automatically when `wgrep-finish-edit'.
  20. ;;
  21. ;; (setq wgrep-auto-save-buffer t)
  22. ;; * You can change the default key binding to switch to wgrep.
  23. ;;
  24. ;; (setq wgrep-enable-key "r")
  25. ;; * To apply all changes wheather or not buffer is read-only.
  26. ;;
  27. ;; (setq wgrep-change-readonly-file t)
  28. (use-package wgrep )
  29. ;; make wgrep save all the files you changes on exit
  30. (setq wgrep-auto-save-buffer t)
  31. (autoload 'wgrep-ag-setup "wgrep-ag")
  32. (add-hook 'ag-mode-hook 'wgrep-ag-setup)
  33. (provide 'init-wgrep)