Why Nostr? What is Njump?
2024-11-07 23:27:48

woland on Nostr: Did you know that you can replace a regex with unicode character in Vim? When is it ...

Did you know that you can replace a regex with unicode character in Vim? When is it useful?
When mass formatting a text. Such as replacing all instances of {...} with {…}. Or all dashes with en-dash or em-dash.

:%s/\.\.\./\=nr2char(0x2026)/gc

nr2char() replaces the matched regex with the character represented by its unicode value.

#vim #regex
Author Public Key
npub1su3jjxe2keh9fz5zuyrypcxcjdksjnfx3gwkwx7ylvtny69hj5ps4fgahu