[英]find several files with one command in Emacs
I would like to know Emacs' equivalent of Vim's :n, which opens several files according to a glob. 我想知道Emacs相当于Vim的:n,根据glob打开几个文件。
Say I have this directory: 说我有这个目录:
-rw-rw-r-- 1 pablo pablo 31 Jun 25 00:59 /home/pablo/tmp/prueba.php -rw-rw-r-- 1 pablo pablo 31 Jun 25 00:59 /home/pablo/tmp/prueba.php
-rw-rw-r-- 1 pablo pablo 2442 May 9 1913 /home/pablo/tmp/sin_soap.php -rw-rw-r-- 1 pablo pablo 2442 1913年5月9日/home/pablo/tmp/sin_soap.php
-rw-rw-r-- 1 pablo pablo 726 Jun 25 15:20 /home/pablo/tmp/verificar.php -rw-rw-r-- 1 pablo pablo 726 Jun 25 15:20 /home/pablo/tmp/verificar.php
And I want to open all those files. 我想打开所有这些文件。 In Vim, I can type
在Vim,我可以输入
:n *php :n * php
and that will give me one buffer for every file; 这将为每个文件提供一个缓冲区; I don't know how to do that in Emacs (when it's already open, of course I can do 'emacs *php' in a shell).
我不知道如何在Emacs中做到这一点(当它已经打开时,我当然可以在shell中执行'emacs * php')。
I'm happy with a function that I can call from any buffer via Mx, but if there's a command that I can call in dired-mode (say, edit all marked files or something), that would be beyond cool. 我很满意我可以通过Mx从任何缓冲区调用的函数,但是如果有一个命令我可以在直接模式下调用(比如编辑所有标记的文件或其他东西),那就太酷了。
Thanks. 谢谢。
The ordinary find-file
command, Cx Cf , will accept wildcards and open multiple buffers. 普通的
find-file
命令Cx Cf将接受通配符并打开多个缓冲区。 From the documentation: 从文档:
Interactively, or if wildcards is non-nil in a call from Lisp, expand wildcards (if any) and visit multiple files.交互式地,或者如果来自Lisp的调用中的通配符是非零的,则展开通配符(如果有的话)并访问多个文件。 You can suppress wildcard expansion by setting `find-file-wildcards' to nil.
您可以通过将`find-file-wildcards'设置为nil来抑制通配符扩展。
In your example you'd just type Cx Cf *php
RET . 在您的示例中,您只需键入Cx Cf
*php
RET 。
在dired中打开目录,或者使用find-dired使用Unix find创建一个dired缓冲区(即不是find-file
),然后标记你想要的文件(用m
)打开并按下F
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.