问题描述
在Textmate中,我为特定的按键等效项分配了几个片段.
In Textmate I have several snippets assigned to specific key equivalents.
因此 + 将打开一个小菜单,可以选择一些摘要.
So + would open a little menu that gave me the choice of some number of snippets.
Sublime Text 2中可能有同样的事情吗?
Is the same thing possible in Sublime Text 2?
关注uo:在Textmate中,您可以将代码等效项分配给代码段,也可以分配相同的密钥等效项.多个片段.所选关键码有多个摘要时.随即打开一个菜单,其中所有摘录均与该键设备相关联.
Follow-uo:In Textmate you assign key equivalents to a snippet and you can assign the same key equ. to multiple snippets. When there is more than one snippet for a selected key equ. a menu opens with all of the snippets assgned to that key equ on it.
这真的帮了我...在 + 上可以有许多PHP代码段,在 + 等...,我不必记住疯狂的数量的equ设备,只是一个用于PHP的东西,等等...
This really helps me out...I can have a number of PHP snippets on + , a bunch of jQuery snippets on + etc... and I don't have to remember a crazy number of key equ, just one for PHP stuff, etc...
推荐答案
如果添加以下行:
{ "keys": ["shift+f1"], "command": "show_overlay", "args": {"overlay": "command_palette", "text": "snippet"} }
到您的绑定文件/Packages/User/Default (Linux).sublime-keymap
.然后,每次按shift+f1
.将显示一个带有所有摘录的弹出菜单.但是,您只需要一些摘要.所以...在要显示的摘要文件中,添加以下行:
to your keybindings file /Packages/User/Default (Linux).sublime-keymap
. Then everytime you press shift+f1
. A popup menu will appear with all snippets. But you only want some snippets. So... in you snippet files that you want to appear add the line:
<description>php snippet, some description</description>
并将顶部快捷键绑定中的行从的"text": "snippet"
更改为"text": "php snippet"
.现在,当您按下shift+f1
时,将显示所有以php snippet
开头的代码片段及其完整描述.您可以对所有不同的组重复此过程.
And change the line in the top keybinding from "text": "snippet"
in the to "text": "php snippet"
. Now when you hit shift+f1
all snippets with description beginning with php snippet
will appear, with their full descriptions. And you can repeat this process for all your different groups.
这篇关于将多个代码片段分配给单个键绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!