Sublime text 3自定义代码段不会触发

时间:2015-10-25 08:14:35

标签: php wordpress sublimetext3

enter image description here我刚为PHP Wordpress循环创建了sublime文本片段。但是当我按Tab键时,它并没有触发。

<snippet>
    <content><![CDATA[
 if(have_posts()): ?>
    <?php while(have_posts()): ?>
        <?php the_post(); ?>
        <?php the_title(); ?>
    <?php endwhile; ?>
<?php endif; ?>
]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <!-- <tabTrigger>wp_loop</tabTrigger> -->
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <scope>source.php</scope>
</snippet>

1 个答案:

答案 0 :(得分:3)

删除 tabTrigger

的注释行
<snippet>
    <content><![CDATA[
 if(have_posts()): ?>
    <?php while(have_posts()): ?>
        <?php the_post(); ?>
        <?php the_title(); ?>
    <?php endwhile; ?>
<?php endif; ?>
]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>wp_loop</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <scope>source.php</scope>
</snippet>