Added a few improvements to dwim-shell-command.
In DWIM style, if you happen to have a dired region selected, use region files instead. There's no need to explicitly mark them.
Use <<cb>>
to substitute with clipboard content. This is handy for cloning git repos, using a URL copied from your browser.
git clone <<cb>>
This illustrates <<cb>>
usage, but you may want to use dwim-shell-commands-git-clone-clipboard-url
from dwim-shell-commands.el instead. It does the same thing internally, but makes the command more accessible.
(defun dwim-shell-commands-git-clone-clipboard-url ()
"Clone git URL in clipboard to `default-directory'."
(interactive)
(dwim-shell-command-on-marked-files
(format "Clone %s" (file-name-base (current-kill 0)))
"git clone <<cb>>"
:utils "git"))
Use <<n>>
to substitute with a counter. You can also use <<3n>>
to start the counter at 3.
Handy if you'd like to consistently rename or copy files.
mv '<<f>>' 'image(<<n>>).png'
Can also use an alphabetic counter with <<an>>
. Like the numeric version, can use any letter to start the counter with.
mv '<<f>>' 'image(<<an>>).png'
Use a prefix command argument on dwim-shell-commands
to repeat the command a number of times. Combined with a counter, you can make multiple copies of a single file.
Set dwim-shell-command-prompt-on-error
to nil to skip error prompts. Focus process buffers automatically instead.
By default, dwim-shell-command
shows all supported placeholders. You can change that prompt to something shorter using dwim-shell-command-prompt
.
The changes are pretty fresh. Please use with caution (specially the counter support).