Sublime Forum

What is the shortcut for jumping to the front of the line?

#1

TAB seems to sometimes push you to the “next writing point” and sometimes it just acts as a 4x space bar.

Is there a button that always forwards you to the next point?

Ex: I write a JS function. Whenever i am done with specifying the element ID name in double quotes, I click this button and cursor jumps to the front of the line.
Is there such a thing? I know TAB sometimes chooses to behave like that and sometimes not.

0 Likes

#2

In order to behave like that, you need to define some custom snippets (tools -> new snippet). Then you can define tabstops by using $ followed by a number (e.g. $1, $2, $3).

For example, to define a jQuery event binding, you could use this snippet:

<snippet> <content><![CDATA[ \$(${1:el}).on('${5:click}', function(e){ $0; }); ]]></content> <tabTrigger>event</tabTrigger> <scope>source.js</scope> </snippet>

Using this, when you’re editing a javascript file, you just need to type event + tab and you’re unleash the beast! :smile:

As you can see, the first $ sign should be escaped (because it is not a tab stop).

Instead of using subsequent numbers, I prefer leaving some gaps, because if I sometime need to add another tab stop, I could just add a number between 1 and 5.

$0 means the end of the tab sequence, and is the point where everything will stop.

You can read more on this subject here:

0 Likes

#3

[quote=“iamntz”]In order to behave like that, you need to define some custom snippets (tools -> new snippet). Then you can define tabstops by using $ followed by a number (e.g. $1, $2, $3).

For example, to define a jQuery event binding, you could use this snippet:

<snippet> <content><![CDATA[ \$(${1:el}).on('${5:click}', function(e){ $0; }); ]]></content> <tabTrigger>event</tabTrigger> <scope>source.js</scope> </snippet>

Using this, when you’re editing a javascript file, you just need to type event + tab and you’re unleash the beast! :smile:

As you can see, the first $ sign should be escaped (because it is not a tab stop).

Instead of using subsequent numbers, I prefer leaving some gaps, because if I sometime need to add another tab stop, I could just add a number between 1 and 5.

$0 means the end of the tab sequence, and is the point where everything will stop.

You can read more on this subject here:

Thanks for the help!

0 Likes