Keep :highlight when using :tabedit in vim
I use vim. I have a requirement to use 80 or fewer columns. This fix from 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?
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/**
.
精彩评论