abo-abo / swiper

Ivy - a generic completion frontend for Emacs, Swiper - isearch with an overview, and more. Oh, man!
https://oremacs.com/swiper/
2.32k stars 339 forks source link

counsel-rg: --glob option not supported? #1659

Open rieje opened 6 years ago

rieje commented 6 years ago

I'm trying to exclude a directory from the search results and it doesn't appear to work.

Here's what I have:

(my-space-map "s" (lambda ()
                       (interactive)
                       (counsel-rg nil "~/notes/" " --glob '!*/log' -- ~/system-admin/")))

I enter a search term and it shows results from ~/system-admin/log when it should be excluded.

The rg equivalent that does exclude ~/system-admin/log works as expected: rg --glob '!*/log ~/notes/ ~/system-admin/`.

Not sure if quoting has to do with it. Note that rg doesn't work with excluding absolute paths.

Also, I can't the prefix C-u doesn't work when I use the binding, not sure if it's a bug (I'm a complete noob at Emacs).

Andre0991 commented 6 years ago

I think -- might be the culprit.

Here's how I'm creating a command for excluding paths that start with test and postman, if that helps (ignore ivy-quit-and-run and ivy--input. This is supposed to run during a counsel session):

(defun andre/counsel-rg-src ()
    (interactive)
    (let ((search-str (ivy--input)))
      ;; https://emacs.stackexchange.com/questions/20974/exit-minibuffer-and-execute-a-command-afterwards
      (ivy-quit-and-run
        (counsel-rg search-str (projectile-project-root) "--iglob '!test*' --iglob '!postman*'"))))
abo-abo commented 6 years ago

Can't reproduce, please re-test. There was a recent change to counsel-rg.