tags:

views:

56

answers:

1

I use vim. I have a requirement to use 80 or fewer columns. This fix from http://stackoverflow.com/questions/235439/vim-80-column-layout-concerns works great:

highlight OverLength ctermbg=red ctermfg=white guibg=#592929
match OverLength /\%81v.*/

The first file I open looks fine. But when I

:tabedit some/other/file

some/other/file doesn't have the highlight settings and I have to enter them manually. How do I keep the highlighting settings for files I :tabedit?

+1  A: 

Adding those two lines of code to ~/.vim/after/syntax/syncolor.vim (create if it doesn't exist) does the trick for me.

That's a great snippet, by the way.

ETA: it may be necessary to add this to your .vimrc file:

autocmd BufRead,BufNewFile (pattern) source ~/.vim/after/syntax/syncolor.vim

where (pattern) can be something like /home/foo/bar/**.

Jan Krüger
Thanks! I put those lines in ~/.vim/after/syntax/syncolor.vim and added autocmd BufRead,BufNewFile ** source ~/.vim/after/syntax/syncolor.vimto my ~/.vimrc
Dave Aaron Smith