Skip to content

Instantly share code, notes, and snippets.

@jonEbird
Created September 12, 2016 21:13
Show Gist options
  • Save jonEbird/c951f1f889d10de31cc631eb61d93394 to your computer and use it in GitHub Desktop.
Save jonEbird/c951f1f889d10de31cc631eb61d93394 to your computer and use it in GitHub Desktop.
Running counsel-ag while automatically ignoring git submoules
(defun jsm/projectile-counsel-ag ()
"Run counsel-ag within projectile root while ignoring git submodule paths."
(interactive)
(let ((default-directory (projectile-project-root))
(agignore-cmd "git config --file .gitmodules --get-regexp path | awk '{ print $2 }' > .agignore"))
(shell-command agignore-cmd nil nil)
(counsel-ag (thing-at-point 'symbol) (projectile-project-root))))
(define-key projectile-command-map (kbd "s s") 'jsm/projectile-counsel-ag)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment