tpope / vim-rails

rails.vim: Ruby on Rails power tools
http://www.vim.org/scripts/script.php?script_id=1567
4.1k stars 383 forks source link

File type of non-Rails YAML files become eruby.yaml #545

Closed ryym closed 5 years ago

ryym commented 5 years ago

Hi, thank you for the awesome plugin!

Problem

When I open a YAML file in Rails repository, this plugin automatically sets the filetype of it as eruby.yaml instead of yaml, even if the file has nothing to do with Rails. For example:

These files' filetype are set to eruby.yaml. And the problem is that the default commentstring is different between eruby.yaml and yaml file type:

Since the comment format of eruby is invalid in YAML, we cannot comment out code easily in a normal YAML file with eruby.yaml type by vim-commentary which depends on the commentstring option.

Suggestion

How about setting the filetype of YAML files in the general Rails directories only? Such as app, lib, config, test, and spec.

(code link):

https://github.com/tpope/vim-rails/blob/8407484a329b6722ee088a096a8d879a5c32ac67/plugin/rails.vim#L100-L103

tpope commented 5 years ago

Makes sense. I think config files and fixtures cover all the use cases.

ryym commented 5 years ago

Thank you for the quick fix!