Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turn off vim highlighting for given file type (markdown)

Tags:

vim

markdown

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?

like image 629
Judson Avatar asked Feb 13 '26 05:02

Judson


1 Answers

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

like image 68
Ingo Karkat Avatar answered Feb 17 '26 18:02

Ingo Karkat



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!