Vim Overlength highlighting for certain filetypes only

1

I'm using the following in my .vimrc to highlight lines that over 80 characters long:

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

This affects all of my files. Is there a way I can set this to only affect a certain filetype, such as a Javascript file?

Spencer Carnage

Posted 2012-05-17T01:47:01.967

Reputation: 113

Answers

0

You can save those lines to a file named ~/.vim/after/ftplugin/javascript.vim on Unix or ~\vimfiles\after\ftplugin\javascript.vim on Windows.

garyjohn

Posted 2012-05-17T01:47:01.967

Reputation: 29 085

3

Use au Filetype ... source ... to source a file containing the commands for the appropriate file types.

Ignacio Vazquez-Abrams

Posted 2012-05-17T01:47:01.967

Reputation: 100 516