Sublime Forum

PowerUser Packgage?

#1

In the keybinding I see:

[code]

[/code]

I see that is supposed to repeat an action x number of times, but how do you invoke it? And where?

0 Likes

#2

The specific example he uses will let you type any number, followed by hitting “q” twice, and will select that number of lines. Try writing “5qq” to see what it does.
The keybinding itself is built up of a regular expression to catch any number, followed by the binding “q,q”. The command to be executed gets passed $1 as a paramater, which is the number “caught” in the regular expression.

The idea is, if you want to bind any command to accept a number before it, just copy this line and change the command from “expandSelectionTo line” to whatever command you want performed.

0 Likes

#3

Where am I supposed to type the 5qq?

0 Likes

#4

Uncomment the binding and press any number of digits followed by qq in any buffer. That should do the trick.

Make sure to add some lines first and also, if I remember correctly, Jon has recently capped the length of keybindings at 16 chars (that shouldn’t be a problem :smiley:).

HTH

0 Likes

#5

:blush: I did not even pay attention that the binding was commented out.

0 Likes