Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use projectile-get-ext-command with counsel-projectile-rg? #186

Open
ameyp opened this issue Dec 19, 2022 · 0 comments
Open

Use projectile-get-ext-command with counsel-projectile-rg? #186

ameyp opened this issue Dec 19, 2022 · 0 comments

Comments

@ameyp
Copy link

ameyp commented Dec 19, 2022

I'm customizing projectile-get-ext-command as follows:

(when (executable-find "rg")
    (progn
      (defconst ameyp/rg-arguments
        `("--line-number"                     ; line numbers
          "--smart-case"
          "--follow"                          ; follow symlinks
          "--mmap")                           ; apply memory map optimization when possible
        "Default rg arguments used in the functions in `projectile' package.")

      (defun ameyp/advice-projectile-use-rg (mode)
        "Always use `rg' for getting a list of all files in the project."
        (mapconcat 'identity
                   (append '("\\rg") ; used unaliased version of `rg': \rg
                           ameyp/rg-arguments
                           '("--null" ; output null separated results,
                             "--files" ; get file names matching the regex '' (all files)
                             "--hidden" ; include hidden files and folders...
                             "-g '!.git/'" ; ...except .git/
                             ))
                   " "))

      (advice-add 'projectile-get-ext-command :override #'ameyp/advice-projectile-use-rg)))

The primary usecase for me is that I want rg to look at hidden files and folders, but not .git. This works perfectly with counsel-projectile-find-file, it includes hidden files in the results. But it doesn't work with counsel-projectile-rg, the search doesn't look at hidden files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant