Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save obahareth/325849f487362335e93859980eb63a03 to your computer and use it in GitHub Desktop.
Save obahareth/325849f487362335e93859980eb63a03 to your computer and use it in GitHub Desktop.
I recently begun migrating from macOS to Windows and needed to get the same keyboard shortcuts my muscle memory is used to working on Windows. This is an amalgamation of many AutoHotkey scripts I found online.
;-----------------------------------------
; Make Windows keyboard behave like Mac
;=========================================
; --------------------------------------------------------------
; NOTES
; --------------------------------------------------------------
; ! = ALT
; ^ = CTRL
; + = SHIFT
; # = WIN
;
; Debug action snippet: MsgBox You pressed Control-A while Notepad is active.
#InstallKeybdHook
#SingleInstance force
SetTitleMatchMode 2
SendMode Input
; --------------------------------------------------------------
; media/function keys all mapped to the right option key
; --------------------------------------------------------------
; swap left command/windows key with left alt
;LWin::LAlt
;LAlt::LWin ; add a semicolon in front of this line if you want to disable the windows key
; Disable Page Up and Page Down because their location on my laptop keyboard is stupid
PgUp::return
PgDn::return
; --------------------------------------------------------------
; OS X system shortcuts
; --------------------------------------------------------------
!LButton::Send !{LButton}
; Make Ctrl + S work with cmd (windows) key
!s::Send ^{s}
; New
!n::Send ^{n}
; Reload
!r::Send ^{r}
; Selecting
!a::Send ^{a}
!d::Send ^{d}
; Copying
!c::Send ^{c}
; Pasting
!v::Send ^{v}
; Cutting
!x::Send ^{x}
; Opening
!o::Send ^{o}
; Finding
!f::Send ^{f}
; Undo
!z::Send ^{z}
; Redo
!y::Send ^{y}
!+z::Send ^+{z}
; New tab
!t::Send ^{t}
; close tab
!w::Send ^{w}
; preferences
!,::Send ^{,}
; Address bar
!l::Send ^{l}
; 1Password
!#\::Send ^!{\}
; 1Password X
!+x::Send ^+{x}
; Close windows (cmd + q to Alt + F4)
!q::Send !{F4}
; Remap Windows + Tab to Alt + Tab.
;Lwin & Tab::AltTab
; minimize windows
!m::WinMinimize,a
;<#Tab::AltTab
;<#Sc056::ShiftAltTab
; --------------------------------------------------------------
; Cursor Movement
;
; cmd + arrows - start & end of lines, with shift for selecting text
; --------------------------------------------------------------
!Left::Send {Home}
!+Left::Send +{Home}
!Right::Send {End}
!+Right::Send +{End}
!Up::Send ^{Home}
!+Up::Send ^+{Home}
!Down::Send ^{End}
!+Down::Send ^+{End}
!Backspace::Send +{Home}{Delete}
#Backspace::Send ^{Backspace}
#Left::Send ^{Left}
#+Left::Send ^+{Left}
#Right::Send ^{Right}
#+Right::Send ^+{Right}
; Back and forward, because we stopped it from working with cursor settings above
; (Not working yet)
!#Left::Send !{Left}
!#Right::Send !{Right}
; VSCode
#Down::Send !{Down}
#Up::Send !{Up}
#+Down::Send !+{Down}
#+Up::Send !+{Up}
!+k::Send ^+{k}
!+f::Send ^+{f}
!+l::Send ^+{l}
; --------------------------------------------------------------
; CMD P and CMD SHIFT P
; --------------------------------------------------------------
!p::Send ^{p}
!+p::Send ^+{p}
; --------------------------------------------------------------
; MagnetApp-Like window snapping - CTRL+ALT+Arrow
; --------------------------------------------------------------
^#Left::WinMove, A,, 0, 0, (A_ScreenWidth/2), (A_ScreenHeight)
^#Right::WinMove, A,, (A_ScreenWidth/2), 0, (A_ScreenWidth/2), (A_ScreenHeight)
^#Up::WinMove, A,, 0, 0, (A_ScreenWidth), (A_ScreenHeight/2)
^#Down::WinMove, A,, 0, (A_ScreenHeight/2), (A_ScreenWidth), (A_ScreenHeight/2)
^#u::WinMove, A,, 0, 0, (A_ScreenWidth/2), (A_ScreenHeight/2)
^#i::WinMove, A,, (A_ScreenWidth/2), 0, (A_ScreenWidth/2), (A_ScreenHeight/2)
^#j::WinMove, A,, 0, (A_ScreenHeight/2), (A_ScreenWidth/2), (A_ScreenHeight/2)
^#k::WinMove, A,, (A_ScreenWidth/2), (A_ScreenHeight/2), (A_ScreenWidth/2), (A_ScreenHeight/2)
; MagnetApp-Like maximize/restore window - CTRL+ALT+Enter
^#Enter::
SysGet, VirtualScreenWidth, 78
WinGetPos, X, Y, Width, Height, A
If (Virtualscreenwidth = A_ScreenWidth) {
If (Width < A_ScreenWidth) {
WinMaximize, A
} Else {
WinRestore, A
}
}
Return
; --------------------------------------------------------------
; Application specific
; --------------------------------------------------------------
; Google Chrome
#IfWinActive, ahk_class Chrome_WidgetWin_1
; Show Web Developer Tools with cmd + alt + i
#!i::Send {F12}
; Show source code with cmd + alt + u
#!u::Send ^u
;!Left::Send !{Left}
;!Right::Send !{Right}
; Back
;#Left::Send
; Forward
#IfWinActive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment