I am trying to make a zsh script to give completions in line and am trying to highlight POSTDISPLAY. The zsh docs say to use region_highlight but I can't figure out the proper syntax to get that to highlight anything.
Can someone give me an example with minimum code to highlight something with region_highlight. The script doesn't need to highlight post display, I should hopefully be able to figure that out on my own.
Changing the styling on something like the first five characters after the prompt or anything else would be great.
I know region_highlight ends after the line is accepted but I have functions that trigger with every keypress in which I can put the highlighting functionality.
Thank you!
Here is a function I found that does what I wanted. It goes from the length of the buffer to the end of the buffer + length of POSTDISPLAY, it applies the styling fg=4. This styles the characters that are in POSTDISPLAY.
function __apply_highlighting() {
if [ $#POSTDISPLAY -gt 0 ]; then
region_highlight=("$#BUFFER $(($#BUFFER + $#POSTDISPLAY)) fg=4")
fi
}