1010| rails-navigation | Navigation
1111| rails-gf | File Under Cursor - gf
1212| rails-alternate-related | Alternate and Related Files
13- | rails-model-navigation | Model Navigation Commands
14- | rails-controller-navigation | Controller Navigation Commands
15- | rails-misc-navigation | Miscellaneous Navigation Commands
13+ | rails-type-navigation | File Type Commands
1614| rails-custom-navigation | Custom Navigation Commands
1715| rails-rake | Rake
1816| rails-scripts | Script Wrappers
@@ -316,137 +314,94 @@ Suggestions for further contexts to consider for the alternate file, related
316314file, and file under the cursor are welcome. They are subtly tweaked from
317315release to release.
318316
317+
318+ File Type Navigation Commands ~
319+ *rails-type-navigation*
319320For the less common cases, a more deliberate set of commands are provided.
320- Each of the following takes an optional argument (with tab completion) but
321- defaults to a reasonable guess that follows Rails conventions. For example,
322- when editing app/models/employee.rb, :Rcontroller will default to
323- app/controllers/employees_controller.rb.
321+ Each of the upcoming commands takes an optional argument (with tab completion)
322+ but defaults to a reasonable guess. Commands that default to the current
323+ model or controller generally behave like you'd expect in other file types.
324+ For example, in app/helpers/posts_helper.rb, the current controller is
325+ "posts", and in test/fixtures/comments.yml, the current model is "comment".
326+ In model related files, the current controller is the pluralized model name,
327+ and in controller related files, the current model is the singularized
328+ controller name.
324329
325330Each of the following commands has variants for splitting, vertical splitting,
326331opening in a new tab, and reading the file into the current buffer. For
327332:Rmodel, those variants would be :RSmodel, :RVmodel, :RTmodel, and :RDmodel.
328333There is also :REmodel which is a synonym for :Rmodel (future versions might
329334allow customization of the behavior of :Rmodel). They also allow for jumping
330- to methods or line numbers using the same syntax as | :Redit | .
331-
332-
333- Model Navigation Commands ~
334- *rails-model-navigation*
335- The default for model navigation commands is the current model, if it can be
336- determined. For example, test/unit/post_test.rb would have a current model
337- of post. Otherwise, if a controller name can be determined, said controller
338- name will be singularized and used.
335+ to methods or line numbers using the same syntax as | :Redit | , and file
336+ creation can be forced by adding a ! after the filename (not after the command
337+ itself!).
339338
340- :Rmodel | rails-:Rmodel |
339+ :Rcontroller | rails-:Rcontroller |
340+ :Renvironment | rails-:Renvironment |
341+ :Rfixtures | rails-:Rfixtures |
342+ :Rfunctionaltest | rails-:Rfunctionaltest |
343+ :Rhelper | rails-:Rhelper |
344+ :Rinitializer | rails-:Rinitializer |
345+ :Rintegrationtest | rails-:Rintegrationtest |
346+ :Rjavascript | rails-:Rjavascript |
347+ :Rlayout | rails-:Rlayout |
348+ :Rlib | rails-:Rlib |
349+ :Rlocale | rails-:Rlocale |
350+ :Rmetal | rails-:Rmetal |
341351:Rmigration | rails-:Rmigration |
352+ :Rmodel | rails-:Rmodel |
342353:Robserver | rails-:Robserver |
343- :Rfixtures | rails-:Rfixtures |
354+ :Rplugin | rails-:Rplugin |
355+ :Rspec | rails-:Rspec |
356+ :Rstylesheet | rails-:Rstylesheet |
357+ :Rtask | rails-:Rtask |
344358:Runittest | rails-:Runittest |
345-
346- *rails-:Rmodel*
347- :Rmodel [{name} ] Edit the specified model.
348-
349- *rails-:Rmigration*
350- :Rmigration [{pattern} ] If {pattern} is a number, find the migration for that
351- particular set of digits, zero-padding if necessary.
352- Otherwise, find the newest migration containing the
353- given pattern. Omitting the pattern selects the
354- latest migration. Give a numeric argument of 0 to edit
355- db/schema.rb.
356-
357- *rails-:Robserver*
358- :Robserver [{name} ] Find the observer with a name like
359- {model} _observer.rb. When in an observer, most
360- commands (like :Rmodel) will seek based on the
361- observed model ({model} ) and not the actual observer
362- ({model} _observer). However, for the command
363- :Runittest, a file of the form
364- {model} _observer_test.rb will be found.
365-
366- *rails-:Rfixtures*
367- :Rfixtures [{name} ] Edit the fixtures for the given model. If an argument
368- is given, it must be pluralized, like the final
369- filename (this may change in the future). If omitted,
370- the current model is pluralized automatically. An
371- optional extension can be given, to distinguish
372- between YAML and CSV fixtures.
373-
374- *rails-:Runittest*
375- :Runittest [{name} ] Edit the unit test or model spec for the specified
376- model.
377-
378- Controller Navigation Commands ~
379- *rails-controller-navigation*
380- The default for controller navigation commands is the current controller, if
381- it can be determined. For example, test/functional/blog_test.rb would have a
382- current controller of blog. Otherwise, if a model name can be determined,
383- said model name will be pluralized and used.
384-
385- :Rcontroller | rails-:Rcontroller |
386- :Rhelper | rails-:Rhelper |
387359:Rview | rails-:Rview |
388- :Rlayout | rails-:Rlayout |
389- :Rfunctionaltest | rails-:Rfunctionaltest |
390360
391361 *rails-:Rcontroller*
392- :Rcontroller [{name} ] Edit the specified controller.
362+ :Rcontroller [{name} ] Edit the specified or current controller.
393363
394- *rails-:Rhelper*
395- :Rhelper [{name} ] Edit the helper for the specified controller.
396-
397- *rails-:Rview*
398- :Rview [[{controller} /]{view} ]
399- Edit the specified view. The controller will default
400- sensibly, and the view name can be omitted when
401- editing a method of a controller. If a view name is
402- given with an extension, a new file will be created.
403- This is a quick way to create a new view.
364+ *rails-:Renvironment*
365+ :Renvironment [{name} ] Edit the config/environments file specified. With no
366+ argument, defaults to editing config/application.rb
367+ or config/environment.rb.
404368
405- *rails-:Rlayout*
406- :Rlayout [{name} ] Edit the specified layout. Defaults to the layout for
407- the current controller, or the application layout if
408- that cannot be found. A new layout will be created if
409- an extension is given.
369+ *rails-:Rfixtures*
370+ :Rfixtures [{name} ] Edit the fixtures for the given or current model. If
371+ an argument is given, it must be pluralized, like the
372+ final filename (this may change in the future). If
373+ omitted, the current model is pluralized. An optional
374+ extension can be given, to distinguish between YAML
375+ and CSV fixtures.
410376
411377 *rails-:Rfunctionaltest*
412378:Rfunctionaltest [{name} ]
413379 Edit the functional test or controller spec for the
414- specified controller.
415-
416- *rails-:Rapi*
417- :Rapi [{name} ] This command is obsolete; add it yourself with
418- | :Rnavcommand | if you still desire it.
380+ specified or current controller.
419381
420- Miscellaneous Navigation Commands ~
421- *rails-misc-navigation*
422-
423- The following commands are not clearly associated with models or controllers.
382+ *rails-:Rhelper*
383+ :Rhelper [{name} ] Edit the helper for the specified name or current
384+ controller.
424385
425- :Rstylesheet | rails-:Rstylesheet |
426- :Rjavascript | rails-:Rjavascript |
427- :Rplugin | rails-:Rplugin |
428- :Rlib | rails-:Rlib |
429- :Rtask | rails-:Rtask |
430- :Rmetal | rails-:Rmetal |
431- :Renvironment | rails-:Renvironment |
432- :Rinitializer | rails-:Rinitializer |
433- :Rlocale | rails-:Rlocale |
434- :Rintegrationtest | rails-:Rintegrationtest |
435- :Rspec | rails-:Rspec |
386+ *rails-:Rinitializer*
387+ :Rinitializer [{name} ] Edit the config/initializers file specified. With no
388+ argument, defaults to editing config/routes.rb.
436389
437- *rails-:Rstylesheet*
438- :Rstylesheet [{name} ] Edit the stylesheet for the specified name, defaulting
439- to the current controller's name.
390+ *rails-:Rintegrationtest*
391+ :Rintegrationtest [{name} ]
392+ Edit the integration test, integration spec, or
393+ cucumber feature specified. With no argument,
394+ defaults to editing test/test_helper.rb.
440395
441396 *rails-:Rjavascript*
442- :Rjavascript [{name} ] Edit the javascript for the specified name, defaulting
443- to the current controller's name .
397+ :Rjavascript [{name} ] Edit the javascript for the specified name or current
398+ controller.
444399
445- *rails-:Rplugin *
446- :Rplugin [{plugin} [/ {path} ]]
447- Edits a file within a plugin. If the path to the file
448- is omitted, it defaults to init.rb. If no argument is
449- given, it defaults to editing the application Gemfile .
400+ *rails-:Rlayout *
401+ :Rlayout [{name} ] Edit the specified layout. Defaults to the layout for
402+ the current controller, or the application layout if
403+ that cannot be found. A new layout will be created if
404+ an extension is given .
450405
451406 *rails-:Rlib*
452407:Rlib [{name} ] Edit the library from the lib directory for the
@@ -455,37 +410,41 @@ The following commands are not clearly associated with models or controllers.
455410 specified as well. With no argument, defaults to
456411 editing config/routes.rb.
457412
458- *rails-:Rtask*
459- :Rtask [{name} ] Edit the .rake file from lib/tasks for the specified
460- name. If the current file is part of a plugin, the
461- tasks for that plugin can be specified as well. If no
462- argument is given, either the current plugin's
463- Rakefile or the application Rakefile will be edited.
413+ *rails-:Rlocale*
414+ :Rlocale [{name} ] Edit the config/locale file specified, optionally
415+ adding a yml or rb extension if none is given. With
416+ no argument, checks config/environment.rb for the
417+ default locale.
464418
465419 *rails-:Rmetal*
466420:Rmetal [{name} ] Edit the app/metal file specified. With no argument,
467421 defaults to editing config/boot.rb.
468422
469- *rails-:Renvironment*
470- :Renvironment [{name} ] Edit the config/environments file specified. With no
471- argument, defaults to editing config/application.rb
472- or config/environment.rb.
423+ *rails-:Rmigration*
424+ :Rmigration [{pattern} ] If {pattern} is a number, find the migration for that
425+ particular set of digits, zero-padding if necessary.
426+ Otherwise, find the newest migration containing the
427+ given pattern. Omitting the pattern selects the
428+ latest migration. Give a numeric argument of 0 to edit
429+ db/schema.rb.
473430
474- *rails-:Rinitializer*
475- :Rinitializer [{name} ] Edit the config/initializers file specified. With no
476- argument, defaults to editing config/routes.rb.
431+ *rails-:Rmodel*
432+ :Rmodel [{name} ] Edit the specified or current model.
477433
478- *rails-:Rlocale*
479- :Rlocale [{name} ] Edit the config/locale file specified, optionally
480- adding a yml or rb extension if none is given. With
481- no argument, checks config/environment.rb for the
482- default locale.
434+ *rails-:Robserver*
435+ :Robserver [{name} ] Find the observer with a name like
436+ {model} _observer.rb. When in an observer, most
437+ commands (like :Rmodel) will seek based on the
438+ observed model ({model} ) and not the actual observer
439+ ({model} _observer). However, for the command
440+ :Runittest, a file of the form
441+ {model} _observer_test.rb will be found.
483442
484- *rails-:Rintegrationtest *
485- :Rintegrationtest [{name} ]
486- Edit the integration test, integration spec, or
487- cucumber feature specified. With no argument,
488- defaults to editing test/test_helper.rb .
443+ *rails-:Rplugin *
444+ :Rplugin [{plugin} [/ {path} ] ]
445+ Edits a file within a plugin. If the path to the file
446+ is omitted, it defaults to init.rb. If no argument is
447+ given, it defaults to editing the application Gemfile .
489448
490449 *rails-:Rspec*
491450:Rspec [{name} ] Edit the given spec. With no argument, defaults to
@@ -494,6 +453,29 @@ The following commands are not clearly associated with models or controllers.
494453 command is only defined if there is a spec folder in
495454 the root of the application.
496455
456+ *rails-:Rstylesheet*
457+ :Rstylesheet [{name} ] Edit the stylesheet for the specified name or current
458+ controller.
459+
460+ *rails-:Rtask*
461+ :Rtask [{name} ] Edit the .rake file from lib/tasks for the specified
462+ name. If the current file is part of a plugin, the
463+ tasks for that plugin can be specified as well. If no
464+ argument is given, either the current plugin's
465+ Rakefile or the application Rakefile will be edited.
466+
467+ *rails-:Runittest*
468+ :Runittest [{name} ] Edit the unit test or model spec for the specified
469+ name or current model.
470+
471+ *rails-:Rview*
472+ :Rview [[{controller} /]{view} ]
473+ Edit the specified view. The controller will default
474+ sensibly, and the view name can be omitted when
475+ editing a method of a controller. If a view name is
476+ given with an extension, a new file will be created.
477+ This is a quick way to create a new view.
478+
497479Custom Navigation Commands ~
498480 *rails-custom-navigation*
499481
0 commit comments