我正在将我的mac工作流迁移到Windows。我不能没有的一件事是超级密钥,它是Ctrl
+ Option
+ Shift
+ Cmd
的组合。我使用 Karabiner 应用将Capslock
重新映射到此Hyper
密钥。我听说 Autohotkey 是Windows的 Karabiner替代品。你能帮助我在Windows中模仿这个功能吗?
我理想的结果是:
Capslock
,因为我很少使用此Capslock
将执行ESC
密钥Capslock
将执行Ctrl
+ Alt
+ Shift
+ Windows
。例如,Capslock + C
将为Ctrl+Alt+Shift+Windows+C
非常感谢提前!
以下是我使用ahk脚本的尝试,但它根本不起作用:(
;-----------------------------------------
; hyper key for windows
;=========================================
; --------------------------------------------------------------
; notes
; --------------------------------------------------------------
; ! = alt
; ^ = ctrl
; + = shift
; # = lwin|rwin
;
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#UseHook
#InstallKeybdHook
#SingleInstance force
SendMode Input
;; deactivate capslock completely
SetCapslockState, AlwaysOff
;; remap capslock to hyper
Capslock::
SendInput {Blind}{Ctrl Down}{Alt Down}{Shift Down}{LWin Down}
return
Capslock up::
SendInput {Blind}{Ctrl Up}{Alt Up}{Shift Up}{LWin Up}
return
;; vim navigation with hyper
^!+#h:: SendInput {Blind}{Left}
^!+#h up:: SendInput {Blind}{Left Up}
^!+#l:: SendInput {Blind}{Right}
^!+#k:: SendInput {Blind}{Up}
^!+#j:: SendInput {Blind}{Down}
;; popular hotkeys with hyper
^!+#c::^c
^!+#v::^v
答案 0 :(得分:14)
感谢任何想要帮助我的人,我自己想出了这个问题,并且想要分享它以防万一有人遇到这个问题。
#NoEnv ; recommended for performance and compatibility with future autohotkey releases.
#UseHook
#InstallKeybdHook
#SingleInstance force
SendMode Input
;; deactivate capslock completely
SetCapslockState, AlwaysOff
;; remap capslock to hyper
;; if capslock is toggled, remap it to esc
;; note: must use tidle prefix to fire hotkey once it is pressed
;; not until the hotkey is released
~Capslock::
;; must use downtemp to emulate hyper key, you cannot use down in this case
;; according to https://autohotkey.com/docs/commands/Send.htm, downtemp is as same as down except for ctrl/alt/shift/win keys
;; in those cases, downtemp tells subsequent sends that the key is not permanently down, and may be
;; released whenever a keystroke calls for it.
;; for example, Send {Ctrl Downtemp} followed later by Send {Left} would produce a normal {Left}
;; keystroke, not a Ctrl{Left} keystroke
Send {Ctrl DownTemp}{Shift DownTemp}{Alt DownTemp}{LWin DownTemp}
KeyWait, Capslock
Send {Ctrl Up}{Shift Up}{Alt Up}{LWin Up}
if (A_PriorKey = "Capslock") {
Send {Esc}
}
return
;; vim navigation with hyper
~Capslock & h:: Send {Left}
~Capslock & l:: Send {Right}
~Capslock & k:: Send {Up}
~Capslock & j:: Send {Down}
;; popular hotkeys with hyper
~Capslock & c:: Send ^{c}
~Capslock & v:: Send ^{v}
答案 1 :(得分:0)
您可以在此处使用一名 Karabiner 专员: https://github.com/Vonng/Capslock/blob/master/win/CapsLock.ahk
映射您在 Mac 上使用的相同热键
;Summary: |
;o----------------------o---------------------------------------------o
;|CapsLock; | {ESC} Especially Convient for vim user |
;|CaspLock + ` | {CapsLock}CapsLock Switcher as a Substituent|
;|CapsLock + hjklwb | Vim-Style Cursor Mover |
;|CaspLock + uiop | Convient Home/End PageUp/PageDn |
;|CaspLock + nm,. | Convient Delete Controller |
;|CapsLock + zxcvay | Windows-Style Editor |
;|CapsLock + Direction | Mouse Move |
;|CapsLock + Enter | Mouse Click |
;|CaspLock + {F1}~{F6} | Media Volume Controller |
;|CapsLock + qs | Windows & Tags Control |
;|CapsLock + ;'[] | Convient Key Mapping |
;|CaspLock + dfert | Frequently Used Programs (Self Defined) |
;|CaspLock + 123456 | Dev-Hotkey for Visual Studio (Self Defined) |
;|CapsLock + 67890-= | Shifter as Shift |
要安装它,请从 doc 执行以下操作:
MyScript.ahk
Ctrl
和 J
。