我使用emacs-helm-ag在项目中搜索文件内容和文件名。我的emacs-helm-ag
配置是:
; Helm Ag mode
(add-to-list 'load-path "~/.emacs.d/emacs-helm-ag")
(require 'helm-ag)
(custom-set-variables
'(helm-ag-base-command "ag --nocolor --nogroup")
'(helm-ag-command-option "--hidden --ignore *~ --ignore .git --ignore .idea"))
(global-set-key (kbd "M-s s") 'helm-do-ag-project-root)
要搜索文件内容(所有项目文件中的一个词),我按下M-s s
并输入要搜索的词。
要搜索文件名(项目所有文件列表中的文件),我按下M-s s
然后我必须输入-g
(我想自动执行此步骤),然后输入要搜索的文件名。
问题。请你帮我想出一个交互式功能,通过自动插入命令行选项(最好从包中重用)elisp
直接在项目中搜索文件名,并且只需要最终用户输入文件名。我想要一个交互式函数来搜索项目中的文件名,并能够使用不同的键绑定调用该函数。类似于:-g
helm-do-ag-project-root
emacs-helm-ag
(global-set-key (kbd "M-s f") 'helm-do-ag-project-root-file-names)