vim-rails es un plugin integral de Vim para el desarrollo en Ruby on Rails creado por Tim Pope.
Navegación
Archivos alternativos y relacionados
| Comando | Descripción |
|---|---|
:A |
Saltar al archivo alternativo (ej. test / spec) |
:R |
Saltar al archivo relacionado (ej. controller / view / schema) |
| Contexto | Destino de :A | Destino de :R |
|---|---|---|
| Modelo (Model) | test/models/ or spec/models/ |
db/schema.rb |
| Controlador (Controller) | test/controllers/ or spec/controllers/ |
app/views/<controller>/ |
| Plantilla de vista (View Template) | test/views/ or spec/views/ |
app/controllers/<controller>_controller.rb |
Extracción de parciales y concerns
" Desde una vista ERB/Haml hacia un partial => app/views/home/_foo_partial.html.erb
:Rextract home/foo_partial
" Desde un modelo hacia un concern => app/models/concerns/foo_concern.rb
:Rextract FooConcern
Apertura rápida de archivos Rails
Código de la aplicación
:Econtroller <name> # app/controllers/*_controller.rb
:Ehelper <name> # app/helpers/*_helper.rb
:Emodel <name> # app/models/*.rb
:Ejob <name> # app/jobs/*_job.rb
:Emailer <name> # app/mailers/*.rb
Base de datos y migraciones
:Emigration <name> # db/migrate/*.rb
:Eschema # db/schema.rb
Librerías y tareas Rake
:Elib <name> # lib/*.rb
:Elib # Gemfile
:Etask <name> # lib/tasks/*.rake
Vistas y layouts
:Eview <name> # app/views/...
:Elayout <name> # app/views/layouts/...
Pruebas y specs
:Espec <name> # spec/.../*_spec.rb
:Eunittest <name> # test/models/..._test.rb
:Efunctionaltest <name> # test/controllers/..._test.rb
:Eintegrationtest <name># test/integration/..._test.rb
:Efixtures <name> # test/fixtures/*.yml
Configuración
:Einitializer <name> # config/initializers/*.rb
:Elocale <name> # config/locales/*.yml
:Eenvironment # config/application.rb
:Eenvironment development # config/environments/development.rb
Abreviaturas integradas
Ejecuta :Rabbrev en Vim para inspeccionar la lista completa.
Modelos (Models)
| Abreviatura | Expansión |
|---|---|
bt( |
belongs_to |
hm( |
has_many |
ho( |
has_one |
habtm( |
has_and_belongs_to_many |
Controladores (Controllers)
| Abreviatura | Expansión |
|---|---|
pa[ |
params |
re( |
redirect_to |
rp( |
render partial: |
rst( |
respond_to |