Toggle !Not

Would it be possible to add a command to toggle the NOT "!" symbol in various conditions with a keyboard shortcut?

Let's say the shortcut is Alt+` (back quote), or Alt+1  (this may vary per keyboard layout, obviously).

::Examples::

| <-- represents the cursor

Work with boolean logic:
if (var1 ==| var2)
(keyboard shortcut)
if (var1 !=| var2)

Work anywhere inside of a boolean expression:
if (var1 =|= var2)
(keyboard shortcut)
if (var1 !|= var2)

Work on boolean variables:
if (var1 == var2|)
(keyboard shortcut)
if (var1 == !var2|)

if (var1 == va|r2)
(keyboard shortcut)
if (var1 == !va|r2)

If the variable is not a boolean, change the expression instead:
if (var1 == va|r2)
(keyboard shortcut)
if (var1 != va|r2)


Work with boolean properties and methods, like HasValue:
product.BrandID.HasValue|
(keyboard shortcut)
!product.BrandID.HasValue|

product.BrandName.IsNullOrEmpty()|
(keyboard shortcut)
!product.BrandName.IsNullOrEmpty()|

Walk out to the nearest bool or bool?:
((int?)prod|uct.BrandID).HasValue
(keyboard shortcut)
!((int?)pro|duct.BrandID).HasValue

Toggle back:
if (var1 =|= var2)
(keyboard shortcut)
if (var1 !|= var2)
(keyboard shortcut)
if (var1 =|= var2)

Please sign in to leave a comment.