开发者

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/**.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜