Sublime Forum

Calling other keybinding from a keybinding

#1

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. :wink:

0 Likes

#2

[quote=ā€œguillermoooā€]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. :wink:[/quote]

heh? makes no sense to me :confused: explain a lil better please.

0 Likes

#3

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ā€¦

0 Likes

#4

In sublime no, in autohotkey yesā€¦

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

I do this a lot and combining autohotkey + sublime is just pure heaven :smiley: 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!

;========================================================= ;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ā€¦

~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 :smile:
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 :smile:

0 Likes

#5

EJ12N, quick question about AutoHotkeyā€¦

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

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

Do you know if it makes an actual difference?

0 Likes

#6

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

[code];#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[/code]

0 Likes

#7

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!

0 Likes