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 May 4, 2021 at 15:53
  • What about using perl's capabilities in a vim function, or as a filter?
    – Jens
    May 5, 2021 at 6:50

1 Answer 1


You asked for elegant, but got no answer... so here's the non-elegant way, listing all 25 characters defined as whitespace:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.