This highlights file should live in <nvim-conf>/after/queries/python/highlights.scm
.
Please note that with neovim 0.8, for files which queries extend existing queries,
you need to add ; extends
at the top of the file (see this discussion).
Here is some Python file:
"""Test conceal."""
import math
from math import sqrt
for element in [0, 1, 2]:
print(element)
_ = element or False
_ = element and True
_ = element != False
_ = element not in ["a"]
_ = 1 * 2
_ = not True
sum([1, 2, 3])
all([True, True])
any([True, False])
_ = 1 + math.sqrt(16)
_ = 1 + sqrt(16)
_ = 1 + math.pi
_ = lambda x: x + 1
_ = len([1, 2, 3])
_ = None
int(3)
float(3)
def func(x: int, y: float) -> float:
"""Increment."""
return x + y
and how this looks when concealed
If anyone comes across this in 2024 and after, the set! command needs to be preceded with a #. For example:
(("not" @keyword.operator) (#set! conceal "¬"))
For every set! command.