In Ruby and Perl there is =~ to match a pattern (regex) and !~ to not match a pattern:
"foo" =~ /o/
"foo" !~ /o/
It would be nice to have ligatures for both of these operators.
I propose the _almost equals sign_ and the _not almost equals sign_:
"foo" β /o/
"foo" β /o/
(Adjusted for width, of course)
Regarding #167 (export PATH=~/.local/bin:$PATH) β I thinks it's safe to "activate" these ligatures only when there is whitespace around them (which is the idiomatic way to write the operators in both, Ruby and Perl): X =~ Y would trigger, X=~Y would not.
These ligatures seem pretty invasive to me. They completely change the perception of the actual operator which has a specific meaning in these languages. I think readers would get confused when seeing them, but that's just my personal opinion.
Another option, which would preserve the distinct parts of the original operators:
foo β
/o/
foo β /o/
Where the tilde is used for the home directory it is almost always immediately followed by a slash. This could have been used to suppress the ligature and thus handle #167. Regular expressions are also often enclosed by slashes, but there usually is a space before the leading slash.
@Drenmi's suggestion of an elongated or centered U+2245 β
for =~ seems sound, but for !~ I'd rather expect something like U+2249 β instead of U+2247 β, U+2246 β or U+2244 β. There does not seem to be a precomposed character in Unicode of a single tilde with diagonal strike-through.
On second thought, ~= consitutes a precedent. It is rendered as an elongated U+2243 β currently, so =~ could also become an elongated U+2242 β.
but there usually is a space before the leading slash
I canβt rely on this sort of heuristic. It wonβt work too often and users will end up with some magic replacement that sometimes works but sometimes does not. That increases confusion, and Fira Code goal always was to decrease confusion.
Sometimes ~ is an unary operator; or used as a home directory.
e.g. I wouldn't want this to render differently:
PATH=~/.local/bin:"$PATH"
Nor this lua 5.3 code (where ~ is unary bitwise NOT):
foo=~bar
Added to ss07
Most helpful comment
Another option, which would preserve the distinct parts of the original operators: