53

In Dired mode, I can m mark files and R to move them to a destination.

Some times the destination path is too long. With the destination open in a split window, is there a way to move files quicker?

When I see the two dired windows on the screen, I missed the drag-and-drop function in a GUI file manager.

73

From the documentation:

dired-dwim-target is a variable defined in `dired.el'. Its value is nil

Documentation: If non-nil, Dired tries to guess a default target directory. This means: if there is a Dired buffer displayed in the next window, use its current directory, instead of this Dired buffer's current directory.

The target is used in the prompt for file copy, rename etc.

Put this in your init file: (setq dired-dwim-target t). Then, go to dired, split your window, split-window-vertically & go to another dired directory. When you will press C to copy, the other dir in the split pane will be default destination.

| improve this answer | |
  • 3
    Wow, that's great! Emacs is amazing! Thank you. – Nick Dec 21 '14 at 1:36
1

just for posterity:

there is also the handy dired-ranger package, which allows you to copy multiple sets of files to a clipboard, navigate to a target destination and copy or move them there. it also cooperates with the dired-dwim-target mentioned in the other answer.

it doesn't provide keybindings out of the box, you have to set them up yourself. you can do this with some thing like:

(eval-after-load "dired" '(progn
    (define-key dired-mode-map (kbd "C-x w") 'dired-ranger-copy)
    (define-key dired-mode-map (kbd "C-x x") 'dired-ranger-move)
    (define-key dired-mode-map (kbd "C-x y") 'dired-ranger-paste)
    ))

(use C-h c from dired to see what keybindings are undefined.)

it is available from melpa.

a brief description: http://pragmaticemacs.com/emacs/copy-and-paste-files-with-dired-ranger/.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.