Whenever I use Vim with Ruby files, I get nice coloring and automatic indention on blocks. However, when I am editing a Rack file, I don't get these things. How can I extend my Vim/Ruby configuration with my Rack files?
每当我使用Vim和Ruby文件时,我都会在块上获得漂亮的颜色和自动缩进。但是,当我编辑Rack文件时,我没有得到这些东西。如何使用Rack文件扩展我的Vim / Ruby配置?
3 个解决方案
#1
15
Put this in your vimrc
to tell vim to associate *.ru files with ruby syntax highlighting.
把它放在你的vimrc中告诉vim将* .ru文件与ruby语法高亮关联起来。
au BufRead,BufNewFile *.ru setfiletype ruby
#2
6
Ensure the following lines are in your vimrc
file:
确保vimrc文件中包含以下行:
syntax on
filetype on
au BufNewFile,BufRead *.ru set filetype=ruby
The first two are probably already set if other files are syntax-colored, but I've put them there anyway.
如果其他文件都是语法颜色的话,前两个可能已经设置了,但无论如何我都把它们放在那里。
The final one sets automatic actions on creating a new file and opening an existing file, to set the file type based on the extension.
最后一个设置自动操作以创建新文件和打开现有文件,以根据扩展名设置文件类型。
#3
#1
15
Put this in your vimrc
to tell vim to associate *.ru files with ruby syntax highlighting.
把它放在你的vimrc中告诉vim将* .ru文件与ruby语法高亮关联起来。
au BufRead,BufNewFile *.ru setfiletype ruby
#2
6
Ensure the following lines are in your vimrc
file:
确保vimrc文件中包含以下行:
syntax on
filetype on
au BufNewFile,BufRead *.ru set filetype=ruby
The first two are probably already set if other files are syntax-colored, but I've put them there anyway.
如果其他文件都是语法颜色的话,前两个可能已经设置了,但无论如何我都把它们放在那里。
The final one sets automatic actions on creating a new file and opening an existing file, to set the file type based on the extension.
最后一个设置自动操作以创建新文件和打开现有文件,以根据扩展名设置文件类型。