Search code examples
rubyvimvim-syntax-highlightingpodfile

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


How to make vim recognize Podfile and podspec file (some file without extension) as ruby file, so that vim can make syntax highlight.


Solution

  • Add this to your .vimrc:

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

    This line instructs Vim to treat Podfiles and files with a .podspec extension as Ruby files so they inherit the Ruby syntax highlighting.