vim-rails ist ein umfassendes Vim-Plugin für die Ruby on Rails Entwicklung von Tim Pope.
Navigation im Rails-Projekt
Alternative & Verwandte Dateien
| Befehl | Beschreibung |
|---|---|
:A |
Zu alternativer Datei springen (z.B. Test / Spec) |
:R |
Zu verwandter Datei springen (z.B. Controller / View / Schema) |
| Kontext | :A Ziel | :R Ziel |
|---|---|---|
| Model | test/models/ or spec/models/ |
db/schema.rb |
| Controller | test/controllers/ or spec/controllers/ |
app/views/<controller>/ |
| View-Template | test/views/ or spec/views/ |
app/controllers/<controller>_controller.rb |
Partials & Concerns extrahieren
" Aus ERB/Haml View in ein Partial extrahieren => app/views/home/_foo_partial.html.erb
:Rextract home/foo_partial
" Aus Model in ein Concern extrahieren => app/models/concerns/foo_concern.rb
:Rextract FooConcern
Rails-Dateien direkt öffnen
Anwendungscode
: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
Datenbank & Migrationen
:Emigration <name> # db/migrate/*.rb
:Eschema # db/schema.rb
Bibliotheken & Rake-Tasks
:Elib <name> # lib/*.rb
:Elib # Gemfile
:Etask <name> # lib/tasks/*.rake
Views & Layouts
:Eview <name> # app/views/...
:Elayout <name> # app/views/layouts/...
Tests & 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
Konfiguration
:Einitializer <name> # config/initializers/*.rb
:Elocale <name> # config/locales/*.yml
:Eenvironment # config/application.rb
:Eenvironment development # config/environments/development.rb
Eingebaute Abkürzungen
Führen Sie :Rabbrev in Vim aus, um die vollständige Liste einzusehen.
Models
| Abkürzung | Expansion |
|---|---|
bt( |
belongs_to |
hm( |
has_many |
ho( |
has_one |
habtm( |
has_and_belongs_to_many |
Controller
| Abkürzung | Expansion |
|---|---|
pa[ |
params |
re( |
redirect_to |
rp( |
render partial: |
rst( |
respond_to |