如何从 Emacs 中创建目录? [英] How do I create a directory from within Emacs?
问题描述
如何使用 Emacs 创建一个新目录?我使用什么命令?(如果可能,请举个例子)
How exactly can I create a new directory using Emacs? What commands do I use? (If possible, please provide an example)
推荐答案
要创建目录
dir/to/create
,输入:M-x make-directory RET dir/to/create RET
要创建目录
dir/parent1/node
和dir/parent2/node
,输入:M-! mkdir -p dir/parent{1,2}/node RET
假设 Emacs 的劣质 shell 是
bash
/zsh
或其他兼容的 shell.It assumes that Emacs's inferior shell is
bash
/zsh
or other compatible shell.或处于
Dired
模式+
它不会创建不存在的父目录.
It doesn't create nonexistent parent directories.
例子:
C-x d *.py RET ; shows python source files in the CWD in `Dired` mode + test RET ; create `test` directory in the CWD
CWD
代表当前工作目录.或者只是使用
C-x C-f
创建一个包含不存在的父目录的新文件,然后输入:or just create a new file with non-existing parent directories using
C-x C-f
and type:M-x make-directory RET RET
Emacs 要求在最近的 Emacs 版本中保存新文件时自动创建父目录.对于旧版本,请参阅如何让 Emacs 创建中间目录 - 保存文件时?
Emacs asks to create the parent directories automatically while saving a new file in recent Emacs versions. For older version, see How to make Emacs create intermediate dirs - when saving a file?
这篇关于如何从 Emacs 中创建目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!