In my ftplugin/python.vim file I have these two lines:
setlocal colorcolumn=81
highlight ColorColumn guibg=#222222
Which works nicely, but the colour of the column is set globally. Is it possible to set it only in the current buffer?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, you can’t. But you can create a workaround: use autocommand that runs on BufEnter event and there check whether you are entering target buffer, altering
hi ColorColumnin case you are and restoring the value in case you are not. Note though that you can’t have colorcolumns having different colors in different windows, thus this change will recolor all colorcolumns, not just that one displayed in the current window.