Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

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

share|improve this answer

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.