The equivalent of a GUI "Quick Open" in Emacs on CLI?

The title probably doesn't describe this question well enough. Many GUI-based editors allow you to press a key combination and then start typing a file name (anywhere, in any directory) and as you're typing, a list is filtered down of all the files matching that pattern, in realtime. If you hit enter, the currently highlighted file will be opened, or if you hit the UP or DOWN arrows you can change the selection. For example, in TextMate and Sublime Text 2 (on OS X) this is achieved by hitting CMD+T.

在这里输入图像描述

Now I know about find-dired and find-grep in Emacs, but is there anything else available that's a little more instant? The annoying thing with dired is that you have to hit enter and perform the search in order to see if the filename was correct. This is ok if you know the filename, but not so good when you're going based on educated guesses. It seems like something emacs could be suited to. Set the directory to index (just once) then when searching filter the index using a Radix tree search or some such, using a split window to show files and responding to the UP and DOWN arrows to adjust the selection.

Anything out there? :)


ido-mode is perfect for this. It has countless useful applications, including fuzzy filename matching as you demonstrated in your picture.

ido-mode running in my emacs http://img694.imageshack.us/img694/8519/bildschirmfoto20110911uyu.png

Some things to get started:

  • What You Can Learn From ido-mode
  • EmacsWiki article
  • Introduction to Ido Mode

  • Anything.el does this with files and it can do much more. Here's a good introduction on how to use it.


    ido-mode is great on its own, but you may find the likes of Find File In Project a better option for matching filename patterns anywhere within a directory tree.

    Mx find-file-in-project RET chooses the root of the directory tree automatically (based on the directory-local variables file).

    I'm just now noticing that the Mx ffip-find-file-in-dirtree RET which I also have available (and which works on arbitrary specified directory trees, irrespective of project files) is actually provided by the ffip.el included with nxhtml.

    The latter also looks like it supports ido when it's enabled. (Actually, there's a bug, but change (if (memq ido-mode '(file 'both)) to (if (memq ido-mode (list 'file 'both)) in (defun ffip-find-file-in-project (file) ...)

    There will doubtless be a variety of similar options available.

    链接地址: http://www.djcxy.com/p/62178.html

    上一篇: 如何为C ++创建EDE项目

    下一篇: 相当于Emacs CLI中的GUI“快速打开”?