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