I realize this is a recurring question, but none of the other responses on StackOverflow or Google seem to work, so I'm asking separately. I'm trying to get Vagrantfiles to show up with Ruby formatting, but having little success.
In ~/.vim/ftplugin/vagrant.vim, I have the following:
augroup vagrant
au!
au BufRead,BufNewFile Vagrantfile set filetype=ruby
augroup END
My .vimrc is pretty simple:
set shiftwidth=4 softtabstop=4
filetype on
filetype plugin on
syntax on
When opening an .rb file, formatting is as expected (using whatever default Ruby formatting vim came with -- I didn't add any additional ftplugins other than the one for Vagrantfile).
Upon opening a Vagrantfile, there's no formatting.
Running :set ft?
returns filetype=
.
Running :filetype
returns filetype detection:ON plugin:ON indent:OFF
.
I'm somewhat at a loss here, so any help is appreciated. Running vim 7.3 on Ubuntu 13.04.
~/.vim/ftplugin
is not used by filetype detection.
Try write in ~/.vim/filetype.vim
.
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.