3

I'm using the code suggested here in my vimrc to highlight lines over 80 columns.

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

This works great for code-related files, but it's annoying for me in markdown. Is there a way to turn off highlighting by file type in my vimrc?

Community
  • 1
  • 1
Judson
  • 2,265
  • 4
  • 19
  • 20

1 Answers1

4

To turn off the highlighting for the markdown filetype, add the following to your ~/.vimrc:

autocmd FileType markdown match none

This turns off the :match highlighting for that filetype.

(Alternatively, I would recommend putting that into ~/.vim/after/ftplugin/markdown.vim instead of defining lots of :autocmd FileType {filetype}; this requires that you have :filetype plugin on.)

Note that :match is window-local, so your original code already has issues when working with window splits and switching buffers; this solution inherits this.

Also note that there is 'colorcolumn' built-in in Vim 7.3+.

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324