daj
daj

Reputation: 7183

Is there an Emacs keyboard shortcut for selecting between ambiguous buffer names when switching buffers

In emacs I'm already using iswitchbuffer, but I would still like to be more productive with my buffer switching.

One common case which arises a lot is that I have 6 or 7 identical or near-identical file names. For example:

server.py<proj1> server.py<proj2> server.py<proj3>... foo_server.py<proj4>

The problem is that I have to type out most of the directory context when I'm switching buffers.

An existing alternative to typing the directory context is a completion window which pops up saying:e

Click on a completion to select it.
In this buffer, type RET to select the completion near point.

Possible completions are:
... ....

but this is unsatisfactory as well since I have to the switch to the window and use the mouse to pick one.

What I'd prefer is to use tab or some other key to highlight alternative buffer selections, then enter to select one. Is there a way to do this?

Upvotes: 0

Views: 203

Answers (2)

Stefan
Stefan

Reputation: 28541

If you use icomplete-mode (which is a bit like iswitchb-mode but applies to all completions rather than only for buffers), you can cycle to the next/previous matching candidate with C-, and C-..

Another option, if you use the default completion system (with or without icomplete-mode), is to type serv*1 (for example) to select server.py<proj1>.

Upvotes: 0

Randy Morris
Randy Morris

Reputation: 40927

In iswitchb-mode (and its successor1 ido-mode) the default binding for cycling through candidates are Ctrl+s and Ctrl+r.

You should be able to limit your candidates by typing the common bit of the filename then cycle through those candidates with those bindings.

1 See the header text in iswitchb.el and ido.el.

Upvotes: 1

Related Questions