I like the set colorcolumn=80
option which highlights the column at 80 characters, however I find it annoying when working with multiple split windows.
I'd like to have an option to enable or disable the colored column by using the <leader>c
shortcut. I wrote a function, however my Vimscript knowledge is very limited. My only question is do you see anything wrong with this function or approach? or should I go with it?
" Show a colored column at 80 characters
function! ColorColumn()
if &colorcolumn == ""
set colorcolumn=80
else
set colorcolumn=
endif
endfunction
nmap <silent> <leader>c :call ColorColumn()<CR>