ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Rails File Switcher

Sublime Text 2 plugin for switching between Models, Controllers and Views

Details

  • 2013.07.02.12.18.42
  • github.​com
  • github.​com
  • 12 years ago
  • 2 hours ago
  • 12 years ago

Installs

  • Total 4K
  • Win 694
  • Mac 2K
  • Linux 1K
Jan 21 Jan 20 Jan 19 Jan 18 Jan 17 Jan 16 Jan 15 Jan 14 Jan 13 Jan 12 Jan 11 Jan 10 Jan 9 Jan 8 Jan 7 Jan 6 Jan 5 Jan 4 Jan 3 Jan 2 Jan 1 Dec 31 Dec 30 Dec 29 Dec 28 Dec 27 Dec 26 Dec 25 Dec 24 Dec 23 Dec 22 Dec 21 Dec 20 Dec 19 Dec 18 Dec 17 Dec 16 Dec 15 Dec 14 Dec 13 Dec 12 Dec 11 Dec 10 Dec 9 Dec 8
Windows 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Mac 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

Rails File Switcher for Sublime Text 2

Rails File Switcher is a plugin for Sublime Text 2 that allows you to switch between Models, Controllers and Views. And how!

No popups, just immediately switches to the related file.

Commands

open_related_rails_model (super+1)

  • Opens the related model.
  • If you put the caret inside a model's name (like Po│st) and run the command, it will open the model from any place in the application. This works for models, services and mailers (examples: Post, PostService, PostMailer).

open_related_rails_controller (super+2)

  • Opens the related controller from a model and rspec model & controller specs.
  • Opens the related controller from a view. Centers the screen at the action definition. If Vintage is enabled, it also moves the caret to the action definition.

open_related_rails_view (super+3)

  • Opens the related view from a controller. You need to put the caret inside the controller action for it to work.

open_related_rspec_model (super+4)

  • Opens the related rspec model spec.
  • If you put the caret inside a model's name (like Po│st) and run the command, it will open the model spec from any place in the application.

open_related_rspec_controller (super+5)

  • Opens the related rspec controller spec from a model and rspec model.

Bindings

Here are the default bindings. You can change them in Preferences > Key Bindings - User

{ "keys": ["super+1"], "command": "open_related_rails_model" },
{ "keys": ["super+2"], "command": "open_related_rails_controller" },
{ "keys": ["super+3"], "command": "open_related_rails_view" },
{ "keys": ["super+4"], "command": "open_related_rspec_model" },
{ "keys": ["super+5"], "command": "open_related_rspec_controller" },

How is it different from Rails Related Files and other similar plugins?

Rails Related Files shows you a list of related files which you can choose from.

Rails File Switcher switches between MVC files instantly. If you are in your User model and you press ⌘+2 (if that's your binding), you will instantly see UsersController.

Contributing

Pull requests are appreciated. If something isn't working, you can fix and send a pull request or simply create an issue to let me know of the bugs.

CHANGELOG

July 2, 2013

  • Add support for services and mailers.

June 24, 2013

  • Add support for singularly-named controllers.
  • Add support for jumping from a namespaced controller to a non-namespaced model.
  • Add support for RSpec models and controllers.
  • Show file creation popup for all types when the file doesn't exist, not only for views.

June 18, 2013

  • Add support for ST3, use branch python3 (by @dsnipe)

March 14, 2013

  • Allow creating views when switching to a non-existent view.

March 7, 2013

  • Include key bindings by default (by @deiga).

January 27, 2013

  • Add support for namespaces.

January 26, 2013

  • When switching from a view to the controller the screen is centered at the action definition. If Vintage is enabled, it also moves the caret to the action definition.

January 21, 2013

  • Allow switching to model by putting the caret (and running open_related_rails_model) inside its name anywhere in the application.

January 18, 2013

  • Make it work when there are multiple apps opened in the side bar (previously would look for files only in the first app). Thanks to @ccodre for pointing out.

December 25, 2012

  • Initial release

License

The plugin is released under the MIT License