Skip to content

Instantly share code, notes, and snippets.

@xenodium
Created July 15, 2023 16:05
Show Gist options
  • Save xenodium/4bb138ade9f476ff71e03e6529f4c875 to your computer and use it in GitHub Desktop.
Save xenodium/4bb138ade9f476ff71e03e6529f4c875 to your computer and use it in GitHub Desktop.
dwim-shell-commands-duplicate tramp experiment
(defun dwim-shell-commands-duplicate ()
(interactive)
(dwim-shell-command-on-marked-files
"Duplicate file(s)."
"cp '<<f>>' '<<f(u)>>'"
:utils '("cp" "scp")
:post-process-template
(lambda (script file)
(if (tramp-tramp-file-p file)
;; Tramp file path start with "/ssh:". Drop it.
(string-replace "/ssh:" ""
(replace-regexp-in-string "^cp" "scp" script))
script))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment