I actually went with coloring the background of the line number. This way you're not interfering with syntax colors or underscores.
So basically I have this (for light background terminal)
highlight CursorLineNr ctermfg=white guifg=white ctermbg=darkgrey guibg=darkgrey cterm=bold gui=bold
If I generate keywords for buffer A, then open another buffer B in the same window and then come back to original buffer A, keywords are gone and I need to regenerate them
Actually the problem is not that you switched from the buffer A, but is that the buffer A was unloaded by Vim. And upon unloading buffer contents Vim also disposes its syntax elements (...