开发者

textmate snippets and tabs

开发者 https://www.devze.com 2023-01-03 11:46 出处:网络
i\'m using sni开发者_运维百科ppets in textmate a lot -- especially for adding API documentation to my sources.

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

精彩评论

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