2016-12-03 12 views
0

私はEmmet's Wrap With Abbreviationが好きです(docs)ERBの略語で囲む

それは私はすぐに通常のリストから

開始HTMLリストを作成することができます:私は本当にしたい

<ul> 
    <li>foo</li> 
    <li>bar</li> 
    <li>baz</li> 
</ul> 

:コマンド

foo 
bar 
baz 

を:

ul>li* 

結果できるようにするこれが可能である

<%= link_to micropost.user.name, micropost.user %> 
<%= micropost.content %> 
<%= time_ago_in_words(micropost.created_at) %> 

link_to micropost.user.name, micropost.user 
micropost.content 
time_ago_in_words(micropost.created_at) 

コマンド:

??? 

エンドERBは

開始をタグでと同じことを行うには?

現在、私はerbスニペットを使用していますが、行ごとに自分のerbに焦点を当てるのはひどいです。

私は自分のルビーに焦点を当て、その後erbタグに焦点を当て、次にhtmlタグに焦点を当て、次にhtmlクラス/ idに焦点を合わせます。

は、私は私が私が複数の行でそれをしようと私が得るただし場合、個々の行を折り返すことができます偉大な snippetが見つかりました:

開始:

user.cats 
user.dogs 

コマンド:

<snippet> 
    <content><![CDATA[ 
<%= ${0:$TM_SELECTED_TEXT} %> 
]]></content> 
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet --> 
    <!-- <tabTrigger>hello</tabTrigger> --> 
    <!-- Optional: Set a scope to limit where the snippet will trigger --> 
    <!-- <scope>source.erb</scope> --> 
    <description>ERB: Wrap with =</description> 
</snippet> 

結果:

<%= user.cats 
user.dogs %> 

しかし、私は

<%= user.cat %> 
<%= user.dogs %> 

はいくつかの助けを大好きだ:)これはあなたがやりたいことを得るために

答えて

1

一つの方法は、Selection > Split Into LinesCtrlキー+を使用して複数の行にあなたの選択を分割することです取得したいのですがWindows/LinuxではShift + L)。スニペットを呼び出すと、スニペットを呼び出すと、各選択項目に対して個別に動作します。

Sample session