Any way to make combining characters be separate?

23 views
Skip to first unread message

Ron Aaron

unread,
Apr 16, 2023, 12:25:12 AM4/16/23
to vim_dev
As a followup to my previous post re delcombine , I'm looking for an option to display combining characters separately.  That is, to treat them as if they were regular characters, in order to make editing them much easier.

I can't find an option for that. I'm willing to create one, but I'm not sure where the right place to do that is.

Bram Moolenaar

unread,
Apr 16, 2023, 11:44:31 AM4/16/23
to vim...@googlegroups.com, Ron Aaron

> As a followup to my previous post re delcombine
> <https://groups.google.com/g/vim_dev/c/oUjjv92rLSg/m/mPDPszs1AgAJ> , I'm
> looking for an option to display combining characters separately. That is,
> to treat them as if they were regular characters, in order to make editing
> them much easier.
>
> I can't find an option for that. I'm willing to create one, but I'm not
> sure where the right place to do that is.

No, this currently does not exist.

What you perhaps could do is write two mappings. One would take the
text of a line and put a space in front of each combining character.
The second mapping would do the reverse.

--
BRIDGEKEEPER: What is your favorite colour?
LAUNCELOT: Blue.
BRIDGEKEEPER: Right. Off you go.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Ron Aaron

unread,
Apr 18, 2023, 10:40:21 AM4/18/23
to vim_dev
Hmm. OK, that's not as awkward as using the xxd hack. I'll try it.

Ron Aaron

unread,
Apr 23, 2023, 2:57:12 AM4/23/23
to vim_dev
I find that there seems to be a problem with "%s" in this regard.

Source text: "וְהָאָרֶץ, הָיְתָה תֹהוּ וָבֹהוּ"

If I search using / for \u05b8 the search fails. If I instead use Ctrl+V in insert that character, the search works.

However, using "s" and a character class I cannot find either, e.g. :s/[\u05b0-\u05c0]/ fails to find it.

This seems to be a bug in how combining characters are dealt with.

Bram Moolenaar

unread,
Apr 23, 2023, 12:50:58 PM4/23/23
to vim...@googlegroups.com, Ron Aaron

> I find that there seems to be a problem with "%s" in this regard.

What do you mean with "%s" ?

> Source text: "וְהָאָרֶץ, הָיְתָה תֹהוּ וָבֹהוּ"
>
> If I search using / for \u05b8 the search fails. If I instead use Ctrl+V in
> insert that character, the search works.
>
> However, using "s" and a character class I cannot find either, e.g.
> :s/[\u05b0-\u05c0]/ fails to find it.
>
> This seems to be a bug in how combining characters are dealt with.

Perhaps, depends on how you look at it. A search normally sees a
character plus any following combining character as one item. Therefore
a match will be tried at a base character, and the next tries at the
next base character. There is no try for a match on a composing
character. This may seem wrong when searching for a composing
character, but many items such as "." would match while they should not.

You can prepend a "." before the composing character and then somehow
handle matching the base character as well. This is a bit tricky.

--
The MS-Windows registry is no more hostile than any other bunch of state
information... that is held in a binary format... a format that nobody
understands... and is replicated and cached in a complex and largely
undocumented way... and contains large amounts of duplicate and obfuscated
information... (Ben Peterson)
Reply all
Reply to author
Forward
0 new messages