I want to mark the textwidth
th column using colorcolumn
and have used
the following (since I have slightly different textwidth
s for different files)
au FileType py set textwidth=80 (say line 98)
au FileType c set textwidth=79 (say line 99)
let &colorcolumn=&textwidth (say line 100)
As you can see I have made sure that textwidth
has been defined before colorcolumn
is being set. I have also checked the output of the following commands
(inside a .c
file)
:verbose set textwidth?
textwidth=79
Last set from my_vimrc line 99
:verbose set colorcolumn?
colorcolumn=0
Last set from my_vimrc line 100
As you can see the value is 0
even though no other file is changing the value. Any reason why this might be happening ?
On a related note, vim is not breaking lines at 79 characters within .c
file even though textwidth
is set to 79
. Could this also be a part of the problem ??
formatoptions=ql
t
(orc
for comments only) the auto-wrapping is disabled. (Just to address your "on a related note" part.) Most people want this for coding, I think.fo+=t
then on its own ? or should I write it as an autocommand for C files only ?