dired duplicate

This commit is contained in:
Levi 2024-09-02 09:28:52 +02:00
parent c54036caca
commit d281d66bfb
2 changed files with 18 additions and 1 deletions

View File

@ -9,7 +9,7 @@
'("9fb561389e5ac5b9ead13a24fb4c2a3544910f67f12cfcfe77b75f36248017d0" "88f7ee5594021c60a4a6a1c275614103de8c1435d6d08cc58882f920e0cec65e" "aec7b55f2a13307a55517fdf08438863d694550565dee23181d2ebd973ebd6b8" "014cb63097fc7dbda3edf53eb09802237961cbb4c9e9abd705f23b86511b0a69" "81f53ee9ddd3f8559f94c127c9327d578e264c574cda7c6d9daddaec226f87bb" "3770d0ae70172461ee0a02edcff71b7d480dc54066e8960d8de9367d12171efb" "f64189544da6f16bab285747d04a92bd57c7e7813d8c24c30f382f087d460a33" "f079ef5189f9738cf5a2b4507bcaf83138ad22d9c9e32a537d61c9aae25502ef" "835d934a930142d408a50b27ed371ba3a9c5a30286297743b0d488e94b225c5f" default))
'(elfeed-feeds '("https://hnrss.org/newest"))
'(package-selected-packages
'(persistent-scratch scratch cape kind-icon corfu eat eshell-toggle eshell-git-prompt eshell-bookmark eshell-autojump eshell-atuin elfeed vertico orderless plz ace-mc ace-jump-mode flycheck fic-mode kotlin-mode rego-mode protobuf-mode multi-web-mode mmm-mode python-mode php-mode json-mode yaml-mode go-mode plantuml-mode graphviz-dot-mode magit denote unicode-fonts nerd-icons-ibuffer nerd-icons-completion nerd-icons-dired doom-modeline which-key multiple-cursors dash async-status async consult-projectile)))
'(consult persistent-scratch scratch cape kind-icon corfu eat eshell-toggle eshell-git-prompt eshell-bookmark eshell-autojump eshell-atuin elfeed vertico orderless plz ace-mc ace-jump-mode flycheck fic-mode kotlin-mode rego-mode protobuf-mode multi-web-mode mmm-mode python-mode php-mode json-mode yaml-mode go-mode plantuml-mode graphviz-dot-mode magit denote unicode-fonts nerd-icons-ibuffer nerd-icons-completion nerd-icons-dired doom-modeline which-key multiple-cursors dash async-status async consult-projectile)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.

View File

@ -606,3 +606,20 @@
:bind
(("C-c s" . persistent-scratch-save)
("C-c r" . persistent-scratch-restore)))
(defun my/dired-duplicate-file (arg)
"Duplicate the current file in Dired."
(interactive "p")
(let ((filename (dired-get-filename)))
(setq target (concat (file-name-sans-extension filename)
"-old"
(if (> arg 1) (number-to-string arg))
(file-name-extension filename t)))
(if (file-directory-p filename)
(copy-directory filename target)
(copy-file filename target))
)
)
(define-key dired-mode-map (kbd "C-c d") 'my/dired-duplicate-file)