shin
shin

Reputation: 32721

Vim syntax off for markdown in .vimrc

At the moment I use :syntax off for markdown. But I'd like to make it syntax off when I edit a markdown file.

I tried this in .vimrc but md files has syntax.

"""""syntax off for markdown"""
if &ft=='md'
    syntax off
else
    syntax on
endif

How can I do it?

Upvotes: 2

Views: 403

Answers (2)

Michael F
Michael F

Reputation: 40830

You can accomplish it with an auto-command for all buffers for which the filetype is set to "markdown", or "md", like so:

autocmd Filetype markdown setlocal syntax=OFF

You can read about the syntax of commands Vim can execute automatically with :help :autocmd.

Upvotes: 3

shin
shin

Reputation: 32721

I got the answer from here.

Create ~/.vim/after/syntax/markdown.vim with:

setlocal syntax=

Upvotes: 0

Related Questions