-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeymaps.ahk
More file actions
171 lines (151 loc) · 5.15 KB
/
Copy pathKeymaps.ahk
File metadata and controls
171 lines (151 loc) · 5.15 KB
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
; 请帮我写个 Autohotkey 脚本。
;
; 鼠标前进键 (XButton2),映射为 Ctrl 键。
; 鼠标后退键 (XButton1),映射为 Alt 键。
; 狙击键映射 (XButton3),映射为 Shift 键。
;
; 按下 Alt+鼠标左键,发送 Enter 键。
; 按下 Alt+鼠标右键,发送 Del 键。
; 按下 Alt+鼠标中键,发送 Backspace 键。
; 按下 Alt+鼠标滚轮向上,发送 Home 键。
; 按下 Alt+鼠标滚轮向下,发送 End 键。
;
; Alt+前进键,映射为浏览器前进
; Alt+后退键,映射为浏览器后退
;
; 同时按下鼠标左键和右键,发送 ESC 键。
; Ctrl+Esc,映射为虚拟的 F13 键(Vim 用)。
;
; Ctrl+Shift+X,映射为删除一行。
; Ctrl+Shift+C,映射为复制一行。
; Ctrl+Shift+V,映射为无格式粘贴。
;
; Win + Space ,映射触发:Ctrl+Alt+Space。
; Win + V ,映射触发:Ctrl+Alt+Shift+V。
; Win + G ,映射触发:Ctrl+Alt+Shift+G。
; Win + M ,映射触发:Ctrl+Alt+Shift+M。
;
; Caps + A ,映射触发:Left。
; Caps + D ,映射触发:Right。
; Caps + W ,映射触发:Up。
; Caps + S ,映射触发:Down。
; Caps + Q ,映射触发:Home。
; Caps + E ,映射触发:End。
; Caps + R ,映射触发:PageUp。
; Caps + D ,映射触发:PageDown。
#Requires AutoHotkey v2.0
; ============================================================
; ---------- 狙击键配置 ----------
; 根据鼠标驱动中狙击键的实际映射修改此项:
; 常见值: F20, SC12A, 或鼠标驱动设置的自定义键
SniperKey := "F20"
; ============================================================
; 鼠标按钮重映射
; ============================================================
; 后退键 → Alt
XButton1:: {
if GetKeyState("LAlt", "P") {
; 物理 Alt 已按下 + 后退键 → 浏览器后退
Send("{Browser_Back}")
} else {
Send("{Blind}{LAlt DownR}")
KeyWait("XButton1")
Send("{Blind}{LAlt Up}")
}
}
; 前进键 → Ctrl
XButton2:: {
if GetKeyState("LAlt", "P") || GetKeyState("XButton1", "P") {
; Alt 按下 + 前进键 → 浏览器前进
Send("{Browser_Forward}")
} else {
Send("{Blind}{LCtrl DownR}")
KeyWait("XButton2")
Send("{Blind}{LCtrl Up}")
}
}
; 狙击键 → Shift
Hotkey(SniperKey, SniperDown, "On")
SniperDown(*) {
Send("{Blind}{LShift DownR}")
KeyWait(SniperKey)
Send("{Blind}{LShift Up}")
}
; ============================================================
; Alt + 鼠标按键(物理 Alt 或 XButton1 均生效)
; ============================================================
; --- 物理 Alt 系列 ---
~LAlt & LButton::MouseAction("Enter")
~LAlt & RButton::MouseAction("Delete")
~LAlt & MButton::MouseAction("Backspace")
~LAlt & WheelUp::MouseAction("Home")
~LAlt & WheelDown::MouseAction("End")
; --- XButton1(后退键)系列 ---
XButton1 & LButton::MouseAction("Enter")
XButton1 & RButton::MouseAction("Delete")
XButton1 & MButton::MouseAction("Backspace")
XButton1 & WheelUp::MouseAction("Home")
XButton1 & WheelDown::MouseAction("End")
MouseAction(key) {
Send("{" key "}")
}
; ============================================================
; 左键 + 右键同时 → Esc
; ============================================================
~LButton & RButton::Send("{Esc}")
~RButton & LButton::Send("{Esc}")
; ============================================================
; Ctrl + Esc → F13(Vim 用)
; ============================================================
^Esc::Send("{F13}")
; ============================================================
; Ctrl + Shift 编辑器快捷操作
; ============================================================
; Ctrl+Shift+X → 删除一行
^+x::Send("{Home}+{End}{Delete}")
; Ctrl+Shift+C → 复制一行
^+c::Send("{Home}+{End}^c{End}")
; Ctrl+Shift+V → 无格式粘贴
^+v:: {
saved := ClipboardAll()
plainText := A_Clipboard
if (plainText != "") {
A_Clipboard := plainText
ClipWait(0.3)
Send("^v")
Sleep(100)
A_Clipboard := saved
} else {
Send("^v")
}
}
; ============================================================
; Win 组合键 → Ctrl+Alt(+Shift) 映射
; 前提:已在 Windows 设置中关闭 Game Bar (Win+G) 和剪贴板历史 (Win+V)
; ============================================================
#Space::Send("^!{Space}")
#v::Send("^!v")
#g::Send("^!g")
#m::Send("^!m")
; ============================================================
; CapsLock 方向键导航(切换式)
;
; ⚠ 你的键盘在硬件/驱动层拦截了 CapsLock 按键事件,
; AHK 完全看不到 CapsLock 的按下/松开,只能用切换状态做触发。
;
; 用法:
; 按 CapsLock → 灯亮 = 导航模式,字母变成方向键
; 再按一次 → 灯灭 = 正常打字模式
;
; 不想用导航模式又想切换大小写 → Shift+CapsLock
; ============================================================
#HotIf GetKeyState("CapsLock", "T")
a::Send("{Left}")
d::Send("{Right}")
w::Send("{Up}")
s::Send("{Down}")
q::Send("{Home}")
e::Send("{End}")
r::Send("{PgUp}")
f::Send("{PgDn}")
#HotIf