In which I enable ido-mode for fast buffer and file switching.


Published by Avdi Grimm


  1. Good stuff, Avdi. But you forgot one of the most useful features of ido: matching anywhere in a pathname. Very useful e.g in the db/migrations directory, where you can just type the name, ignoring the leading timestamps, and Emacs finds your stuff 🙂

  2. // and /~/ work in normal find-file as well. And hitting ctrl-f during Ido lookup reverts back to the normal find-file/find-buffer which I find I need occasionally (and I might not be able to use Ido if it wasn’t possible, so feels like it’s worth highlighting.)

    Two things I wish I could fix (in case anyone knows):

    I’d kinda like to match an entire path, without regard for directory levels, i.e., without having to hit return to enter a directory. Maybe too hard.

    Sometimes when I’m typing a file name, the current selected file changes even if the new characters match the current filename.

    I presume that second one is because Ido assumes if the right file is selected and I’m still typing, I must want a different file. But I often type ahead and so this ends up wrong. That’s basically the same problem with directory selection. Anything that requires I know what is currently matched before I type another character creates a glitch for me.

    Thanks for the info. I gotta go watch the rest now. (And buy the book.)

  3. Completely orthogonal: in post.rb, you have code which goes like ‘hide_singletons [constants]’ and it is “correctly” indented (as in – how I’d do it by hand. If I use ruby-mode’s indent (C-M-) it will align the constants under ‘hide_singletons’ instead of with the start of the previous line. Wrapping the method in parens fixes this behavior but its not the community standard so it’s not a sustainable solution. I couldn’t find anything obvious to customize here. Any tips?

  4. One great shortcut I found on the web, in addition to typing characters to fuzzy (flex) match filter, C-SPC “commit” the filter and reduce the number of displayed candidates. Really neat when digging for common names/prefixes since fuzzy match isnt fast on large lists.

  5. I’ve tried ido a couple times now and really disliked the non-emacsy UI choices that they made. I’m trying it again just for a change and at least I found out that you can stick the output heigh to a single line. Some of the key bindings are just so unintuitive (ok… to a long-time emacs user) that I may have to disable it soon.

    I’d REALLY like to have a generic fuzzy-match function available for a completion function replacement.

    • Which bindings don’t you like?

        • I almost never use C-x C-d, instead using regular find-file and then hitting return on a directory.
        • Removing M-r, searching previously visited files in my file history.
        • DEL for going up a directory actually drives me a bit nuts… I’m trying tho.
        • Fucking with my C-a, C-e, M-f, M-b. ARGH! Don’t mess with global emacs editing defaults!

        Looking at what I’ve tweaked so far (god I love M-x customize-unsaved!), turning off auto-merge-directories has helped my sanity, as has max-window-height and enable-dot-prefix.

        • I have similar issues with ido – never understood it’s use-case frankly, it’s not like TAB doesn’t give you everything already.

          • I shiver at the thought of being stuck with only vanilla tab-completion in Emacs. I rather like not having to remember what number filenames in places like /etc/init.d begin with. I can just type in the word part of the name and find what I’m looking for easily.

          • Not sure how long ago you were using tab completion, but vanilla (a la plain old Bash style) isn’t really an accurate description, /e/i./TAB is going to list everything in /etc/init.d/ … The tab matching is quite similar to zsh, although it doesn’t do zsh’s “//name TAB” (you could wildcard it though) which looks in all folders 2 levels deep, although you pay for that waiting for the search. If ido finds a file anywhere without path specs, and does it quick, I’ve missed an important feature… Did I? … Enhanced flex/fuzzy matching would be cool, but the compulsory nature of ido’s defaults are in my way.

          • In a large directory, tab-completing to see a file list is damn near useless. Not to mention I don’t want to see a listing; I just want to go to the file I’m thinking of. With ido if there is a file called “20-fooble” in a directory, I can just start typing “f-o-o…” and ido will narrow down to the “20-fooble “file.

            It will also do the kind of completion you’re talking about much more interactively. No guesswork about how many letters I need for
            an unambiguous match because I can watch it as it narrows.

          • In this use case, I can see why you’d want ido, the problem is all the other assumptions IDO places in my way. As I say, if it could be stripped down to it’s flex/fuzzy matching component I wouldn’t be averse to using it at all. While it may be less natural for you, 2-fTAB gets me 20-fooble fast enough. You’d be in equal shtoock if you had 20-fooble, 21-fooble, 22-fooble, … 99-fooble, right? if I knew that my filename was fooble but couldn’t remember the number prefix I could also wildcard my way to it (*foTAB) which is acceptable to me because it follows patterns which I’ve used for 25+ years.

  6. have you tried smex?

    It’s basically IDO but for M-x


Leave a Reply

Your email address will not be published. Required fields are marked *