From 5b74855388e5e8da6dc2c518edff5b2c1e32a66f Mon Sep 17 00:00:00 2001 From: 10sr <8.slashes@gmail.com> Date: Sat, 15 Aug 2020 23:51:39 +0900 Subject: [PATCH] Fix fuzzy-finder commands --- emacs.el | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/emacs.el b/emacs.el index 3028657..52e2e5b 100644 --- a/emacs.el +++ b/emacs.el @@ -1249,8 +1249,7 @@ THEM are function and its args." (if (and (executable-find "fzf") (fboundp 'fuzzy-finder) (not (file-remote-p default-directory))) - ;; TODO: Use projectile version - (fuzzy-finder) + (fuzzy-finder-find-files-projectile) (call-interactively 'find-file))) (define-key ctl-x-map "f" 'my-fuzzy-finder-or-find-file) @@ -1259,9 +1258,21 @@ THEM are function and its args." (interactive) (unless (executable-find "rg") (error "rg not found")) - (fuzzy-finder :input-command "rg -nH --no-heading --hidden --follow --glob '!.git/*' --color=always ^")) + (fuzzy-finder :input-command "rg -nH --no-heading --hidden --follow --glob '!.git/*' --color=always ^" + :action (lambda (results) + (dolist (result results) + (let* ((fields (split-string result ":")) + (file (pop fields)) + (linenumber (pop fields))) + (find-file (expand-file-name file)) + (when linenumber + (goto-char (point-min)) + (forward-line (- (string-to-number linenumber) 1)) + (back-to-indentation))))))) (define-key ctl-x-map "S" 'my-fuzzy-finder-ripgrep-lines) +;; (fuzzy-finder :command "selecta") + ;; recently ;; TODO: Enable after first visit file?