5
Vim-rails
source link: https://devhints.io/vim-rails
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Alternate files
:A
alternate file (test)
:R
related file (controller/view)
What it does
. :A :R Model test/models/ db/schema.rb Controller method test/controllers/ app/views/ View template test/views/ app/controllersAbbreviations
Type :Rabbrev
for a full list.
AC::
ActionController
AR::
ActiveRecord
AV::
ActionView
...
…
logd(
logger.debug
logi(
logger.info
...
…
Model
bt(
belongs_to
hm(
has_many
ho(
has_one
habtm(
has_and_belongs_to_many
Controllers
pa[
params
re(
redirect_to
rp(
render partial:
rst(
respond_to
Views
dotiw
distance_of_time_in_words
taiw
time_ago_in_words
Extracting partials
# from view => app/views/home/_foo_partial.haml
:Rextract home/foo_partial
# from model => app/models/concerns/foo_concern.rb
:Rextract FooConcern
Loading files
:Econtroller <file> # app/controllers/*_controller.rb
:Ehelper # app/helpers/*_helper.rb
:Emodel <file> # app/models/*.rb
:Ejob <file> # app/jobs/*_job.rb
:Emailer <file> # app/mailers/*.rb
:Emigration <file> # db/migrations/*.rb
:Eschema # db/schema.rb
:Elib <file> # lib/*.rb
:Elib # Gemfile
:Etask <file> # lib/tasks/*.rake
Assets
:Estylesheet
:Ejavascript
Views
:Eview
:Elayout
:Espec
:Eunittest
# test/{unit,models,helpers}/*_test.rb
# spec/{unit,models,helpers}/*_spec.rb
:Efunctionaltest
# test/{functional,controllers,mailers}/*_test.rb
# spec/{functional,controllers,mailers}/*_spec.rb
:Eintegrationtest
# test/integration/*_test.rb
# spec/{features,requests,integration}/*_spec.rb
# features/*.feature
:Efixtures
:Efunctionaltest
Config
:Einitializer <file> # config/initializers/*.rb
:Elocale # config/locales/*.yml
:Eenvironment # application.rb
:Eenvironment development # config/environments/*.rb
Reference
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK