Monday, May 30, 2011

Re: Searching for accented characters.

Hi,

Beren Sanders wrote:
> On Sun, May 29, 2011 at 8:25 PM, Tim Chase <vim@tim.thechases.com> wrote:
>> On 05/29/2011 06:43 PM, Beren Sanders wrote:
>>>
>>> Is there an easy standard way to make accented characters match searches
>>> for
>>> their normal counterparts?
>>>
>>> For example, I obtain "é" by typing "<CTRL>-k ' e" and I would like to set
>>> it up so that searching for "Ajoute" will match both "Ajoute" and
>>> "Ajouté".
>>
>> It sounds like you might want Vim's equivalence classes:
>>
>> /Ajout[[=e=]]
>>
>> which you can read about at
>>
>> :help /[[=
>>
>> Note the caveat about Latin1 vs. other encodings.
>>
>> -tim
>
> Thanks Tim. Do you (or someone else) know someway of making the
> equivalence class [[=e=]] the default interpretation of an 'e' in the
> search string? In other words, although it is great that [[=e=]]
> matches all the versions of 'e', it involves typing seven characters
> instead of just one.
>

I don't know of any way to make equivalence classes the default
interpretation, but you can always define mappings to expand a letter
into its equivalence class, e.g.:

cnoremap <expr> e getcmdtype() =~ '[?/]' ? '[[=e=]]' : 'e'

If you really need an 'e' you have to press Ctrl-V before 'e' then.

Regards,
Jürgen

--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment