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

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

 
discard

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.