I thought this would be quite difficult, but it turned out to be simple, you just need one line in your .vimrc
au BufNewFile
,BufRead *.new_file_extension
set filetype=new_file_type
or set it to a known type
au BufNewFile
,BufRead *.new_file_extension
set filetype=xml
http://learnvimscriptthehardway.stevelosh.com/chapters/44.html
If you need to specify the
syntax of new_file_type, you can put new_file_type.vim in .vim/syntax folder, and everything get picked up automatically.
If you use
snipMate, you can define new_file_type.snippets in .vim/snippet folder.
vim设置新文件扩展
最新推荐文章于 2024-04-10 09:46:57 发布