简体   繁体   中英

Make vim recognise COOL syntax

I am using vim 8.1 on macOS (vim-plug for plugin management). I need to work with COOL files, so I manually downloaded the syntax file and put it in ~/.vim/syntax

I added the following line to my .vimrc in order to associate the .cl extension with COOL:

au BufNewFile,BufRead *.cl setf cool 

However, when I load .cl files into vim, it fails to recognise the language.

:verbose set ft ?

yields:

filetype=lisp
Last set from /usr/local/Cellar/vim/8.1.0650/share/vim/vim81/filetype.vim line 875

Changing the .virmc line to:

au BufNewFile,BufRead *.cool setf cool

makes vim recognise the files as COOL.

What should I do in order to have .cl default to COOL instead of LISP?

Create the file ~/.vim/filetype.vim with the following content:

augroup filetypedetect
  au BufNewFile,BufRead *.cl setf cool
augroup END

See :help new-filetype .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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