문제

I have some HTML files with arbitrary extension.

I would like to know if it's possible to order vim to change the highlight with a command.

Thanks.

도움이 되었습니까?

해결책

You can force syntax highlighting for a language by setting syntax:

:set syntax=html

If you'd also like to load filetype-specific settings, you should set filetype instead. This is probably what you want:

:set filetype=html

Since you mention you're editing more than one such file, you can automatically set the filetype for a given extension using autocmd:

:autocmd BufRead,BufNewFile *.<extension> setlocal filetype=html

You can also have this persist into future sessions by placing it in your vimrc.

다른 팁

Do you want just to tell vim that the file you are editing is written in html? Use a command :set filetype=html or just :set ft=html.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top