6

Is there something similar to the CommandT plugin in vim for emacs? I know some plugins that do directory-based completion, but is there one that does matching on the full paths?

An example:

├── bar
│   └── hello
├── baz
│   └── test
│       └── hello
└── foo
    ├── hello
    └── lost

baz
baz/test
baz/test/hello
bar
bar/hello
foo
foo/hello
foo/lost

Now when I type 'h', I'd like the paths

baz/test/hello
bar/hello
foo/hello

to match. For 't', there should be

baz/test/hello
foo/lost
Reactormonk
  • 21,472
  • 14
  • 74
  • 123
  • Perhaps you could describe the "CommandT plugin in vim" so that Emacs users have some hope of answering your question? – phils Dec 18 '11 at 15:47
  • There would be a nice screencast, but looks like the web isn't totally rid of quicktime yet. https://wincent.com/products/command-t – Reactormonk Dec 18 '11 at 16:02
  • I asked pretty much the same question here, and got some other answers that might prove useful: http://stackoverflow.com/questions/15631325/command-t-for-emacs. – FullOfCaffeine Mar 06 '14 at 20:07
  • I considered implementing something like that myself, IIRC it ended up as a helm matcher somewhere. The biggest problem is speed, elisp simply isn't fast enough, and stallman doesn't like linking C into emacs. – Reactormonk Mar 06 '14 at 20:53

2 Answers2

5

ido does this AFAIK, and also anything.el.

Also, this emacswiki page has a list packages which do something similar.

Edit: According to Drew's comment Ido does not match the whole path. Anything on the other hand does, as it can be seen on the screenshot behind the link.

Tom
  • 7,515
  • 7
  • 38
  • 54
  • 3
    AFAIK, Ido does *not* match absolute file names. Like ordinary Emacs file-name completion, you can of course match a prefix to change directories (navigate the directory hierarchy), but AFAIK Ido adds nothing to the mix for matching different parts of a file-name "path" (directory part). – Drew Dec 18 '11 at 16:32
  • Thanks, I've added your comment to the answer. – Tom Dec 18 '11 at 17:09
3

Icicles does matching on full paths (i.e., any and all parts of an absolute file name). See Icicles File-Name Input.

By default, in Icicle mode C-x C-f is bound to icicle-file:

  • without a prefix arg -- uses the usual Emacs relative file-name completion

  • with a prefix arg (e.g. C-u C-x C-f) -- does absolute file-name completion

Command icicle-find-file-absolute is the same as C-u C-x C-f. You can bind it if you don't want to use the key sequence C-u C-x C-f each time.

During completion of either type (relative/absolute file names), you can use any of the Icicles completion features, such as:

And file-name completion commands such as these are multi-commands, which means you can act on multiple files with the same command. See also command icicle-locate, which does absolute file-name matching and lets you find and act on files anywhere on your file system, without knowing their locations.

Drew
  • 29,895
  • 7
  • 74
  • 104