Skip to content

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

Open
@ameyp

Description

@ameyp

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions