LoginSignup
19
19

More than 5 years have passed since last update.

Rails.vimでPartialを一瞬で作る方法

Last updated at Posted at 2012-12-26

テンプレートをPartialに分けるのって面倒くさいですよね
そこでVimのRails開発用プラグインRails.vimを使って簡単にPartialをつくりましょう。

レシピ

  • Partial化したい部分をビジュアルラインモード(V)で選択
  • :Rextract {file_name}と入力(例えば_post.html.hamlが欲しければ、:'<,'>Rextract post)
  • ウインドウが分割されるので保存する

Partialファイルが作られるだけでなく元のビューファイルには読み込みのためのrenderもかかれるところが賢いと思います。

19
19
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
19
19