diff options
Diffstat (limited to '')
-rw-r--r-- | users/tazjin/emacs/config/bindings.el | 3 | ||||
-rw-r--r-- | users/tazjin/emacs/config/functions.el | 8 | ||||
-rw-r--r-- | users/tazjin/emacs/config/init.el | 3 |
3 files changed, 12 insertions, 2 deletions
diff --git a/users/tazjin/emacs/config/bindings.el b/users/tazjin/emacs/config/bindings.el index 7188bd3ef37b..029aa2d0e507 100644 --- a/users/tazjin/emacs/config/bindings.el +++ b/users/tazjin/emacs/config/bindings.el @@ -34,6 +34,9 @@ ;; Open a file in project: (global-set-key (kbd "C-c f") 'project-find-file) +;; Search in a project +(global-set-key (kbd "C-c r g") 'rg-in-project) + ;; Open a file via magit: (global-set-key (kbd "C-c C-f") #'magit-find-file-worktree) diff --git a/users/tazjin/emacs/config/functions.el b/users/tazjin/emacs/config/functions.el index 74c737ad71e1..5963d142c14b 100644 --- a/users/tazjin/emacs/config/functions.el +++ b/users/tazjin/emacs/config/functions.el @@ -317,4 +317,12 @@ the GPG agent correctly." (url-retrieve "https://songwhip.com/api/" #'songwhip--handle-result nil t t) (message "Requesting Songwhip URL ... please hold the line."))) +(defun rg-in-project (&optional prefix) + "Interactively call ripgrep in the current project, or fall + back to ripgrep default behaviour if prefix is set." + (interactive "P") + (counsel-rg nil (unless prefix + (if-let ((pr (project-current))) + (project-root pr))))) + (provide 'functions) diff --git a/users/tazjin/emacs/config/init.el b/users/tazjin/emacs/config/init.el index 158ee67d694e..b473746fbe6a 100644 --- a/users/tazjin/emacs/config/init.el +++ b/users/tazjin/emacs/config/init.el @@ -45,8 +45,7 @@ (use-package counsel :after (ivy) - :config (counsel-mode 1) - :bind (("C-c r g" . counsel-rg))) + :config (counsel-mode 1)) (use-package dash) (use-package dash-functional) |