I use this keymapping toggle to highlighting on and off, but when I originally found it, the author did not list two
<cr> at the end of the command. I found that if I didn't have two
<cr> there, then I was required to press Return after my keymapping. Why? ... because now that I can get the macro (wrong term?) to execute, my cursor advances to the next line after executing the mapping.
highlight OverLength ctermbg=gray match OverLength /\%81v.\+/ let OLstate = 1 nnoremap oi : if (OLstate == 0) \| match OverLength /%81v.\+/ \| else \| match OverLength /%9999v/ \| endif \| let OLstate = 1 - OLstate <cr> <cr>