Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
47 lines (41 sloc) 1.58 KB
(defun rgrep-fullscreen (regexp &optional files dir confirm)
"Open grep in full screen, saving windows."
((and grep-find-command (equal current-prefix-arg '(16)))
(list (read-from-minibuffer "Run: " grep-find-command
nil nil 'grep-find-history)))
((not grep-find-template)
(error "grep.el: No `grep-find-template' available"))
(t (let* ((regexp (grep-read-regexp))
(files (grep-read-files regexp))
(dir (read-directory-name "Base directory: "
nil default-directory t))
(confirm (equal current-prefix-arg '(4))))
(list regexp files dir confirm))))))
(window-configuration-to-register ?$)
(rgrep regexp files dir confirm)
(switch-to-buffer "*grep*")
(defun rgrep-quit-window ()
(jump-to-register ?$))
(defun rgrep-goto-file-and-close-rgrep ()
(kill-buffer "*grep*")
(message "Type C-x r j $ to return to pre-rgrep windows."))
(eval-after-load "grep"
;; Don't recurse into some directories
(add-to-list 'grep-find-ignored-directories "target")
(add-to-list 'grep-find-ignored-directories "node_modules")
;; Add custom keybindings
(define-key grep-mode-map "q" 'rgrep-quit-window)
(define-key grep-mode-map (kbd "C-<return>") 'rgrep-goto-file-and-close-rgrep)))
(provide 'setup-rgrep)