emacs - 如何在 Emacs 中创建目录?

标签 emacs directory command

如何使用 Emacs 创建新目录?我使用什么命令? (如果可以,请提供示例)

最佳答案

  • 要创建目录 dir/to/create,请输入:

    M-x make-directory RET dir/to/create RET
    
  • 要创建目录 dir/parent1/nodedir/parent2/node,请键入:

    M-! mkdir -p dir/parent{1,2}/node RET
    

    假设 Emacs 的下级 shell 是 bash/zsh 或其他兼容的 shell。

  • 或处于定向模式

    +
    

    它不会创建不存在的父目录。

    示例:

    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 创建一个包含不存在的父目录的新文件并输入:

    M-x make-directory RET RET
    

在最新的 Emacs 版本中,Emacs 要求在保存新文件时自动创建父目录。对于旧版本,请参阅How to make Emacs create intermediate dirs - when saving a file?

关于emacs - 如何在 Emacs 中创建目录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/155507/

相关文章:

emacs - 如何记录使用 Emacs Org 模式的时间?

php - 测试一个目录是否是另一个文件夹的子目录

java - 在Android中创建文件夹解压epub

objective-c - 从命令行更改项目的代码签名

linux - 如何为这种情况编写 Grep 命令?

python - 如何从 Emacs 运行 django shell?

emacs - 使 C-c 直接传递给 emacs 中的 term

php - Emacs+geben : Open local files when debugging instead of remote ones

file - Phonegap : Create a file in a specific folder

java - Android 中的 Ffmpeg 命令不起作用。创建多个图像的视频