Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

105 lines (75 sloc) 3.541 kB
This is a minor mode for editing "Ruby On Rails" code with
"Emacs". This minor mode makes your work much easier and user
friendly.
== Installation
Clone the project from github
cd $HOME/.emacs.d/
git clone git://github.com/youngnh/emacs-rails.git
emacs-rails requires Emacs ruby-mode, available in Ruby source
distributions and via most package managers.
After that you must add this code to $HOME/.emacs
(add-to-list 'load-path "~/.emacs.d/emacs-rails")
(require 'rails)
After that you can run Emacs. Almost all available actions are in the
menu [Ruby On Rails]. The snippets are in the menu [Ruby On
Rails-Snippets] divided into categories for convenience.
To change default settings, select [Ruby On Rails - Customize].
== First Acquaintance
Go to directory with your rails application and open any file in Emacs:
cd $HOME/project/simple_rails_application
emacs app/controllers/application.rb
"RoR" should be in the list of active minor-modes in the status
bar. This means that emacs-rails is enabled and ready to help.
Almost all actions are in the "RubyOnRails" menu. You can check it
out and try some of them. Don't forget, that menu will help you only the
first time. After that, you better use hot keys for effective work. Each
menu command's keychord is in parentheses after the menu item.
== Features
* TextMate-like snippets
* Display of colored log files
* Integration with script/generate and script/destroy (controller,
model, scaffold, migration, etc)
* Integration with script/console and script/breakpointer
* Run rake C-c C-c r
* Quick start svn-status in RAILS_ROOT <F9>
* Documentation search using *ri* or *chm* file and Rails API
reference in HTML <F1>
* Quick access to the main configuration files
* Automatic TAGS generation in RAILS_ROOT directory
=== Management of WEBrick/Mongrel
* Your can select Webrick, Mongrel or Lighttpd
* Start/stop applicaton server C-c C-c w s
* Automatic browsing on current action (from view or controller)
C-c C-c w a
=== Navigation in RAILS_ROOT hierarchy
* Quick switch stylesheets, javascripts, migrations, layouts, helpers,
controllers, models, observers, plugins
* In controller file: go to views, functional test, helper
C-c <DOWN>
* Switch between action/view C-c <UP>
* Go to file in current line (example: cursor at line [redirect_to
controller => :home, :action => "show"], will be open action "show"
in "home" controller) C-<RET>
* Quick access to the main configuration files using menu
Other hot keys
* C-c C-c g g rails-nav:goto-migrate
* C-c C-c g j rails-nav:goto-javascripts
* C-c C-c g s rails-nav:goto-stylesheets
* C-c C-c g l rails-nav:goto-layouts
* C-c C-c g h rails-nav:goto-helpers
* C-c C-c g c rails-nav:goto-controllers
* C-c C-c g m rails-nav:goto-models
* C-c C-c g o rails-nav:goto-observers
* C-c C-c g p rails-nav:goto-plugins
=== ERb refactoring
* Create partial from selection C-c p
* Create helper from block C-c b
=== Bugs
If you find errors, please drop us a line
= Links
* "HowToUseEmacsWithRails" http://wiki.rubyonrails.org/rails/pages/HowToUseEmacsWithRails
* "Emacs Wiki on RubyMode" http://www.emacswiki.org/cgi-bin/wiki/RubyMode
* "Emacs screencast" http://emacsonrails.drozdov.net/
* "Effective Emacs" http://steve.yegge.googlepages.com/effective-emacs
* "Emacs Snippets" http://www.kazmier.com/computer/snippet.el
* "Textmate Snippets" http://manual.macromates.com/en/snippets
Jump to Line
Something went wrong with that request. Please try again.