rails.vim
This is a massive (in a good way) Vim plugin for editing Ruby on Rails
applications.
-
Easy navigation of the Rails directory structure.
gf
considers
context and knows about partials, fixtures, and much more. There are
two commands,:A
(alternate) and:R
(related) for easy jumping
between files, including favorites like model to schema, template to
helper, and controller to functional test. Commands like:Emodel
,
:Eview
,:Econtroller
, are provided to:edit
files by type, along
withS
,V
, andT
variants for:split
,:vsplit
, and
:tabedit
. Throw a bang on the end (:Emodel foo!
) to automatically
create the file with the standard boilerplate if it doesn't exist.
:help rails-navigation
-
Enhanced syntax highlighting. From
has_and_belongs_to_many
to
distance_of_time_in_words
, it's here. -
Interface to the
rails
command. Generally, use:Rails console
to
callrails console
. Many commands have wrappers with additional features:
:Generate controller Blog
generates a blog controller and loads the
generated files into the quickfix list, and:Runner
wrapsrails runner
and doubles as a direct test runner.:help rails-exec
-
Default task runner. Use
:Rails
(with no arguments) to run the current
test, spec, or feature. Use:.Rails
to do a focused run of just the
method, example, or scenario on the current line.:Rails
can also run
arbitrary migrations, load individual fixtures, and more.
:help rails-default-task
-
Partial and concern extraction. In a view,
:Extract {file}
replaces the desired range (typically selected in visual line mode)
withrender '{file}'
, which is automatically created with your
content. In a model or controller, a concern is created, with the
appropriateinclude
declaration left behind.
:help rails-:Extract
-
Fully customizable. Define "projections" at the global, app, or gem
level to define navigation commands and override the alternate file,
default rake task, syntax highlighting, and more.
:help rails-projections
. -
Integration with other plugins. If [dispatch.vim][] is installed,
:Rails
and other command wrappers will use it for asynchronous execution. Users of
dadbod.vim and
dbext get easy access to
their application's database. Users of
abolish.vim get pluralize and
tableize coercions, and users of [bundler.vim][] get a smattering of
features.:help rails-integration
如果你要找一个文件
:Rfind routes.rb
如果你想打开一个model
:Rmodel user
如果你想打开一个conotroller
:Rcontroller users
:Rcont users
如果你想打开一个view
:Rview users/index
:Rview users/_user
如果你的当前窗口的文件是在app/views/users/下的话
:Rview show #相当于 :Rview users/show
如果你当前光标是controller的index方法中,直接按 R 可以中转到视图文件 index.html.erb中
其它的方法如
:Rserver #启动服务器
:Rserver! #停止服务器
:Rjavascript js_name #打开js文件
还有很多,输入帮助命令自己看吧
:help rails
标签:翻译,users,Rails,vim,controller,rails,help From: https://www.cnblogs.com/cloudhan/p/17035741.html