2.1 Interactive Substring Matching

As you type in a substring, the list of buffers or files currently matching the substring is displayed as you type. The list is ordered so that the most recent buffers or files visited come at the start of the list.

The buffer or file at the start of the list will be the one visited when you press RET. By typing more of the substring, the list is narrowed down so that gradually the buffer or file you want will be at the top of the list. Alternatively, you can use C-s and C-r (or the right and left arrow keys) to rotate buffer or file names in the list until the one you want is at the top of the list.

Completion is also available so that you can see what is common to all of the matching buffers or files as you type.

For example, if there are two buffers called 123456 and 123, with 123456 the most recent, when using ido-switch-buffer, you first of all get presented with the list of all the buffers

Buffer: {123456 | 123}

If you then press 2:

Buffer: 2[3]{123456 | 123}

The items listed in {...} are the matching buffers, most recent first (buffers visible in the current frame are put at the end of the list by default). At any time you can select the item at the head of the list by pressing RET. You can also put the first element at the end of the list by pressing C-s or RIGHT, or bring the last element to the head of the list by pressing C-r or LEFT.

The item in [...] indicates what can be added to your input by pressing TAB (ido-complete). In this case, you will get "3" added to your input.

So, press TAB:

Buffer: 23{123456 | 123}

At this point, you still have two matching buffers. If you want the first buffer in the list, you can simply press RET. If you want the second in the list, you can press C-s to move it to the top of the list and then press RET to select it.

However, if you type 4, you’ll only have one match left:

Buffer: 234[123456]

Since there is only one matching buffer left, it is given in [] and it is shown in the ido-only-match face (ForestGreen). You can now press TAB or RET to go to that buffer.

If you want to create a new buffer named 234, you can press C-j (ido-select-text) instead of TAB or RET.

If instead, you type a:

Buffer: 234a [No match]

There are no matching buffers. If you press RET or TAB, you can be prompted to create a new buffer called 234a.

Of course, where this function really comes in handy is when you can specify the buffer using only a few keystrokes. In the above example, the quickest way to get to the 123456 file would be just to type 4 and then RET (assuming there isn’t any newer buffer with 4 in its name).

Likewise, if you use C-x C-f (ido-find-file), the list of files and directories in the current directory is provided in the same fashion as the buffers above. The files and directories are normally sorted in alphabetical order, but the most recently visited directory is placed first to speed up navigating to directories that you have visited recently.

In addition to scrolling through the list using <right> and <left>, you can use <up> and <down> to quickly scroll the list to the next or previous subdirectory.

To go down into a subdirectory and continue the file selection on the files in that directory, simply move the directory to the head of the list and hit RET.

To go up to the parent directory, delete any partial file name already specified (e.g., using DEL) and hit DEL.

To go to the root directory (on the current drive), enter two slashes. On MS-DOS or Windows, to select the root of another drive, enter ‘X:/’ where ‘X’ is the drive letter. To go to the home directory, enter ‘~/’. To enter Dired for this directory, use C-d.

You can also visit files on other hosts using the ange-ftp notations ‘/host:’ and ‘/user@host:’.

You can type M-p and M-n to change to previous/next directories from the history, M-s to search for a file matching your input, and M-k to remove the current directory from the history.

If for some reason you cannot specify the proper file using ido-find-file, you can press C-f to enter the normal find-file. You can also press C-b to drop into ido-switch-buffer.