Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command-T in emacs

Tags:

emacs

plugins

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
like image 317
Reactormonk Avatar asked Dec 18 '11 15:12

Reactormonk


People also ask

What does M in a shortcut command stand for in Emacs?

M- means "meta key", (“Escape” in the lab, on other computers sometimes “Alt”). For meta commands with the Escape key, press the Escape key and then release it, then press the other key. Thus M-f stands for the keyboard sequence "press and release the Escape key", " press f".

How do I run commands in Emacs?

You can run any Emacs command by name using M-x , whether or not any keys are bound to it. If you use M-x to run a command which also has a key binding, it displays a message to tell you about the key binding, before running the command.

What is the C key in Emacs?

Emacs uses the C- prefix to denote holding down Ctrl while pressing another key. For example, holding down Ctrl and pressing x is denoted as Ctrl-x in the rest of the Knowledge Base, but as C-x in Knowledge Base documents about Emacs.


2 Answers

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.

like image 190
Tom Avatar answered Oct 23 '22 19:10

Tom


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:

  • progressive completion (match name parts in any order)
  • candidate help
  • candidate cycling
  • candidate sorting
  • fuzzy completion (the Vim screencast you cite uses the equivalent of Icicles "scatter" matching and Ido "flex" matching)

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.

like image 3
Drew Avatar answered Oct 23 '22 18:10

Drew