emacs で ag(The Silver Searcher) を使う
homebrew で ag(The Silver Searcher) をインストール。
$ brew install the_silver_searcher
$ which ag
/usr/local/bin/ag
/usr/local/bin に path が通ってなかったので追加。
;; PATH
(dolist (dir (list
"/sbin"
"/usr/sbin"
"/bin"
"/usr/bin"
"/usr/local/bin"
(expand-file-name "~/bin")
))
;; exec-path
(when (and (file-exists-p dir) (not (member dir exec-path)))
(setenv "PATH" (concat dir ":" (getenv "PATH")))
(setq exec-path (append (list dir) exec-path))))
;; ack
;;(defun ack ()
;; (interactive)
;; (let ((grep-find-command "ack --nocolor --nogroup "))
;; (call-interactively 'grep-find)))
;; ag
(defun ag ()
(interactive)
(let ((grep-find-command "ag --nocolor --nogroup "))
(call-interactively 'grep-find)))
M-x ag RET で ag コマンドが使える。
・ackを捨てて、より高速なag(The Silver Searcher)に切り替えた
・Emacs 上で快適に Bash や Zsh を利用する設定 : 紹介マニア