我在处理 TypeScript 文件时经常使用
:set syntax=javascript
。我希望根据文件类型自动设置语法。我曾经通过在~/.vimrc
文件中添加以下内容来实现过:
au BufNewFile,BufRead,BufReadPost *.ts set syntax=javascript
但是,现在似乎已经不起作用了。这是我的.vimrc
文件的内容。有什么原因导致它不起作用吗?colorscheme atom-dark-256
set number
set autoindent
set guifont=monaco:h12
set expandtab
set tabstop=4 shiftwidth=4 expandtab
au BufNewFile,BufRead,BufReadPost *.ts set syntax=javascript
au BufNewFile,BufRead,BufReadPost *.handlebars set syntax=HTML
au BufNewFile,BufRead,BufReadPost *.twig set syntax=HTML
au BufNewFile,BufRead,BufReadPost *.theme set syntax=PHP
我确定以前它可以正常工作,但是由于某些原因它停止了。有什么想法吗?我正在使用MacVim,如果这有帮助的话?
au BufNewFile,BufRead,BufReadPost *.ts set filetype=javascript
吗? - dlmeeteiset syntax?
) - leaf