In a Netbeans Rails Project you can open a view from the action under cursor in the controller you are editing by hitting shft-ctrl-a. That is neat and useful and I dearly missed that function. Since Redcar is plugin based (almost everything is a plugin) I decided to roll my own plugin. This plugin is to mimic that behaviour.
Alpha: You can now consider this plugin to be in an alpha state.
For now, this is limited to Rails projects. Next up on my list are:
-
Jeweler
-
PHP
-
JAVA
-
Perl (CPAN Modules)
-
…
in random order.
You can jump around files with a simple key press. Here’s the keys, what they do and the rules they follow:
- shft-ctrl-a
-
MVC, stuffs
-
Jump around between M, V and C
-
Jump from a View to the corresponding Action, e.g.:
app/views/users/show.html.erb
will lead you to +UsersController#show+ -
Jump from an Action to the corresponding View, e.g.: +ProductController#index+ will open
app/views/products/index.html.erb
-
When opening the View, the following list of extensions is tried until one is found: erb, html.erb, haml, js.erb, xml.erb
-
Jump from a Model to a Controller, e.g.: when in
app/models/invoice.rb
you will jump toapp/controllers/invoice_controller.rb
-
- shft-ctrl-t
-
Test stuffs
-
Jump around test files.
-
Opens the unit test for the fixture, e.g.: when in
test/fixtures/customers.yml
openstest/units/customer_test.rb
-
When in the unit test, opens the model, e.g.: when in
app/models/editor.rb
openstest/units/editor_test.rb
-
When in the model, opens the unit test
-
When in the controller, opens the functional test, e.g:
app/controllers/books_controller.rb
openstest/functional/books_controller_test.rb
-
When in the functional test, opens the controller
-
When in a view, opens the functional test for the controller
-
When there is a function under the cursor, or when you are in a view the first test that has a name similar to the function/action name is selected
-
- shft-ctrl-y
-
Fixture stuffs
-
Jump between unit tests and fixtures
-
Opens the unit test for the fixture
-
Opens the fixture for the unit test
-
When the corresponding file does not exist, but the directory it is supposed to live in does, the file will be created with a comment on top.
If you would like to contribute, for instance by concocting a solid way to change behaviour based on the likely opened project, please fork, make a topic branch and start coding.
If you really want to help me with behavioural changes based on the open project a little discussion would be in order and very much appreciated. :-)
-
Jump from a fixture to the first usage in the unit test
-
All the things I forgot to mention
-
Add shft-ctrl-m to jump between controllers (& views) and models
© 2010 - Hartog de Mik
This plugin is licensed under the MIT license. See LICENSE.txt for more info.