How to git grep for specific file types? #1016
Unanswered
Nebucatnetzer
asked this question in
Q&A
Replies: 3 comments
-
What I've came up with so far is this but that doesn't include consult.
|
Beta Was this translation helpful? Give feedback.
0 replies
-
This doesn’t work either:
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Best I came up with so far: (defun az-consult-git-grep-filetype (query)
(interactive "s#: ")
(let* ((filetype (file-name-extension (buffer-file-name)))
(cmd (format "git --no-pager grep --ignore-case --line-number --full-name %s -- '*.%s'" query filetype)))
(completing-read "Select a file: " (split-string (shell-command-to-string cmd) "\n" t) nil t))) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I really liked to use this code snippet:
https://github.com/juergenhoetzel/counsel-git-grep-current-mode/blob/master/counsel-git-grep-current-mode.el
As it allowed me to only search in specific files in a quick and easy way.
How would one achieve this with consult?
Beta Was this translation helpful? Give feedback.
All reactions