|
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. |
|
; #Warn ; Enable warnings to assist with detecting common errors. |
|
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. |
|
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. |
|
|
|
; Docs: |
|
; https://autohotkey.com/docs/Hotkeys.htm |
|
; https://autohotkey.com/docs/KeyList.htm |
|
; Ref https://autohotkey.com/board/topic/60675-osx-style-command-keys-in-windows/ |
|
|
|
; You need to disable "Between input languages" shotcut from Control Panel\Clock, Language, and Region\Language\Advanced settings > Change lanugage bar hot keys |
|
|
|
;;; Universal shotcuts |
|
|
|
$#x::Send ^x |
|
$#c::Send ^c ; copy |
|
$#v::Send ^v ; paste |
|
$#+v::Send ^+v ; paste text |
|
$#s::Send ^s ; save |
|
$#a::Send ^a ; select all |
|
$#z::Send ^z ; undo |
|
$#+z::Send ^y ; redo |
|
$#w::Send ^w ; close window |
|
$#n::Send ^n ; new window |
|
$#f::Send ^f ; find |
|
$#q::Send !{f4} ; close window |
|
$#r::Send ^{f5} ; refresh window |
|
$#m::Send {LWin Down}{Down}{LWin Up} ; minimize window |
|
$#^4::Send ^{PrintScreen} ; rectangle screen capture (FSCapture) |
|
$#^l::DllCall("PowrProf\SetSuspendState", "Int", 0, "Int", 0, "Int", 0) ; hibernate or suspend |
|
|
|
;;; Quick Switch Tab shotcuts |
|
|
|
LWin & Tab::AltTab |
|
|
|
$#1::Send ^1 |
|
$#2::Send ^2 |
|
$#3::Send ^3 |
|
$#4::Send ^4 |
|
$#5::Send ^5 |
|
$#6::Send ^6 |
|
$#7::Send ^7 |
|
$#8::Send ^8 |
|
$#9::Send ^9 |
|
$#0::Send ^0 |
|
|
|
;;; Chrome shotcuts |
|
|
|
SetTitleMatchMode, 2 |
|
#IfWinActive, ahk_exe chrome.exe |
|
$#t::Send ^t |
|
$#+t::Send ^+t |
|
$#+]::Send {Ctrl Down}{Tab Down}{Tab Up}{Ctrl Up} |
|
$#+[::Send {Ctrl Down}{Shift Down}{Tab Down}{Tab Up}{Shift Up}{Ctrl Up} |
|
$#l::Send ^l |
|
$^#z::Send ^+z ; switch last opened tab |
|
#IfWinActive |
|
|
|
;;; input methods |
|
|
|
; $+,::Send ^, |
|
; $+.::Send ^. |
|
SetCapsLockState, AlwaysOff |
|
+CapsLock::CapsLock |
|
;CapsLock::Send ^{space} ; Swith input methods as macOS |
|
CapsLock::Send {LShift down}{LShift Up} |
|
|
|
;;; navigation, selection, delete a word/till end |
|
|
|
$#Left::Send {Home} |
|
$#Right::Send {End} |
|
$#Up::Send {Lctrl down}{Home}{Lctrl up} |
|
$#Down::Send {Lctrl down}{End}{Lctrl up} |
|
|
|
$!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} |
|
|
|
$#+Left::Send {shift down}{Home}{shift up} |
|
$#+Right::Send {shift down}{End}{shift up} |
|
$#+Up::Send {Ctrl Down}{shift down}{Home}{shift up}{Ctrl Up} |
|
$#+Down::Send {Ctrl Down}{shift down}{End}{shift up}{Ctrl Up} |
|
|
|
;;; Emacs keybinds |
|
|
|
$#BS::Send {LShift down}{Home}{LShift Up}{Del} |
|
$!BS::Send {LCtrl down}{BS}{LCtrl up} ; delete word backword |
|
|
|
$^a::Send {Home} ; move to beginning of line |
|
$^b::Send {Left} ; backward char |
|
$^d::Send {Del} ; delete char forward |
|
$^e::Send {End} ; move to end of line |
|
$^f::Send {Right} ; forward char |
|
$^k::Send {LShift down}{End}{LShift up}{Del} ; delete to end of line |
|
$^n::Send {Down} |
|
$^p::Send {Up} |
|
$^w::Send {LCtrl down}{BS}{LCtrl up} ; delete word backword |
|
$!b::Send {Alt down}{Left}{Alt up} ; backward word |
|
$!d::Send {LCtrl down}{Del}{LCtrl up} ; delete word forward |
|
$!f::Send {Alt down}{Right}{Alt up} ; forward word |
|
|
|
LWin & F12:: |
|
EmacsKey :=! EmacsKey |
|
Hotkey, ^a, Toggle |
|
Hotkey, ^b, Toggle |
|
Hotkey, ^d, Toggle |
|
Hotkey, ^e, Toggle |
|
Hotkey, ^f, Toggle |
|
Hotkey, ^k, Toggle |
|
Hotkey, ^n, Toggle |
|
Hotkey, ^p, Toggle |
|
Hotkey, ^w, Toggle |
|
Hotkey, !b, Toggle |
|
Hotkey, !d, Toggle |
|
Hotkey, !f, Toggle |
|
If EmacsKey |
|
MsgBox, Emacs Keybind Disabled! |
|
Else |
|
MsgBox, Emacs Keybind Enabled! |
|
Return |
Trying to create a better solution for this here: https://github.com/stevenilsen123/mac-keyboard-behavior-in-windows
Feedback welcome!