2012-07-16 95 views
5

我經常使用dired-mode和我最近使用ido開始:獲取IDO在dired緩衝區

(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 

當我在dired緩衝區拷貝一個文件(C),我還是要使用「標準方式」給出文件被複制到的新位置。這意味着,我必須使用標準的TAB完成功能,但完全不存在。這同樣適用於R移動文件等。因此,我想知道是否有可能獲得ido也作用於dired緩衝區CR

回答

6

看起來我擁有了你所遇到的同樣的問題。一些調查顯示,我們需要覆蓋變量read-file-name-function,默認情況下,它調用read-file-name-function-default。但是,查看ido-everywhere(這是一個小模式)的源代碼,它爲我們做了這個。

解決方案:

而不是做(setq ido-everywhere t),替換成:

(ido-everywhere t)

這修復它爲我,害ido-read-file-name在dired的緩衝區調用當您使用C或類似。

另一種選擇:

你也可以考慮的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. 
+0

有趣的是,'C'用於複製的作品,但'R'爲重命名和移動不會以這種方式工作:-( – 2012-07-16 15:49:38

+0

使用'調試上entry'我發現R'和'活動的差異' C'。'R'使用'dired-標記讀取文件name',然而, 'C' 不。 – 2012-07-16 17:53:14

+0

而從文檔'C'是一個封閉而'R'是一個函數。 – 2012-07-16 18:01:14

3

我發現(put 'dired-do-rename 'ido 'find-file) R鍵正常工作,如果你需要要停止路徑,只需按C-j而不是完成文件名。

+0

不幸的是,這並沒有改變我的任何事情。 – 2013-01-08 09:52:10

+0

你能解釋一下你想做什麼以及它不工作嗎?還有,爲什麼downvote? – Silex 2013-01-19 12:35:34

+0

這篇文章確實不是很精確。我後來才發現(見下文)關於這種「解決方案」的影響/變化。 downvote可能是因爲副作用。這不是一個乾淨的解決方案,它影響許多其他「良好」的行爲,因此不應該小心使用。我應該只是說了它而不是使用downvote按鈕。非常遺憾。 – 2013-01-19 16:41:22