Pregunta

I am in the process of learning both RoR and Emacs, a process that I happily expect to take up the rest of my lifetime, and my basic strategy is to start with a simple set of tools and then fill up my tool chest as I go along.

To that end, I don't want to install Rinari or nXhtml just yet, but I would like at least basic syntax highlighting and indentation in the various Rails files. I also don't want to use a emacs.d "starter kit" since another goal of mine is to understand every line of my Emacs configuration, and keep in nice and clean and free of cruft.

Problem is that it seems that many files in rails, like Gemfile use ruby syntax, but don't use the .rb suffix, e.g., Gemfile, so I have to turn on ruby-mode for each file that I encounter. This doesn't seem like the Emacs way.

I was thinking that there must be a map out there of Rails files and the modes they use out there that I can easily plop into my config, but I can't seem to find it. Does anyone have any suggestions?

¿Fue útil?

Solución

Ruby-mode file associations:

(add-to-list 'auto-mode-alist '("\\.\\(rb\\|ru\\|builder\\|rake\\|thor\\|gemspec\\)\\'" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\(rake\\|thor\\|guard\\|gem\\|cap\\|vagrant\\)file\\'" . ruby-mode))

Editing modes for other types of files:

erb templates - rhtml-mode

haml templates - haml-mode

slim templates - slim-mode

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top