LoginSignup
19

More than 5 years have passed since last update.

posted at

updated at

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

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

レシピ

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

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

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
What you can do with signing up
19