Dan*_* M. 15 emacs search editor project
也许这是一个经常重复的问题,但我找不到与搜索类似的东西.关键是我喜欢将Emacs用于我的个人项目,通常是使用C或python的非常小的应用程序,但我想知道如何将它也用于我的工作,其中我们的项目包含大约10k的源代码文件,所以是veeeery大(实际上我使用源洞察,这是非常好的工具,但仅适用于Windows),问题是:
此外,如果您有任何经验,并希望分享您的想法,我会认为它非常有趣.
BR
小智 10
导航C源文件的"传统"方式是使用"etags"创建一个名为TAGS的文件,然后使用ALT-.去跨文件的功能.
为了在文件中搜索字符串,我通常使用"grep".您可以创建一个包含您要搜索的所有目录的shell脚本,或者如果您厌倦了每次输入它们.
我的项目通常都是git,所以我把它们放在一起快速搜索它们:
;; There's something similar (but fancier) in vc-git.el: vc-git-grep
;; -I means don't search through binary files
(defcustom git-grep-switches "--extended-regexp -I -n --ignore-case"
"Switches to pass to `git grep'."
:type 'string)
(defun git-grep (command-args)
(interactive
(list (read-shell-command "Run git-grep (like this): "
(format "git grep %s -e "
git-grep-switches)
'git-grep-history)))
(let ((grep-use-null-device nil))
(grep command-args)))
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4317 次 |
| 最近记录: |