commit 7067b2ff1a278cbf15468b7857b481e5690e48eb
parent 318ba606d544e904207bf75a4cd396fc0c4fcb88
Author: Vincent Demeester <vincent@sbr.pm>
Date: Wed, 25 Nov 2020 18:06:23 +0100
tools/emacs: customize rg-buffer-name
Take into account the project name if set
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/tools/emacs/config/config-search.el b/tools/emacs/config/config-search.el
@@ -88,6 +88,13 @@ confines of word boundaries (e.g. multiple words)."
(setq rg-default-alias-fallback "all")
(cl-pushnew '("tmpl" . "*.tmpl") rg-custom-type-aliases)
(cl-pushnew '("gotest" . "*_test.go") rg-custom-type-aliases)
+ (defun vde/rg-buffer-name ()
+ "Generate a rg buffer name from projectile if bound"
+ (cond ((boundp 'projectile-project-name) (if (string-equal (projectile-project-name) "-")
+ "rg"
+ (format "rg: %s" (projectile-project-name))))
+ (t "rg")))
+ (setq rg-buffer-name #'vde/rg-buffer-name)
(with-eval-after-load 'projectile
(defalias 'projectile-ripgrep #'rg-project)))
;; -UseRG