diff --git a/README.md b/README.md index 520be56..650d256 100644 --- a/README.md +++ b/README.md @@ -488,8 +488,10 @@ prefix argument, add the marked files to the current clipboard. Past clipboards are stored in `dired-ranger-copy-ring` so you can repeat the past pastes. -Call `dired-ranger-paste` or `dired-ranger-move` to copy or move -the files in the current clipboard to the current dired buffer. +Call `dired-ranger-paste`, `dired-ranger-move`, `dired-ranger-hardlink`, +`dired-ranger-symlink`, or `dired-ranger-symlink-relative` to +paste, move, hardlink, symlink, or create a reliative symlink from +the files in the current clipboard to the current dired buffer respectively. With raw prefix argument (usually C-u), the clipboard is not cleared, so you can repeat the copy operation in another dired buffer. diff --git a/dired-ranger.el b/dired-ranger.el index 93634a3..b82b027 100644 --- a/dired-ranger.el +++ b/dired-ranger.el @@ -170,6 +170,47 @@ instead of copying them." #'dired-ranger--name-constructor ?M) (unless arg (ring-remove dired-ranger-copy-ring 0)))) +;;;###autoload +(defun dired-ranger-symlink (arg) + "Symlink the items from copy ring to current directory. + +This behaves like `dired-ranger-paste' but symlinks the files +instead of copying them." + (interactive "P") + (let* ((index (if (numberp arg) arg 0)) + (data (ring-ref dired-ranger-copy-ring index)) + (files (cdr data))) + (dired-create-files #'make-symbolic-link "Symlink" files + #'dired-ranger--name-constructor ?S) + (unless arg (ring-remove dired-ranger-copy-ring 0)))) + +;;;###autoload +(defun dired-ranger-symlink-relative (arg) + "Create a relative symlink for the items from copy ring to current directory. + +This behaves like `dired-ranger-paste' but symlinks the files +instead of copying them." + (interactive "P") + (let* ((index (if (numberp arg) arg 0)) + (data (ring-ref dired-ranger-copy-ring index)) + (files (cdr data))) + (dired-create-files #'dired-make-relative-symlink "Symlink Relative" files + #'dired-ranger--name-constructor ?R) + (unless arg (ring-remove dired-ranger-copy-ring 0)))) + +;;;###autoload +(defun dired-ranger-hardlink (arg) + "Create a hardlink for the items from copy ring to current directory. + +This behaves like `dired-ranger-paste' but hardlinks the files +instead of copying them." + (interactive "P") + (let* ((index (if (numberp arg) arg 0)) + (data (ring-ref dired-ranger-copy-ring index)) + (files (cdr data))) + (dired-create-files #'dired-hardlink "Hardlink" files + #'dired-ranger--name-constructor ?H) + (unless arg (ring-remove dired-ranger-copy-ring 0)))) ;; bookmarks (defcustom dired-ranger-bookmark-reopen 'ask