Stuart Halloway’s recent screencast titled What You Can Learn From ido.el convinced me that I need to give ido-mode another look, especially since I didn’t realize it had support for flex (aka fuzzy) matching. I was always envious of the fuzzy matching that TextMate users received when finding a file in a project.
I’ve tried ido in the past, but it always turned me off. Today I realized why, and I was finally motivated enough to find a fix. I am a big fan of tab-completion everywhere, so when tab-completion doesn’t work like I expect, I get upset. As it turns out, this is why I (unfairly) disliked ido-mode at first. Due to some other trickery that I would rather not go into, I was guaranteeing that
<tab> in the minibuffer would always call
minibuffer-complete, which broke the tab behavior in ido:
(define-key minibuffer-local-map [tab] 'minibuffer-complete)
In summary, I’m a doofus. I should probably re-investigate the need for the above mapping; it was necessary because of a global key binding that I shouldn’t have made global in the first place. Without going down that rat hole just yet, here’s my workaround for now:
(ido-mode t) (setq ido-enable-flex-matching t) ; fuzzy matching is a must have ;; This tab override shouldn't be necessary given ido's default ;; configuration, but minibuffer-complete otherwise dominates the ;; tab binding because of my custom tab-completion-everywhere ;; configuration. (add-hook 'ido-setup-hook (lambda () (define-key ido-completion-map [tab] 'ido-complete)))
I’m going to give ido-mode a fair chance this time, and I think I’m going to like it. I anticipate growing my custom ido configurations in the near future, and ido-mode could easily make it as a package fave. Thanks Stu.
For those of you who have already realized the power of Interactive Do, what power tricks do you recommend?
Update: Flex or fuzzy matching is the ability to match any item containing the characters in the given sequence. For example, “mwc” might match a file named “my_wicked_class.rb.”