To turn on syntax we normally use:
:syntax on and to turn it off we do:
:syntax off. I would like to define a single key, maybe using
<expr> to toggle syntax. My problem is how to get the current syntax state, so I can use it in a ternary operator.
Something like this:
nnoremap <expr> <Leader>s SyntaxState() ? ":syntax off" : ":syntax on"