开发者

textmate snippets and tabs

i'm using sni开发者_运维百科ppets in textmate a lot -- especially for adding API documentation to my sources.

you can define placeholders in a snippet and you can use TAB / SHIFT+TAB to jump between those placeholders.

my question is:

is it still somehow possible to insert a tab at the current cursor position inside a placeholder position without breaking snippets' TAB / SHIFT+TAB functionality?

thanks a lot!


i think i found a "solution" for this:

i added a new command with the following settings:

save:             nothing
command(s):       printf "%$(($TM_TAB_SIZE - $TM_LINE_INDEX % $TM_TAB_SIZE))s"
input:            none
output:           insert as text

activation:       key equivalent - CTRL + SPACE
scope selector:   comment.block

the key equivalent could also be CTRL + TAB or so, but the TAB has already assigned many functionality. works like a charm for me.

i am using spaces instead of tabs ... so if someone prefers tabs, the solutions needs to be adjusted.


You can use a simple \t where you want to insert a tab into the snippet. e.g.: "\t${0}",

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜