vim 无法将 Podfile 和 podspec 文件识别为 Ruby 文件

vim can't recognize Podfile and podspec file as Ruby file

如何vim将Podfile和podspec文件(一些没有扩展名的文件)识别为ruby文件,以便vim可以进行语法高亮。

将此添加到您的 .vimrc

autocmd BufNewFile,BufRead Podfile,*.podspec set filetype=ruby

此行指示 Vim 将 Podfiles 和扩展名为 .podspec 的文件视为 Ruby 文件所以他们继承了 Ruby 语法高亮。