-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuniversal autohotkey mappings.ahk
322 lines (298 loc) · 5.49 KB
/
universal autohotkey mappings.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
#SingleInstance Force
; Set title match mode to match any string in the title of a window
SetTitleMatchMode,2
;Allows for the script to be reloaded everytime it's saved
SetTimer,UPDATEDSCRIPT,1000
UPDATEDSCRIPT:
FileGetAttrib,attribs,%A_ScriptFullPath%
IfInString,attribs,A
{
FileSetAttrib,-A,%A_ScriptFullPath%
Sleep,500
Reload
}
Return
LWin & e:: send, {escape}
LWin & k:: send, {up}
LWin & j:: send, {down}
LWin & h:: send, {left}
LWin & l:: send, {right}
LWin & b:: send, ^{Left}
LWin & f:: send, ^{Right}
F1::Suspend, Off ; stop suspending autohotkeys
+F1::Suspend, On ; suspend autohotkeys
exit_sequence_exists_in(variable)
{
if variable contains !
{
send :{esc}
return true
}
}
start_processing_mnemonic()
{
if ErrorLevel = Timeout
{
msgbox, Timed out waiting for mnemonic key sequence
return
}
}
process_universal_mnemonic(mnemonic)
{
if mnemonic = a ; alt
{
send {Alt down}
Input, mnemonic, T2 V, abcdefghijklmnopqrstuvwxyz{esc},
if exit_sequence_exists_in(mnemonic)
return
send {Alt up}!
return
}
if mnemonic = q ; quit
{
send !{F4}
return
}
if mnemonic = rm ; remove
{
send {delete}
sleep 100
send {enter}
return
}
if mnemonic = r ; right click
{
send +{F10}
return
}
if mnemonic = pt ; previous tab
{
send +^{tab}
return
}
if mnemonic = nt ; next tab
{
send ^{tab}
return
}
if mnemonic = cp ; copy
{
send ^c
return
}
if mnemonic = re ; redo
{
send ^y
return
}
if mnemonic = u ; undo
{
send ^z
return
}
if mnemonic = mv ; move
{
send ^x
return
}
if mnemonic = p ; paste
{
send +{ins}
return
}
if mnemonic = max ; maximize
{
send #{up}
return
}
if mnemonic = min ; minimize
{
send #{down}
return
}
if mnemonic = j ; page down
{
send {PgDn}
return
}
if mnemonic = h ; home
{
send {Home}
return
}
if mnemonic = l ; end
{
send {End}
return
}
if mnemonic = k ; page up
{
send {PgUp}
return
}
if mnemonic = r ; rename
{
send {f2}
return
}
if mnemonic = mw ; move window
{
send +#{right}
return
}
if mnemonic = s ; save
{
send ^s
return
}
if mnemonic = sr ; squeeze right
{
send {LWin Down}{right}{LWin Up}
return
}
if mnemonic = sl ; squeeze left
{
send {LWin Down}{left}{LWin Up}
return
}
if mnemonic = v ; visual mode
{
send {LShift Down}
return
}
}
LWin & space::
Input, mnemonic, T2, {enter}{esc},
if ErrorLevel = Timeout
return
if ErrorLevel = EndKey:Escape
return
if exit_sequence_exists_in(mnemonic)
return
process_mnemonic(mnemonic)
return
LWin & `;::
Input, mnemonic, T2, {enter},
if ErrorLevel = Timeout
return
if ErrorLevel = EndKey:Escape
return
if exit_sequence_exists_in(mnemonic)
return
if mnemonic = p ; previous window
{
send !{tab}
return
}
if mnemonic = s ; switch window
{
inputbox, window_title, switch window, enter window title
if ErrorLevel
return
ToggleWinMinimize(window_title)
return
}
if mnemonic = ff ; switch to firefox
{
ToggleWinMinimize("ahk_class MozillaWindowClass")
return
}
if mnemonic = vim ; switch to gvim
{
ToggleWinMinimize("ahk_class Vim")
return
}
if mnemonic = con ; switch to console
{
ToggleWinMinimize("ahk_class Console_2_Main")
return
}
if mnemonic = vis ; switch to visual studio
{
ToggleWinMinimize("Microsoft Visual Studio")
return
}
if mnemonic = out ; switch to outlook
{
ToggleWinMinimize("Outlook")
return
}
if mnemonic = babe ; switch to addie's chat window
{
ToggleWinMinimize("addie")
return
}
process_mnemonic(mnemonic)
{
start_processing_mnemonic()
process_universal_mnemonic(mnemonic)
IfWinActive, ahk_class Vim
{
process_gvim_mnemonic(mnemonic)
return
}
IfWinActive, ahk_class MozillaWindowClass
{
process_firefox_mnemonic(mnemonic)
return
}
IfWinActive, ahk_class Console_2_Main
{
process_powershell_mnemonic(mnemonic)
return
}
IfWinActive, Microsoft Visual Studio
{
process_visual_studio_mnemonic(mnemonic)
return
}
IfWinActive, Outlook
{
process_outlook_mnemonic(mnemonic)
return
}
IfWinActive, ahk_class CabinetWClass
{
process_windows_explorer_mnemonic(mnemonic)
return
}
}
#include %A_ScriptDir%\visual studio autohotkey mappings.ahk
#include %A_ScriptDir%\gvim autohotkey mappings.ahk
#include %A_ScriptDir%\windows explorer autohotkey mappings.ahk
#include %A_ScriptDir%\powershell autohotkey mappings.ahk
#include %A_ScriptDir%\firefox autohotkey mappings.ahk
#include %A_ScriptDir%\outlook autohotkey mappings.ahk
ToggleWinMinimize(TheWindowTitle)
{
SetTitleMatchMode,2
DetectHiddenWindows, Off
IfWinExist, %TheWindowTitle%
{
WinGet, winid, ID, %TheWindowTitle%
DllCall("SwitchToThisWindow", "UInt", winid, "UInt", 1)
}
Return
}
LWin & a::
LWin & c::
LWin & d::
LWin & w::
LWin & g::
LWin & i::
LWin & m::
LWin & n::
LWin & o::
LWin & p::
LWin & q::
LWin & r::
LWin & s::
LWin & t::
LWin & u::
LWin & v::
LWin & x::
LWin & y::
LWin & z::
LWin & ,::
LWin & 4::
LWin & 0::