Home Download Buy Blog Forum Support

PowerUser Packgage ?

PowerUser Packgage ?

Postby capnhud on Wed Jun 02, 2010 12:45 pm

In the keybinding I see:

Code: Select all
  <!--
  BONUS:
  Example keybinding showing how you can do commands X amount of times
  Usage: type 5,q,q it will select 5 lines
  -->
  <!-- <binding key="/([0-9]+)/,q,q" command="times $1 expandSelectionTo line"/> -->

</bindings>


I see that is supposed to repeat an action x number of times, but how do you invoke it? And where?
capnhud
 
Posts: 62
Joined: Thu Jan 14, 2010 11:57 am

Re: PowerUser Packgage ?

Postby edanm on Wed Jun 02, 2010 1:49 pm

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.
edanm
 
Posts: 131
Joined: Thu Mar 04, 2010 11:05 pm

Re: PowerUser Packgage ?

Postby capnhud on Thu Jun 03, 2010 10:33 am

Where am I supposed to type the 5qq?
capnhud
 
Posts: 62
Joined: Thu Jan 14, 2010 11:57 am

Re: PowerUser Packgage ?

Postby guillermooo on Thu Jun 03, 2010 10:49 am

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 :D).

HTH
guillermooo
 
Posts: 729
Joined: Thu Jul 23, 2009 9:06 am

Re: PowerUser Packgage ?

Postby capnhud on Thu Jun 03, 2010 12:20 pm

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


:oops: I did not even pay attention that the binding was commented out.
capnhud
 
Posts: 62
Joined: Thu Jan 14, 2010 11:57 am


Return to General Discussion

Who is online

Users browsing this forum: Google [Bot] and 14 guests