5

[Emacs Tips] 使用 Dired 快速移动文件

 2 years ago
source link: https://segmentfault.com/a/1190000040474954
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

[Emacs Tips] 使用 Dired 快速移动文件

关注 EmacsTalk 收获更多 Emacs 使用技巧

在第五期节目里推荐过 Raycast 这个神器,之前知道它可以直接执行脚本,但一直没尝试过,最近发现它提供了一个 script-commands 仓库,里面整理了一些常用的脚本,比如清空废纸篓、刷新 DNS 等,比较实用。

但这个仓库的脚本非常多,我需要的只是其中很小一部分,所以需要一种方式来便捷地在两个目录间拷贝文件(称为 src 与 dst )。

之前的话我都是在 Dired 里 mark 相关文件,然后再在 minibuffer 里找到 dst,如果 src 和 dst 离得比较远,整个过程会非常枯燥、低效,今天尝试 Google 了一下这个问题,发现一个好方式,流程如下:

  1. 打开两个 Dired 窗口,分别对应 src 目录与 dst 目录
  2. 在 src 里 mark 文件后,按 C 拷贝时,提示的目录默认就是 dst
  3. 直接回车即可复制文件

设置 (setq dired-dwim-target t) 即可使用上述功能。Emacs is amazing !


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK