-
Notifications
You must be signed in to change notification settings - Fork 0
/
autohotkey.ahk
342 lines (287 loc) · 8 KB
/
autohotkey.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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
; Autohotkey script to translate some Mac shortcuts for Windows
; Use ScrollLock key to temporary activate / descativate the current script, in case of get some trouble
#UseHook
#InstallKeybdHook
SC056::`
+SC056::~
LWin & a::Send {LCtrl Down}{a}{LCtrl Up}
LWin & b::Send {LCtrl Down}{b}{LCtrl Up}
LWin & c::Send {LCtrl Down}{c}{LCtrl Up}
LWin & d::Send {LCtrl Down}{d}{LCtrl Up}
LWin & e::Send {LCtrl Down}{e}{LCtrl Up}
LWin & g::Send {LCtrl Down}{g}{LCtrl Up}
LWin & h::Send {LCtrl Down}{h}{LCtrl Up}
LWin & i::Send {LCtrl Down}{i}{LCtrl Up}
LWin & j::Send {LCtrl Down}{j}{LCtrl Up}
LWin & k::Send {LCtrl Down}{k}{LCtrl Up}
;LWin & f::Send {LCtrl Down}{f}{LCtrl Up}
LWin & f::
GetKeyState, ShiftState, Shift, P
if (ShiftState == "D")
Send {LCtrl Down}+{f}{LCtrl Up}
else
Send {LCtrl Down}{f}{LCtrl Up}
return
LWin & m::Send {LCtrl Down}{m}{LCtrl Up}
;If Desktop or Explorer active, Alt+Shift+n create a new folder and Alt+N open an new window
LWin & n::
GetKeyState, ShiftState, Shift, P
if (ShiftState == "D") and (WinActive("ahk_class Progman") or WinActive("ahk_class ExploreWClass") or WinActive("ahk_class CabinetWClass"))
Send !fn{enter} ; Folder is in first so Send enter directly else other type of document will be selected
else if (ShiftState == "U" and (WinActive("ahk_class Progman") or WinActive("ahk_class ExploreWClass") or WinActive("ahk_class CabinetWClass")))
Run explorer
else if (ShiftState == "D")
Send {LCtrl Down}+{n}{LCtrl Up}
else
Send {LCtrl Down}{n}{LCtrl Up}
return
LAlt & s::Send {ß}
LAlt & u::
input, command, L1 ; L3 to limit the input to 2 keys
if (GetKeyState("Shift", "P")) {
if (command = "a") {
Send Ä
} else if (command = "o") {
Send Ö
} else if (command = "u") {
Send Ü
}
} else {
if (command = "a") {
Send ä
} else if (command = "o") {
Send ö
} else if (command = "u") {
Send ü
}
}
return
LWin & o::Send {LCtrl Down}{o}{LCtrl Up}
LWin & p::Send {LCtrl Down}{p}{LCtrl Up}
LWin & q::Send {LCtrl Down}{q}{LCtrl Up}
;LWin & r::Send {LCtrl Down}{r}{LCtrl Up};
LWin & r::
GetKeyState, ShiftState, Shift, P
if (ShiftState == "D")
Send {LCtrl Down}+{r}{LCtrl Up}
else
Send {LCtrl Down}{r}{LCtrl Up}
return
LWin & s::Send {LCtrl Down}{s}{LCtrl Up}
LWin & t::Send {LCtrl Down}{t}{LCtrl Up}
;LWin & u::Send {LCtrl Down}{u}{LCtrl Up}
;LWin & v::Send {LCtrl Down}{v}{LCtrl Up}
LWin & v::
if (WinActive("ahk_class ConsoleWindowClass")) {
SendInput {Raw}%clipboard%
} else {
GetKeyState, ShiftState, Shift, P
if (ShiftState == "D") {
Send {LCtrl Down}+{v}{LCtrl Up}
} else {
Send {LCtrl Down}{v}{LCtrl Up}
}
}
return
LWin & w::Send {LCtrl Down}{w}{LCtrl Up}
LWin & x::Send {LCtrl Down}{x}{LCtrl Up}
LWin & y::
GetKeyState, ShiftState, Shift, P
if (ShiftState == "D") {
Send {LCtrl Down}+{y}{LCtrl Up}
} else {
Send {LCtrl Down}{y}{LCtrl Up}
}
return
LWin & z::
GetKeyState, ShiftState, Shift, P
if (ShiftState == "D") {
Send {LCtrl Down}+{z}{LCtrl Up}
} else {
Send {LCtrl Down}{z}{LCtrl Up}
}
return
LWin & 7::
GetKeyState, ShiftState, Shift, P
if (ShiftState == "D") {
Send {LAlt Down}{&}{LAlt Up}
} else {
Send {LAlt Down}{7}{LAlt Up}
}
return
; Explorer -> delete file
LWin & BS::Send {Del}
; OSX NAVIGATION AND SELECTION WITH CMD
#Up::Send {ctrl down}{Home}{ctrl up}
#Down::Send {ctrl down}{End}{ctrl up}
#+Up::Send {ctrl down}{shift down}{Home}{shift up}{ctrl up}
#+Down::Send {ctrl down}{shift down}{End}{shift up}{ctrl up}
#Left::Send {Home}
#Right::Send {End}
#+Left::Send {shift down}{Home}{shift up}
#+Right::Send {shift down}{End}{shift up}
; OSX NAVIGATION AND SELECTION WITH ALT
!Left::Send {ctrl down}{Left}{ctrl up}
!Right::Send {ctrl down}{Right}{ctrl up}
!+Left::Send {ctrl down}{shift down}{Left}{shift up}{ctrl up}
!+Right::Send {ctrl down}{shift down}{Right}{shift up}{ctrl up}
; OSX Switch Desktop Workspace
; ctrl + left/right => map to => Ctrl + Win + left/right
LCtrl & Left::Send {LWin down }{LCtrl down}{Left}{LWin up}{LCtrl up}
LCtrl & Right::Send {LWin down }{LCtrl down}{Right}{LWin up}{LCtrl up}
; DISABLES UNMODIFIED WIN-KEY IN FAVOR OF OSX SPOTLIGHT-LIKE BEHAVIOR
LWin::return
RWin::return
#Space::LWin
; REPLACES ALT-TAB APPLICATION SWITCHING WITH OSX CMD-TAB
LWin & Tab::AltTab
!Tab::return
; Explorer: Jump to parent dir
LWin & Up::
GetKeyState, ShiftState, Shift, P
if (ShiftState == "D") {
Send {LAlt down}+{Up}{LAlt up}
} else {
Send {LAlt down}{Up}{LAlt up}
}
return
LWin & Down::
GetKeyState, ShiftState, Shift, P
if (ShiftState == "D") {
Send {LAlt down}+{Down}{LAlt up}
} else {
Send {LAlt down}{Down}{LAlt up}
}
return
; **********
; Greenshot
; **********
LWin & 4::
GetKeyState, ShiftState, Shift, P
if (ShiftState == "D") {
Send {PrintScreen}
} else {
Send {4}
}
return
; ************
; IntelliJ
; ************
; self defined keymap for IntelliJ 'VCS Operations Popup'
#If WinActive("ahk_exe" "idea.exe")
LWin & \::Send {LAlt Down}{\}{LAlt Up}
^#F7::Send {LCtrl down}{LAlt down}{F7}{LAlt up}{LCtrl up}
LWin & F8::Send {LAlt Down}{F8}{LAlt Up}
;Inline Comments
LWin & /::Send {LCtrl Down}}{/}{LCtrl Up}
; IJ Organize Imports
LCtrl & o::
if (GetKeyState("LWin", "P")) {
Send {LCtrl Down}{LAlt Down}{o}{LAlt Up}{LCtrl Up}
} else {
Send {LCtrl Down}{o}{LCtrl Up}
}
return
; import methods
LWin & Enter::Send {LAlt down}{Enter}{LAlt up}
; private snagit shortcut
LWin & 4::
GetKeyState, ShiftState, Shift, P
if (ShiftState == "D") {
Send {LAlt down}+{4}{LAlt up}
} else {
Send {LAlt down}{4}{LAlt up}
}
return
#If
; #############
; Sublime Text
; #############
#If WinActive("ahk_exe" "sublime_text.exe")
LWin & /::Send {LCtrl Down}{/}{LCtrl Up}
LCtrl & Up::
if (GetKeyState("LWin", "P")) {
Send {LShift down}{LCtrl down}+{up}{LShift up}{LCtrl up}
} else {
Send {LShift down}{LCtrl down}{up}{LShift up}{LCtrl up}
}
return
LCtrl & Down::
if (GetKeyState("LWin", "P")) {
Send {LShift down}{LCtrl down}+{down}{LShift up}{LCtrl up}
} else {
Send {LShift down}{LCtrl down}{down}{LShift up}{LCtrl up}
}
return
LWin & p::
GetKeyState, ShiftState, Shift, P
if (ShiftState == "D") {
Send {LShift down}{LCtrl down}+{p}{LShift up}{LCtrl up}
} else {
Send {LShift down}{LCtrl down}{p}{LShift up}{LCtrl up}
}
return
LWin & t::Send {LCtrl down}{p}{LCtrl up}
LWin & [::Send {LCtrl down}{[}{LCtrl up}
LWin & ]::Send {LCtrl down}{]}{LCtrl up}
#if
; #############
; Chrome
; #############
#If WinActive("ahk_exe" "chrome.exe")
LWin & t::
GetKeyState, ShiftState, Shift, P
if (ShiftState == "D") {
Send {LShift down}{LCtrl down}+{t}{LShift up}{LCtrl up}
} else {
Send {LCtrl down}{t}{LCtrl up}
}
return
LWin & i::
GetKeyState, ShiftState, Shift, P
if (ShiftState == "D") {
Send {LShift down}{LCtrl down}+{i}{LShift up}{LCtrl up}
} else {
Send {LShift down}{LCtrl down}{i}{LShift up}{LCtrl up}
}
return
#if
;##########
;ConsoleZ2 Mapping to iTerm shortcut
;##########
#If WinActive("ahk_exe" "Console.exe")
; new tab
LWin & t::Send {LCtrl down}{f1}{LCtrl up}
; switch next
LWin & ]::
GetKeyState, ShiftState, Shift, P
if (ShiftState == "D") {
; switch to next tab
Send {LCtrl down}+{Tab}{LCtrl up}
} else {
; switch to next view
Send {LCtrl down}{PgDn}{LCtrl up}
}
return
; switch to previous
LWin & [::
GetKeyState, SiftState, Shift, P
if (ShiftState == "D") {
; switch to previous tab
Send {LCtrl down}{LShift down}+{Tab}{LCtrl up}{LShift up}
} else {
; switch previous view
Send {LCtrl down}{PgUp}{LCtrl up}
}
return
LWin & d::
GetKeyState, SiftState, Shift, P
if (ShiftState == "D") {
; Split Windows Horizontally
Send {LCtrl down}{LShift down}{o}{LShift up}{LCtrl up}
} else {
; Split Windows Vertically
Send {LCtrl down}{LShift down}{e}{LShift up}{LCtrl up}
}
return
#If