Sunday, June 29, 2014

Re: How to substitute text with combining characters?

On Sunday, June 29, 2014 5:08:08 AM UTC+7, glts wrote:
> On Saturday, June 28, 2014 6:21:23 PM UTC+2, kks...@gmail.com wrote:
>
> > For text `é,e` (\x65 \u0301 \x2c \x65):
>
> >
>
> > If I use `:s/\Ze/x/g`, I get `x,x`. How to get `x́,x`?
>
> >
>
> > If I use `:s/́/̂/g` (substitue \u0301 with \u0302), I get ̂`,e`. How to get `ê,e`?
>
> >
>
> > Is this a bug or not?
>
>
>
> The first example works for me. Have you tried with a recent version of
>
> Vim?
>
>
>
> The second example I managed to get working with this hack:
>
>
>
> :s/.́/\=submatch(0)[0:(strlen(nr2char(char2nr(submatch(0))))-1)] . "\u0302"/g
>
>
>
> This matches any character with an acute on it, then chops off the bytes
>
> following the base character (that is, the combining acute), and then
>
> concatenates the base character with the combining circumflex. I made
>
> sure that it works for multi-byte base characters, too. But there has
>
> got to be an easier solution.
>
>
>
> Vim support for combining characters isn't complete. Check the todo list
>
> at ":h todo" (be aware that todo.txt talks about "composing characters"
>
> instead of the proper "combining characters").
>
>
>
>
>
> --
>
> David

Both examples did not work on my Vim 7.4.335.

Thanks for the hints ":h todo" and "composing character". It seems what I want is a "known bug".

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: