简体   繁体   English

关闭.vimrc中的Markdown的Vim语法

[英]Vim syntax off for markdown in .vimrc

At the moment I use :syntax off for markdown. 目前,我使用:syntax off进行降价。 But I'd like to make it syntax off when I edit a markdown file. 但是我想在编辑markdown文件时关闭其语法。

I tried this in .vimrc but md files has syntax. 我在.vimrc中尝试过此操作,但md文件具有语法。

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

How can I do it? 我该怎么做?

You can accomplish it with an auto-command for all buffers for which the filetype is set to "markdown", or "md", like so: 您可以使用自动命令针对所有文件类型设置为“ markdown”或“ md”的缓冲区来完成此操作,如下所示:

autocmd Filetype markdown setlocal syntax=OFF

You can read about the syntax of commands Vim can execute automatically with :help :autocmd . 您可以阅读Vim可以使用:help :autocmd自动执行的命令的语法。

I got the answer from here . 从这里得到了答案。

Create ~/.vim/after/syntax/markdown.vim with: 使用以下命令创建〜/ .vim / after / syntax / markdown.vim:

setlocal syntax=

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM