Get ido in dired buffers

。_饼干妹妹 提交于 2019-12-07 04:46:54

问题


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?


回答1:


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.



回答2:


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!