You can also hit l (for "list") when prompted, to display the list of files that will be pasted. When you use C-y, you are prompted for confirmation ( y or n). And it means that you could, instead of copying file names to the kill ring, just put the names in that variable (e.g. This means that you need not paste immediately after you copy file names. Whatever is currently at the head of the kill ring. In Dired+ those commands also set variable diredp-last-copied-filenames to the You should have copied file names to the kill ring using M-0 w or M-x diredp-copy-abs-filenames-as-kill. So you do not need to be in a Dired buffer to paste files to a directory. With a prefix arg, C-y instead prompts you for the target directory for the paste. The "current directory" here is what dired-current-directory returns: the inserted subdirectory where the cursor is located, or the Dired main directory if the cursor is not in a subdir listing. You can use C-y (command diredp-yank-files) to paste files, whose absolute names you have copied to the kill ring, to the current directory. You can paste it using the mouse, but it is handier to use C-M-y from library second-sel.el. The secondary selection doesn't depend on the region or the position of the cursor - you can paste it as many times as you want, regardless of changes to the kill-ring. Tip: (This is not needed if you use Dired+ - see my other answer here.) If you intend to copy (or move) files from multiple directories to the same target directory, and you might be doing other things with the kill-ring in between, so that the copied target dir name might no longer be first in the kill-ring, then use the secondary selection to select the target dir name. ( dired-do-copy checks for existing files of the same name in the target dir, etc.) This is, I think, as simple as what you describe ( C-w to copy marked file names followed by C-y in the target Dired listing), but the order is opposite: you copy the target directory name first, and then paste it to the C ( dired-do-copy) command. (Pasting it after that default dir name dims that default name - it is ignored.) You can just paste it, without bothering to remove the default directory that is inserted in the minibuffer. At the prompt, use C-y to paste the (absolute) name of the target directory. Use C (command dired-do-copy) to copy the marked files. Go to the Dired buffer that lists the files you want to copy. (You can copy a dir name from any Dired-listing subdir header line in the same way.) This copies the absolute name of that target directory. With the cursor on the directory header line for a listing of the target directory, use w (command dired-copy-filename-as-kill). Go first to a Dired buffer that lists the target directory. You can do the following in vanilla Dired (no 3rd-party library needed): Which uses the classical approach of pressing C when two dired windows separated vertically using the option (setq dired-dwim-target t). There is a related question How to quickly copy/move file in Emacs Dired? I am looking for a solution to first copy the items then to paste them at an appropriate dired buffer. If the path of the destination buffer is very long or there are too many opened dired buffer, this approach is complicated. The problem with the classical Copy option C in dired is that as soon as it is pressed, it asks for the destination. I mean marking some items (files and buffer) by m then copying them by M-w (or another shortcut), then going to another dired buffer (which is not necessarily in a window side-by-side by the window of previous dired buffer(s)) then yanking all copied file by C-y (or another shortcut) there? This is a simple task that many file explorers in different OS can do. Is there a simple M-w C-y approach to copy paste files and directories between two dired buffers?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |