- Edit search results from multiple files at once.
- Expand the search result context so that all matching delimiters are matched. This allows for structural editing on search output.
- Ediff support for viewing changes made in the
counsel-edit-modebufffer.
This provides an action that allows editing files in place for use with
counsel-ag, counsel-rg, counsel-git-grep, counsel-ack, and counsel-grep.
It can be installed with:
(counsel-edit-mode-setup-ivy)
Counsel-edit-mode is available on MELPA
M-x package-install [RET] counsel-edit-mode [RET]
Once installed, run any of the counsel search commands. Once they start returning results,
type M-o e to open up the counsel-edit-mode buffer to edit the results.
| Key | Action |
|---|---|
C-c C-c |
Commit Changes |
C-c C-k |
Discard Changes |
C-c C-l |
Goto buffer referenced at line |
C-c C-u |
Undo modifications to current line |
C-c C-e |
Expand current section for missing delimiters |
C-u C-c C-e |
Expand all files in buffer for missing delimiters |
C-c C-m |
Change major mode for current buffer |
C-c C-d |
Mark line for deletion |
C-c C-p |
Expand file at point's context up one line |
C-c C-n |
Expand file at point's context down one line |
C-c C-r |
Revert buffer with disk contents |
| Key | Action |
|---|---|
C-c C-c |
Commit Changes |
-
counsel-edit-mode-major-mode The default major-mode used by the
counsel-edit-modebuffer. This can be changed percounsel-edit-modebuffer by callingcounsel-edit-mode-change-major-modein that buffer. -
counsel-edit-mode-expand-braces-by-default The default major-mode used by the When this is set non-nil,
counsel-edit-modewill expand the context of each file until all matching delimeters are closed. This can be done manually per section by callingcounsel-edit-mode-expand-section. Ifcounsel-edit-mode-expand-sectionis called with a prefix arg, it will expand every section in the buffer. -
counsel-edit-mode-confirm-commits The default major-mode used by the When this is set non-nil,
counsel-edit-modewill confirm commits with showing the changes in ediff. C-c C-c confirms the changes in ediff whereas q will close the ediff session.
Contributions welcome, but forking preferred. I plan to actively maintain this, but I will be prioritizing features that impact me first.
I'll look at most pull requests eventually, but there is no SLA on those being accepted.
Also, I will only respond to pull requests on a case by case basis. I have no obligation to comment on, justify not accepting, or accept any given pull request. Feel free to start a fork that has more support in that area.
If there's a great pull request that I'm slow on accepting, feel free to fork and rename the project.
