ivy: Add wgrep package

Can be used with counsel-git-grep to edit results in an occur buffer.
Handy!

Add wgrep bindings
",w" to enter wgrep mode
",," to commit changes
",a" to abort

counsel: Fix command output for wgrep
wgrep doesn't work with the column number in the command output
This commit is contained in:
justbur 2016-02-11 16:21:46 -05:00 committed by syl20bnr
parent 19c262ea0c
commit 3ac7efeb90
1 changed files with 14 additions and 4 deletions

View File

@ -18,13 +18,14 @@
(ivy :location built-in)
(ivy-spacemacs-help :location local)
smex
swiper))
swiper
wgrep))
(defun spacemacs-ivy/init-counsel ()
(defvar spacemacs--counsel-commands
'(("ag" . "ag --vimgrep %s %S .")
("pt" . "pt -e --nocolor --nogroup --column %s %S .")
("ack" . "ack --nocolor --nogroup --column %s %S .")
'(("ag" . "ag --nocolor --nogroup %s %S .")
("pt" . "pt -e --nocolor --nogroup %s %S .")
("ack" . "ack --nocolor --nogroup %s %S .")
("grep" . "grep -nrP %s %S ."))
"Alist of search commands and their corresponding commands
with options to run in the shell.")
@ -332,6 +333,13 @@ Helm hack."
(with-eval-after-load 'evil
(evil-make-overriding-map ivy-occur-mode-map 'normal))
(spacemacs/set-leader-keys-for-major-mode 'ivy-occur-grep-mode
"w" 'ivy-wgrep-change-to-wgrep-mode)
(evil-define-key 'normal wgrep-mode-map ",," 'wgrep-finish-edit)
(evil-define-key 'normal wgrep-mode-map ",c" 'wgrep-finish-edit)
(evil-define-key 'normal wgrep-mode-map ",a" 'wgrep-abort-changes)
(evil-define-key 'normal wgrep-mode-map ",k" 'wgrep-abort-changes)
(defun spacemacs/ivy-available-repls ()
"Show available repls."
(interactive)
@ -540,3 +548,5 @@ around point as the initial input."
"sb" 'swiper-all
"sB" 'spacemacs/swiper-all-region-or-symbol)
(global-set-key "\C-s" 'swiper))))
(defun spacemacs-ivy/init-wgrep ())