[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: does emacs support incremental searching for partial matches?
From: |
Drew Adams |
Subject: |
RE: does emacs support incremental searching for partial matches? |
Date: |
Tue, 22 Feb 2011 12:42:24 -0800 |
> >> I'm wondering if emacs has built-in support for
> >> incremental searching for partial matches, such as searching
> >> for 'memcache' matches 'memorycache'.
> >
> > You can use regexp search: `C-M-s mem.*cache'.
> > See `C-h r g regexp search RET'.
>
> Hi Drew, thank you for your help!
> Sometimes I would be able to know the .* part, for example, I want to
> match WindowsMemoryCacheManagement by using 'memcache'. With regular
> expression, I have to specify .*m.*e.*m.*c.*a.*c.*h.*e.*
I don't understand. Why would you have to specify that? You should be able to
match `WindowsMemoryCacheManagement' using just `C-M-s mem.*cache'. Or maybe
you meant that you do _not_ know where the possible skips are located?
> Is there any command or plugin I can use?
Do you mean something that lets you not need to include the `.*'?
I.e., to type only `memcache', not `mem.*cache'?
Again, IMHO it's not a big deal to type `.*'. But if that's what you're looking
for then yes, you can use Icicles search with scatter-match completion.
This kind of completion is the same as TextMate's file-name completion and Ido's
flex-match completion. It automatically inserts `.*' between every pair of
characters you type - nothing more. So you type only `memcache' and it thinks
`m.*e.*m.*c.*a.*c.*h.*e'.
In Icicles you can change the completion mode to scatter matching at any time by
hitting `M-(' in the minibuffer. `M-(' cycles the possible matching modes for
`S-TAB' completion: `apropos' (regexp), `scatter', `Levenshtein', `Levenshtein
strict', and `Jaro-Winkler'. (Apropos completion is the `S-TAB' default.)
Icicles search (an incremental search that uses completion):
http://www.emacswiki.org/emacs/Icicles_-_Search_Commands%2c_Overview
Scatter-match completion:
http://www.emacswiki.org/emacs/Icicles_-_Fuzzy_Completion
But I recommend that you just get used to using a regexp pattern, regardless of
the search tool you use. You won't regret it.