Persistent :set syntax for a given filetype?

后端 未结 4 1082
失恋的感觉
失恋的感觉 2021-01-30 07:52

I\'m working on a Symfony2 project which uses Twig, and the filetypes are myfile.html.twig. Vim doesn\'t automatically detect the syntax highlighting and so applies

4条回答
  •  被撕碎了的回忆
    2021-01-30 08:39

    Add one of the following passages to your .vimrc:

    " Set the filetype based on the file's extension, overriding any
    " 'filetype' that has already been set
    au BufRead,BufNewFile *.html.twig set filetype=html
    

    or

    " Set the filetype based on the file's extension, but only if
    " 'filetype' has not already been set
    au BufRead,BufNewFile *.html.twig setfiletype html
    

提交回复
热议问题