I'd like to match in Vim any whitespace character, not only normal space (U+0020) and tab (U+0009) with \s, and the other ASCII ones like form feed (U+000C) with [[:space:]], but any Unicode whitespace character, like e.g. NBSP (U+00A0), ENSP (U+2002), "asian space" (U+3000), etc., without listing them all in [].

One would like to match whole Unicode category (Zs), but Vim pattern syntax does not seem to support those, unlike eg. Perl (\p{}).

Equivalence class matching cannot be used as well. Eg. [[=a=]] matches all "aàá", but [[= =]] matches only ordinary space character.

Is there an elegant way to do it?

  • not possible with vim regular expressions – Christian Brabandt May 4 at 15:53
  • What about using perl's capabilities in a vim function, or as a filter? – Jens May 5 at 6:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.