如果当前目录中没有匹配,任何方法使ido-find-file切换到另一个最近打开的文件?

时间:2013-04-20 13:59:08

标签: emacs elisp dot-emacs ido

Emacs ido非常好,它使我的工作更有效率。

但我感到相当恼火的是,当她认为当前目录中没有匹配我输入的字符串时,总是会自行更改目录。虽然在大多数情况下我希望她能留下来。

我知道有一些关键图可以解决这个问题:额外的 C - f 将返回正常的find-file模式,而 C - j 可用于强制ido使用当前目录。但是,是否存在任何使ido默认限制在当前目录的设置?

1 个答案:

答案 0 :(得分:0)

此功能称为auto-merge。以下三个选项与该功能相关:

(defcustom ido-auto-merge-work-directories-length 0
  "Automatically switch to merged work directories during file name input.
The value is number of characters to type before switching to merged mode.
If zero, the switch happens when no matches are found in the current directory.
Automatic merging is disabled if the value is negative."
  :type 'integer
  :group 'ido)

(defcustom ido-auto-merge-delay-time 0.70
  "Delay in seconds to wait for more input before doing auto merge."
  :type 'number
  :group 'ido)

(defcustom ido-auto-merge-inhibit-characters-regexp "[][*?~]"
  "Regexp matching characters which should inhibit automatic merging.
When a (partial) file name matches this regexp, merging is inhibited."
  :type 'regexp
  :group 'ido)

例如,您可以延迟更长时间或禁用此功能。要停用此功能,请将以下语句添加到.emacs

(setq ido-auto-merge-work-directories-length -1)

C-z 键绑定也会取消最后一个auto-merge。请参阅ido.el中的以下代码段:

(define-key map "\C-z" 'ido-undo-merge-work-directory)