I frequently use dired-mode
and I recently started using ido
:
(ido-mode 1); enable ido-mode
(setq ido-enable-flex-matching t); flexibly match names via fuzzy matching
(setq ido-everywhere t); use ido-mode everywhere, in buffers and for finding files
(setq ido-use-filename-at-point 'guess); for find-file-at-point
(setq ido-use-url-at-point t); look for URLs at point
(setq ffap-require-prefix t); get find-file-at-point with C-u C-x C-f
When I copy a file (with C
) in a dired buffer, I still have to use the "standard way" of giving the new location where the file is copied to. That means, I have to use standard TAB-completion but there is no ido
-completion. The same applies for R
for moving files etc. I am thus wondering if it is possible to get ido
also acting on C
or R
in dired buffers?
Looks like I had the same problem you are experiencing. Some investigating shows that we need to override the variable read-file-name-function
which, by default, calls read-file-name-function-default
. But, looking at the source code for ido-everywhere
(which is a minor mode), it does this for us.
Solution:
Rather than doing (setq ido-everywhere t)
, replace that with:
(ido-everywhere t)
This fixes it for me, causing ido-read-file-name
to be called in dired buffers when you use C
or similar.
Another Option:
You might also consider this beefed up version of ido-everywhere
:
https://github.com/DarwinAwardWinner/ido-ubiquitous
;;; Commentary:
;; You may have seen the `ido-everywhere' variable in ido.el and got
;; excited that you could use ido completion for everything. Then you
;; were probably disappointed when you realized that it only applied
;; to *file names* and nothing else. Well, ido-ubiquitous is here to
;; fulfill the original promise and let you use ido completion for
;; (almost) any command that uses `completing-read' to offer you a
;; choice of several alternatives.
I found that (put 'dired-do-rename 'ido 'find-file)
for the R key works fine, if you need to stop at a path you simply press C-j
instead of completing a file name.
来源:https://stackoverflow.com/questions/11505878/get-ido-in-dired-buffers