Home Download Buy Blog Forum Support

Calling other keybinding from a keybinding

Calling other keybinding from a keybinding

Postby guillermooo on Thu Feb 11, 2010 9:23 pm

I don't think that this can be done, but I thought I'd ask... Is it possible?

This can be easily worked around by defining a plugin/macro that does the exact steps you want, but I think it'd be nice to be able to define macrokeybindings out of several other keybindings. I don't know whether I'm making any sense here... In my head it all seems to work. ;)
guillermooo
 
Posts: 728
Joined: Thu Jul 23, 2009 9:06 am

Re: Calling other keybinding from a keybinding

Postby EJ12N on Fri Feb 12, 2010 5:13 pm

guillermooo wrote:I don't think that this can be done, but I thought I'd ask... Is it possible?

This can be easily worked around by defining a plugin/macro that does the exact steps you want, but I think it'd be nice to be able to define macrokeybindings out of several other keybindings. I don't know whether I'm making any sense here... In my head it all seems to work. ;)


heh? makes no sense to me :? explain a lil better please.
EJ12N
 
Posts: 281
Joined: Tue Apr 21, 2009 5:23 pm

Re: Calling other keybinding from a keybinding

Postby gpfsmurf on Fri Feb 12, 2010 7:31 pm

Such as pressing F10 would translate into pressing F4, F5, and F6 in sequence?

I don't think it can be done... create a macro! They're a sequence of commands instead of a sequence of keys.

Besides, if you were to change what F5 did, your macrokeybinding wouldn't work anymore...
gpfsmurf
 
Posts: 211
Joined: Mon Jun 23, 2008 6:31 pm

Re: Calling other keybinding from a keybinding

Postby EJ12N on Mon Feb 15, 2010 7:15 pm

In sublime no, in autohotkey yes...

Just create a hotkey binding when sublime is current active window and done :)

I do this a lot and combining autohotkey + sublime is just pure heaven :D there's no limits lol...
Examples, I wanted to zoom in/out with mouse wheel, but sublime doesn't allow mousewheel keybindings so? autohotkey ftw!

Code: Select all
;=========================================================
;SUBLIME ZOOMIN / ZOOMOUT
;=========================================================
;Ctrl + Mousewheel up
~^~WheelUp::
  IfWinActive, ahk_class SKMainWindowClass
    Send !{=}
    return
;Ctrl + Mousewheel down
~^~WheelDown::
  IfWinActive, ahk_class SKMainWindowClass
    Send !{-}
    return


To do what gpfsmurf said you would do this...
Code: Select all
~F10::
  IfWinActive, ahk_class SKMainWindowClass
  Send {F4}{F5}{F6}
return


Btw if you are wondering why the "~" is there so it doesn't cancel out the hotkey functionality in any other program :)
so F10 would work normally in any other program but when in sublime it will send F4,F5,F6

Another one which one member requested which is a good example is "Triple-Click-to-SElect-Lines", obviously thru sublime api is impossible to do this (at least atm) but with autohotkey is very possible like I posted the script.

My recommendation, use autohotkey + sublime = happy camper :)
EJ12N
 
Posts: 281
Joined: Tue Apr 21, 2009 5:23 pm

Re: Calling other keybinding from a keybinding

Postby gpfsmurf on Mon Feb 15, 2010 7:42 pm

EJ12N, quick question about AutoHotkey...

This is what I use for mousewheel zooming; it looks different from your script:

Code: Select all
#IfWinActive ahk_class SKMainWindowClass ; Sublime Text
^WheelUp::SendInput ^{=} ; ZoomIn
^WheelDown::SendInput ^{-} ; ZoomOut
#IfWinActive


Do you know if it makes an actual difference?
gpfsmurf
 
Posts: 211
Joined: Mon Jun 23, 2008 6:31 pm

Re: Calling other keybinding from a keybinding

Postby EJ12N on Tue Feb 16, 2010 5:40 pm

Not at all. In fact that is the recommended way to go :) with the #ifwinactive
ex: the triple click script.

Code: Select all
;#IfWinActive, ahk_class SKMainWindowClass
;~*LButton::
;{
;  if clickCount > 0
;  {
;      clickCount += 1
;      return
;  }
;  clickCount = 1
;  SetTimer, clickHandler, 400
;  return

;  clickHandler:
;  SetTimer, clickHandler, off
;  if clickCount = 3
;  {
;      ;Triple click detected, send Ctrl+L shortcut to select the line...
;      SendEvent, ^l
;  }
;  clickCount = 0
;  return
;}
;#IfWinActive
EJ12N
 
Posts: 281
Joined: Tue Apr 21, 2009 5:23 pm

Re: Calling other keybinding from a keybinding

Postby guillermooo on Tue Feb 16, 2010 10:31 pm

I think I got ahead of my self. The fact that you can assign commands by name to keybindings defeats the whole purpose of my suggestion.

AutoHotkey's a nice app, though. Thanks!
guillermooo
 
Posts: 728
Joined: Thu Jul 23, 2009 9:06 am


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Yahoo [Bot] and 12 guests