TL; DR:
この機能はdired-x
、Diredではなくから提供されます。(require 'dired-x)
initファイルで使用してからカスタマイズしdired-guess-shell-alist-user
ます。
私たちはDiredがどこに接続するかを見ることができますdired-x
:
(defun dired-read-shell-command (prompt arg files)
"Read a dired shell command.
PROMPT should be a format string with one \"%s\" format sequence,
which is replaced by the value returned by `dired-mark-prompt',
with ARG and FILES as its arguments. FILES should be a list of
file names. The result is used as the prompt.
This normally reads using `read-shell-command', but if the
`dired-x' package is loaded, use `dired-guess-shell-command' to
offer a smarter default choice of shell command."
(minibuffer-with-setup-hook
(lambda ()
(set (make-local-variable 'minibuffer-default-add-function)
'minibuffer-default-add-dired-shell-commands))
(setq prompt (format prompt (dired-mark-prompt arg files)))
(if (functionp 'dired-guess-shell-command) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<
(dired-mark-pop-up nil 'shell files
'dired-guess-shell-command prompt files)
(dired-mark-pop-up nil 'shell files
'read-shell-command prompt nil nil))))
dired-x
マニュアルを読んだ後、カスタマイズできる(info "dired-x")
変数dired-guess-shell-alist-user
について学びます。
これは変更の例です dired-guess-shell-alist-user
(setq dired-guess-shell-alist-user
'(("\\.e?ps$" "gv" "xloadimage" "lpr")
("\\.chm$" "xchm")
("\\.rar$" "unrar x")
("\\.e?ps\\.g?z$" "gunzip -qc * | gv -")
("\\.pdf$" "zathura")
("\\.flv$" "mplayer")
("\\.mov$" "mplayer")
("\\.3gp$" "mplayer")
("\\.png$" "feh")
("\\.jpg$" "feh")
("\\.JPG$" "feh")
("\\.avi$" "mplayer")))