Emacs: Use 'pt' as a fallback for helm-grep

master
Pierre Neidhardt 2016-09-23 18:54:15 +05:30
parent 5422d22d5f
commit 29740d4367
1 changed files with 16 additions and 4 deletions

View File

@ -1,9 +1,7 @@
(when (require 'helm-descbinds nil t)
(helm-descbinds-mode))
(when (require 'helm-ls-git nil t)
(setq helm-grep-git-grep-command "git --no-pager grep -n%cH --color=always --full-name -e %p -- %f"))
(require 'helm-ls-git nil t)
(helm-mode 1)
; (helm-autoresize-mode 1)
(setq helm-follow-mode-persistent t)
@ -16,6 +14,20 @@
(setq helm-imenu-fuzzy-match t)
(setq helm-M-x-fuzzy-match t)
;; Do not exclude any files from 'git grep'.
(setq helm-grep-git-grep-command "git --no-pager grep -n%cH --color=always --full-name -e %p -- %f")
;; Use `pt' instead of `ag'.
(setq helm-grep-ag-command "pt -S --hidden --color --nogroup %s %s %s")
(defun helm-grep-git-or-ag (arg)
"Run `helm-grep-do-git-grep' if possible; fallback to `helm-do-grep-ag' otherwise."
(interactive "P")
(require 'vc)
(if (vc-find-root default-directory ".git")
(helm-grep-do-git-grep arg)
(helm-do-grep-ag arg)))
(define-key mickey-minor-mode-map (kbd "M-x") 'helm-M-x)
(define-key mickey-minor-mode-map (kbd "C-x M-f") 'helm-semantic-or-imenu)
(define-key mickey-minor-mode-map (kbd "C-x C-/") 'helm-find)
@ -31,7 +43,7 @@
(define-key mickey-minor-mode-map (kbd "M-s o") 'helm-occur)
(define-key mickey-minor-mode-map (kbd "C-h a") 'helm-apropos)
(define-key mickey-minor-mode-map (kbd "C-M-%") 'helm-regexp)
(define-key mickey-minor-mode-map (kbd "C-x C-g") 'helm-grep-do-git-grep)
(define-key mickey-minor-mode-map (kbd "C-x C-g") 'helm-grep-git-or-ag)
(set-face-background 'helm-source-header "white")
(set-face-foreground 'helm-source-header "black")