Skip to content

Instantly share code, notes, and snippets.

@byBretema
Created May 18, 2020 17:42
Show Gist options
  • Save byBretema/847718327b933d9ef4e55558f4d3d337 to your computer and use it in GitHub Desktop.
Save byBretema/847718327b933d9ef4e55558f4d3d337 to your computer and use it in GitHub Desktop.
Emulate OSX keymap layout on Windows
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance force ; Allow only one instance of this script.
; --------------------------------------------------------------------------------
;
; === NOTES ===
;
; Emulate OSX keymap layout on Windows
; Based on : https://gist.github.com/fljot/58e46c92e99e7072ab56
;
; 1) Use SharpKeys app to swap modifier keys
; LControl becomes Winkey
; Winkey becomes LControl
; 2) Apply below script :)
;
; Default-Symbols reminder : [ ! = ALT, ^ = CTRL, + = SHIFT, # = WIN/CMD ]
; Symbols after step 1 : [ ! = ALT, # = CTRL, + = SHIFT, ^ = WIN/CMD ]
;
; --------------------------------------------------------------------------------
; WINDOWS MENU
LWin & vk07::return ; DISABLE Windows menu w/ fn key pressed
LWin::return ; DISABLE Windows menu
; DELETE
^BS::Send {LShift down}{Home}{LShift Up}{Del} ; cmd+delete = deletes whole line
!Delete::Send {LShift down}{LCtrl down}{Right}{Lctrl up}{LShift Up}{Del} ; alt+fn+delete = deletes next word
!BS::Send {LShift down}{LCtrl down}{Left}{Lctrl up}{LShift Up}{Del} ; alt+delete = deletes previous word
; CLOSE
^SC011::^F4 ; cmd+w = close tab
^SC010::Send {LAlt down}{Ctrl up}{F4}{LAlt up} ; cmd+q = close window
; WINDOW MANAGEMENT
LCtrl & Tab::AltTab ; cmd+tab = alt+tab (rotate between active windows)
!Tab::return ; alt+tab = disabled
^SC023::WinMinimize,a ; cmd+h = minimize
#Tab::Send {LCtrl down}{Tab}{LCtrl up} ; win+Tab = tab forward
+#Tab::Send {LCtrl down}{LShift down}{Tab}{LShift up}{LCtrl up} ; win+shift+Tab = tab backward
; PASTEBOARD
^+v::Send {LWin down}v{LWin up} ; cmd+shift+v = invoke cloud pasteboard
#v::return ; DISABLE default
; DESKTOP
^<::Send {LWin down}d{LWin up} ; cmd+< = show desktop
#d::return ; DISABLE default
; ARROWS : w/ Cmd
^Up::Send {Lctrl down}{Home}{Lctrl up} ; cmd+up = go to init of file (Home)
^Down::Send {Lctrl down}{End}{Lctrl up} ; cmd+donw = go to end of file (End)
^Left::Send {Home} ; cmd+left = go to init of line
^Right::Send {End} ; cmd+right = go to end of line
^+Up::Send {Shift down}{Lctrl down}{Home}{Lctrl up}{Shift up} ; cmd+shift+up = select to init of file (Home)
^+Down::Send {Shift down}{Lctrl down}{End}{Lctrl up}{Shift up} ; cmd+shift+donw = select to end of file (End)
^+Left::Send {Shift down}{Home}{Shift up} ; cmd+shift+left = select to init of line
^+Right::Send {Shift down}{End}{Shift up} ; cmd+shift+right = select to end of line
; ARROWS : w/ Alt
!Left::Send ^{Left} ; alt+left = go to init of word
!Right::Send ^{Right} ; alt+right = go to end of word
!+Left::Send {Shift down}{Lctrl down}{Left}{Lctrl up}{Shift up} ; alt+shift+left = select to init of word
!+Right::Send {Shift down}{Lctrl down}{Right}{Lctrl up}{Shift up} ; alt+shift+right = select to end of word
; --------------------------------------------------------------
; Google Chrome
; --------------------------------------------------------------
#IfWinActive, ahk_class Chrome_WidgetWin_1
^!SC017::Send {F12} ; cmd+alt+i = Webdev tools
^!SC016::Send {Alt up}{LCtrl down}{SC016}{LCtrl up} ; cmd+alt+u = Show source code
#IfWinActive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment