简体   繁体   English

为Emacs开放?

[英]Snap Open for Emacs?

I need some script that will find and open files by given pattern within current directory and it's subdirectories, kind of Snap Open for GEdit, fuzzyfinder for VIM and TextMate's Open Files. 我需要一些脚本,它将在当前目录中找到并打开给定模式的文件,它的子目录,用于GEdit的Snap Open,用于VIM的fuzzyfinder和TextMate的Open Files。

any ideas? 有任何想法吗?

You can do this in standard dired too. 您也可以在标准的dired中执行此操作。

First do 先做

C-u s

which let's you change the dired ls command to -lR . 让你将dired ls命令改为-lR Now you will have subdirectories in the dired buffer. 现在,您将在dired缓冲区中拥有子目录。

% m 

Let's you mark all files matching a regexp. 让我们标记所有匹配正则表达式的文件。

To open the files use the command 要打开文件,请使用该命令

`dired-do-find-marked-files'

you need (require 'dired-x) for this one. 你需要(需要'dired-x)这个。

Not being familiar with any of the referenced libraries, I don't know if this is an exact answer, but it sounds like ido-mode will do at least some of what you're asking for, and it's bundled with Emacs as of version 22. Ido changes the way the default Emacs find-file and find-buffer keybindings work, supplying lists of completions for the strings you type and using the Enter key to accept the current selection (which can be a directory, allowing you to browse the directory structure from the minibuffer). 不熟悉任何引用的库,我不知道这是否是一个确切的答案,但听起来像ido-mode至少会做一些你要求的东西,并且它与Emacs捆绑在一起的版本22. Ido更改默认Emacs查找文件和查找缓冲区键绑定的工作方式,为您键入的字符串提供完成列表,并使用Enter键接受当前选择(可以是目录,允许您浏览来自迷你缓冲区的目录结构)。 Check the Ido EmacsWiki page for details. 有关详细信息,请查看Ido EmacsWiki页面

不能满足您的所有要求,但打开多个文件的一个非常简单的选择是在打开文件(Cx Cf)时使用glob模式,如~/prj/*/*.[hc]

Not exactly what you're asking for, but close is ifind.el . 不完全是你要求的,但关闭是ifind.el To find all files that have frog in the name and the suffix .el : 要查找名称中包含frog所有文件以及后缀.el

M-x ifind /some/path/*frog*.el

That does do a search through all the subdirectories under /some/path . 这确实搜索了/some/path下的所有子目录。

It won't open all the files automatically, but instead pops up a *compilation* buffer that allows you to open them up either by clicking on the files or by doing Mx next-error (aka "Cx `"). 它不会自动打开所有文件,而是弹出一个*compilation*缓冲区,允许您通过单击文件或执行Mx next-error (又名“Cx`”)打开它们。

This routine will open up each of the find results: 此例程将打开每个查找结果:

(defun visit-all-ifind-results ()
  "do next-error until there are no more"
  (interactive)
  (condition-case nil
      (while t
        (next-error))
    (error nil)))

So, with that, you could just follow up with Mx visit-all-ifind-results . 那么,有了这个,你可以跟进Mx visit-all-ifind-results

You will have to write this one yourself. 你必须自己写这个。

I occasionally like to open all relevant files in a project; 我偶尔喜欢打开项目中的所有相关文件; for this I use eproject 's eproject-open-all-project-files command. 为此我使用eprojecteproject-open-all-project-files命令。

You may try ido mode. 你可以尝试ido模式。 Read following for more options. 阅读以下内容以获取更多选

ido on emacswiki emacswiki上的偶像

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM