Last active
January 17, 2023 13:39
-
-
Save mahmoudimus/2c19e9d641353a4a25cc007bbd7bed69 to your computer and use it in GitHub Desktop.
autohotkey mac4win/emacs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Symbol Key | |
^ RCtrl | |
! Alt | |
# Windows Key (cmd in mac keyboard) | |
+ SHIFT | |
#c::Send, ^c | |
#v::Send, ^v | |
#x::Send, ^x | |
#w::Send, ^w | |
#s::Send, ^s | |
#t::Send, ^t | |
#z::Send, ^z | |
#f::Send, ^f | |
#r::Send, ^r | |
#a::Send, ^a | |
*/ | |
;----------------------------------------- | |
; Mac keyboard to Windows Key Mappings | |
;========================================= | |
; -------------------------------------------------------------- | |
; NOTES | |
; -------------------------------------------------------------- | |
; ! = ALT | |
; ^ = RCtrl | |
; + = SHIFT | |
; # = WIN | |
; | |
; Debug action snippet: MsgBox You pressed Control-A while Notepad is active. | |
#NoEnv ; Don't use environment (OS-level) variables. | |
#InstallKeybdHook | |
#InstallMouseHook | |
#UseHook | |
;;The lines below are optional. Delete them if you need to. | |
;; the below is not needed if you are using InstallKeybdHook | |
;; #HotkeyModifierTimeout 10 ; https://autohotkey.com/docs/commands/_HotkeyModifierTimeout.htm | |
;; ; (https://www.autohotkey.com/boards/viewtopic.php?t=31097) | |
;; #HotkeyInterval 150 ;~; Hotkey interval (default 2000 milliseconds). | |
#KeyHistory 100 ; https://autohotkey.com/docs/commands/_KeyHistory.htm ; useful for debugging. | |
;; https://www.autohotkey.com/boards/viewtopic.php?style=19&f=76&t=45932&hilit=vk07 | |
#MenuMaskKey vkE8 ;https://autohotkey.com/boards/viewtopic.php?f=76&t=57683 (vk07 conflicts w/ the XBox Game Bar) | |
#WinActivateForce ;https://autohotkey.com/docs/commands/_WinActivateForce.htm ;prevent taskbar flashing. | |
#SingleInstance,Force ;~; run replace old instance | |
;https://gist.github.com/Danik/5808330 | |
#Persistent ;~; Make the script run persistently | |
SetScrollLockState, AlwaysOff ;; make scroll-lock into a modifier! | |
SetCapsLockState, AlwaysOff | |
;;ListLines,Off ;~; don't show the most recently executed script line | |
;;AutoTrim,On ;~; Automatically remove leading and trailing spaces and tabs in variables | |
SendMode,Input ;~; Send keyboard and mouse clicks in a faster and more reliable way | |
CoordMode,Menu ;~; relative to the entire screen | |
SetBatchLines,-1 ;~; script executes at full speed | |
SetTitleMatchMode 2 | |
; The following line is a contribution of NTEmacs wiki http://www49.atwiki.jp/ntemacs/pages/20.html | |
SetKeyDelay 0 | |
;; Groups | |
GroupAdd, intellij, ahk_exe idea.exe | |
GroupAdd, intellij, ahk_exe idea64.exe | |
GroupAdd, vscode, ahk_exe VSCodium.exe | |
GroupAdd, vscode, ahk_exe Code.exe | |
GroupAdd, vscode, ahk_exe Code - Insiders.exe | |
;; EMACS START | |
; turns to be 1 when RCtrl-x is pressed | |
is_pre_x = 0 | |
; turns to be 1 when RCtrl-space is pressed | |
is_pre_spc = 0 | |
; Applications you want to disable emacs-like keybindings | |
; (Please comment out applications you don't use) | |
is_target() | |
{ | |
IfWinActive,ahk_class ConsoleWindowClass ; Cygwin | |
Return 1 | |
IfWinActive,ahk_class MEADOW ; Meadow | |
Return 1 | |
IfWinActive,ahk_class cygwin/x X rl-xterm-XTerm-0 | |
Return 1 | |
IfWinActive,ahk_class MozillaUIWindowClass ; keysnail on Firefox | |
Return 1 | |
; Avoid VMwareUnity with AutoHotkey | |
IfWinActive,ahk_class VMwareUnityHostWndClass | |
Return 1 | |
IfWinActive,ahk_class Vim ; GVIM | |
Return 1 | |
IfWinActive, ahk_group intellij | |
return 1 | |
; IfWinActive,ahk_class SunAwtFrame | |
; Return 1 | |
; IfWinActive,ahk_class SWT_Window0 ; Eclipse | |
; Return 1pr | |
; IfWinActive,ahk_class Xming X | |
; Return 1 | |
; IfWinActive,ahk_class Emacs ; NTEmacs | |
; Return 1 | |
; IfWinActive,ahk_class XEmacs ; XEmacs on Cygwin | |
; Return 1 | |
Return 0 | |
} | |
delete_char() | |
{ | |
Send {Del} | |
global is_pre_spc = 0 | |
Return | |
} | |
delete_backward_char() | |
{ | |
Send {BS} | |
global is_pre_spc = 0 | |
Return | |
} | |
kill_line() | |
{ | |
Send {ShiftDown}{END}{SHIFTUP} | |
Sleep 50 ;[ms] this value depends on your environment | |
Send ^x | |
global is_pre_spc = 0 | |
Return | |
} | |
open_line() | |
{ | |
Send {END}{Enter}{Up} | |
global is_pre_spc = 0 | |
Return | |
} | |
quit() | |
{ | |
Send {ESC} | |
global is_pre_spc = 0 | |
Return | |
} | |
newline() | |
{ | |
Send {Enter} | |
global is_pre_spc = 0 | |
Return | |
} | |
indent_for_tab_command() | |
{ | |
Send {Tab} | |
global is_pre_spc = 0 | |
Return | |
} | |
newline_and_indent() | |
{ | |
Send {Enter}{Tab} | |
global is_pre_spc = 0 | |
Return | |
} | |
isearch_forward() | |
{ | |
Send ^f | |
global is_pre_spc = 0 | |
Return | |
} | |
isearch_backward() | |
{ | |
Send ^f | |
global is_pre_spc = 0 | |
Return | |
} | |
kill_region() | |
{ | |
Send ^x | |
global is_pre_spc = 0 | |
Return | |
} | |
kill_ring_save() | |
{ | |
Send ^c | |
global is_pre_spc = 0 | |
Return | |
} | |
yank() | |
{ | |
Send ^v | |
global is_pre_spc = 0 | |
Return | |
} | |
undo() | |
{ | |
Send ^z | |
global is_pre_spc = 0 | |
Return | |
} | |
find_file() | |
{ | |
Send ^o | |
global is_pre_x = 0 | |
Return | |
} | |
save_buffer() | |
{ | |
Send, ^s | |
global is_pre_x = 0 | |
Return | |
} | |
kill_emacs() | |
{ | |
Send !{F4} | |
global is_pre_x = 0 | |
Return | |
} | |
move_beginning_of_line() | |
{ | |
global | |
if is_pre_spc | |
Send +{HOME} | |
Else | |
Send {HOME} | |
Return | |
} | |
move_end_of_line() | |
{ | |
global | |
if is_pre_spc | |
Send +{END} | |
Else | |
Send {END} | |
Return | |
} | |
previous_line() | |
{ | |
global | |
if WinActive("ahk_class Framework::CFrame") | |
{ | |
Send <^{Up} | |
Return | |
} | |
if is_pre_spc | |
Send +{Up} | |
Else | |
Send {Up} | |
Return | |
} | |
next_line() | |
{ | |
global | |
if WinActive("ahk_class Framework::CFrame") | |
{ | |
Send <^{Down} | |
Return | |
} | |
if is_pre_spc | |
Send +{Down} | |
Else | |
Send {Down} | |
Return | |
} | |
forward_char() | |
{ | |
global | |
if is_pre_spc | |
Send +{Right} | |
Else | |
Send {Right} | |
Return | |
} | |
backward_char() | |
{ | |
global | |
if is_pre_spc | |
Send +{Left} | |
Else | |
Send {Left} | |
Return | |
} | |
scroll_up() | |
{ | |
global | |
if is_pre_spc | |
Send +{PgUp} | |
Else | |
Send {PgUp} | |
Return | |
} | |
scroll_down() | |
{ | |
global | |
if is_pre_spc | |
Send +{PgDn} | |
Else | |
Send {PgDn} | |
Return | |
} | |
/* | |
^x:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
is_pre_x = 1 | |
Return | |
^f:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
{ | |
If is_pre_x | |
find_file() | |
Else | |
forward_char() | |
} | |
Return | |
*/ | |
!f:: | |
forward_char() | |
Return | |
/* | |
^c:: | |
If is_pre_x | |
kill_emacs() | |
Else | |
Send ^c | |
Return | |
*/ | |
^d:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
delete_char() | |
Return | |
/* | |
^h:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
delete_backward_char() | |
Return | |
^k:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
kill_line() | |
Return | |
*/ | |
;; ^o:: | |
;; If is_target() | |
;; Send %A_ThisHotkey% | |
;; Else | |
;; open_line() | |
;; Return | |
/* | |
^g:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
quit() | |
Return | |
*/ | |
;; ^j:: | |
;; If is_target() | |
;; Send %A_ThisHotkey% | |
;; Else | |
;; newline_and_indent() | |
;; Return | |
^m:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
newline() | |
Return | |
^i:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
indent_for_tab_command() | |
Return | |
^s:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
{ | |
If is_pre_x | |
save_buffer() | |
Else | |
Send ^s | |
} | |
Return | |
^r:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
isearch_backward() | |
Return | |
/* ^w:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
kill_region() | |
Return | |
!w:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
kill_ring_save() | |
Return | |
^y:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
yank() | |
Return | |
*/ | |
^/:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
undo() | |
Return | |
/* | |
;$^{Space}:: | |
;^vk20sc039:: | |
^vk20:: | |
If is_target() | |
Send {CtrlDown}{Space}{CtrlUp} | |
Else | |
{ | |
If is_pre_spc | |
is_pre_spc = 0 | |
Else | |
is_pre_spc = 1 | |
} | |
Return | |
^@:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
{ | |
If is_pre_spc | |
is_pre_spc = 0 | |
Else | |
is_pre_spc = 1 | |
} | |
Return | |
*/ | |
^a:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
move_beginning_of_line() | |
Return | |
^e:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
move_end_of_line() | |
Return | |
^p:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
previous_line() | |
Return | |
^n:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
next_line() | |
Return | |
^b:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
backward_char() | |
Return | |
<!b:: | |
backward_char() | |
Return | |
/* | |
^v:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
scroll_down() | |
Return | |
!v:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
scroll_up() | |
Return | |
*/ | |
^z:: Send ^z | |
^t:: Send ^t | |
^l:: Send ^l | |
^Space:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
Send ^{space} | |
return | |
;; EMACS END | |
; -------------------------------------------------------------- | |
; OS X system shortcuts | |
; -------------------------------------------------------------- | |
;; Basic Keys for MacOS | |
; -------------------------------------------------------------- | |
; Mac-like screenshots in Windows (requires Windows 10 Snip & Sketch) | |
; -------------------------------------------------------------- | |
; DISABLES UNMODIFIED WIN-KEY IN FAVOR OF OSX SPOTLIGHT-LIKE BEHAVIOR | |
;; https://www.autohotkey.com/boards/viewtopic.php?t=101812 | |
;;~LWin::vkE8 | |
*~LWin::Send {Blind}{vkE8} | |
/* | |
~LWin:: | |
if not WinActive("ahk_group intellij") | |
Send {Blind}{vkE8} | |
else | |
Send {vk00} | |
return | |
*/ | |
;#Space::LWin | |
; Capture entire screen with CMD/WIN + SHIFT + 3 | |
#+3::send #{PrintScreen} | |
; Capture portion of the screen with CMD/WIN + SHIFT + 4 | |
#+4::#+s | |
; -------------------------------------------------------------- | |
; media/function keys all mapped to the right option key | |
; -------------------------------------------------------------- | |
/* | |
RAlt & F7::SendInput {Media_Prev} | |
RAlt & F8::SendInput {Media_Play_Pause} | |
RAlt & F9::SendInput {Media_Next}S | |
F10::SendInput {Volume_Mute} | |
F11::SendInput {Volume_Down} | |
F12::SendInput {Volume_Up} | |
*/ | |
; 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 | |
; Remap Windows + Left OR Right to enable previous or next web page | |
; Use only if swapping left command/windows key with left alt | |
;Lwin & Left::Send, !{Left} | |
;Lwin & Right::Send, !{Right} | |
;following section remaps command-arrow | |
;keys to mimic OSX behaviour | |
#Up::Send {RCtrl down}{Home}{RCtrl up} | |
#Down::Send {RCtrl down}{End}{RCtrl up} | |
#Left::Send {Home} | |
#Right::Send {End} | |
; OSX NAVIGATION AND SELECTION WITH ALT | |
;~ !Left::Send {RCtrl down}{Left}{RCtrl up} | |
;~ !Right::Send {RCtrl down}{Right}{RCtrl up} | |
;~ !+Left::Send {RCtrl down}{shift down}{Left}{shift up}{RCtrl up} | |
;~ !+Right::Send {RCtrl down}{shift down}{Right}{shift up}{RCtrl up} | |
; REMAPS RCtrl-LEFT-CLICK TO CMD AND REPLICATES OSX RCtrl-CLICK RIGHT-CLICK | |
LWIN & LBUTTON::send {rctrl down}{LButton}{rctrl up} | |
RWIN & LBUTTON::send {rctrl down}{LButton}{rctrl up} | |
RCTRL & LBUTTON::send {RButton} | |
; Refer to http://ahkscript.org/docs/misc/Remap.htm | |
; Hyper key | |
;; https://github.com/bahamondev/tkl/blob/c3e5e6209061e2e24b547b5bf30e19ed475dd1c1/src/special-keys.ahk#L7 | |
~LControl:: | |
Send {RCtrl DownTemp}{Shift DownTemp}{Alt DownTemp} | |
KeyWait, LControl | |
Send {RCtrl Up}{Shift Up}{Alt Up} | |
return | |
/* | |
*LCtrl:: | |
SetKeyDelay -1 | |
Send {Blind}{RCtrl DownTemp}{Shift DownTemp}{Alt DownTemp} | |
return | |
*LCtrl up:: | |
SetKeyDelay -1 | |
Send {Blind}{Alt Up}{Shift Up}{RCtrl Up} | |
return | |
*/ | |
; Eject Key | |
;F20::SendInput {Insert} ; F20 doesn't show up on AHK anymore, see #3 | |
/* ; F13-15, standard windows mapping3 | |
F13::SendInput {PrintScreen} | |
F14::SendInput {ScrollLock} | |
F15::SendInput {Pause} | |
;F16-19 custom app launchers, see http://www.autohotkey.com/docs/Tutorial.htm for usage info | |
F16::Run http://twitter.com | |
F17::Run http://tumblr.com | |
F18::Run http://www.reddit.com | |
F19::Run https://facebook.com | |
*/ | |
; Make RCtrl + S work with cmd (windows) key | |
;; These below are going to be mapped by the emacs keybindings? | |
#s::Gosub, ^s | |
; Selecting | |
#a:: | |
;; Send {RCtrl Down}{a}{RCtrl Up} ; Select All | |
Send, ^{HOME} ^+{END} | |
;;Send, | |
Return | |
; Copyingn | |
#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 | |
; New tab | |
#t::Send ^t | |
; close tab | |
#w::Send ^w | |
; Close windows (cmd + q to Alt + F4) | |
#q::Send !{F4} | |
#n::Send ^n | |
; Remap Windows + Tab to Alt + Tab. | |
;Lwin & Tab::AltTab | |
; Cmd Tab For App Switching | |
/* | |
LWin & Tab::AltTab | |
; Lwin Tab for In-App Tab Switching | |
#if GetKeyState("LWin") | |
; https://autohotkey.com/board/topic/72433-controltab/ | |
*Tab:: | |
if(!GetKeyState("LWin")) | |
Send {LWin Down} | |
Send {Tab} | |
SetTimer, WaitForWinUp, 10 | |
ToolTip trigger | |
return | |
WaitForWinUp: | |
if(!GetKeyState("LWin", "P")) | |
{ | |
Send {LWin Up} | |
SetTimer, WaitForWinUp, Off | |
} | |
return | |
*/ | |
; New AltTab and CtrlTab fix | |
*tab:: | |
{ | |
; Tertiary | |
if (GetKeyState("RCtrl", "P") AND GetKeyState("LShift", "P") = false) { | |
; Secondary | |
; Send {LCtrl down}{Secondary up}{tab} | |
Send {RCtrl down}{LAlt up}{tab} ; MacModifiers | |
KeyWait, tab | |
; Tertiary | |
} else if (GetKeyState("RCtrl", "P") AND GetKeyState("LShift", "P")) { | |
; Secondary | |
; Send {LCtrl down}{Secondary up}{LShift down}{tab} | |
Send {RCtrl down}{LAlt up}{LShift down}{tab} ; MacModifiers | |
KeyWait, tab | |
; Primary | |
} else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P") = false) { ; MacModifiers | |
Send {LAlt down}{tab} | |
KeyWait, tab | |
; Primary | |
} else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P")) { ; MacModifiers | |
Send {LAlt down}{LShift down}{tab} | |
KeyWait, tab | |
; Secondary | |
} else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P") = false) { ; MacModifiers | |
return | |
; Secondary | |
} else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P")) { ; MacModifiers | |
return | |
} else { | |
send {Blind}{tab} | |
} | |
return | |
} | |
tab::Send {tab} | |
+tab::Send {Shift down}{tab}{Shift up} | |
; minimize windows | |
#m::WinMinimize,a | |
; -------------------------------------------------------------- | |
; Others | |
; -------------------------------------------------------------- | |
;following section remaps alt-delete keys to mimic OSX | |
;command-delete deletes whole line | |
#BS::Send {LShift down}{Home}{LShift Up}{Del} | |
;alt-function-delete deletes next word | |
!Delete::Send {LShift down}{RCtrl down}{Right}{LShift Up}{RCtrl up}{Del} | |
;alt-delete deletes previous word | |
!BS::Send {LShift down}{RCtrl down}{Left}{LShift Up}{RCtrl up}{Del} | |
/* ; following section remaps alt-arrow and command-arrow | |
* ; keys to mimic OSX behaviour | |
* #Left::Send {Home} | |
* #Right::Send {End} | |
* #Up::Send {RCtrl down}{Home}{RCtrl up} | |
* #Down::Send {RCtrl down}{End}{RCtrl up} | |
* | |
* !Left::SendInput, ^{Left} ; Option left | |
* !Right::SendInput, ^{Right} ; Option right | |
* | |
* <!+Left::Send {RCtrl down}{shift down}{Left}{shift up}{RCtrl up} ; CMD shift left | |
* <!+Right::Send {RCtrl down}{shift down}{Right}{shift up}{RCtrl up} ; CMD shift right | |
* | |
* ; Selection (uses a combination of the above with shift) | |
* | |
* +#Left::Send {shift down}{Home}{shift up} | |
* +#Right::Send {shift down}{End}{shift up} | |
* !+Up::Send {RCtrl down}{shift down}{Up}{shift up}{RCtrl up} | |
* !+Down::Send {RCtrl down}{shift down}{Down}{shift up}{RCtrl up} | |
* #+Up::Send {RCtrl down}{shift down}{Home}{shift up}{RCtrl up} | |
* #+Down::Send {RCtrl down}{shift down}{End}{shift up}{RCtrl up} | |
* LWin::return ; (or run Launchy) | |
*/ | |
; -------------------------------------------------------------- | |
; OS X keyboard mappings for special chars | |
; -------------------------------------------------------------- | |
;~ ; Map Alt + L to @ | |
;~ !l::SendInput {@} | |
;~ ; Map Alt + N to \ | |
;~ +!7::SendInput {\} | |
;~ ; Map Alt + N to © | |
;~ !g::SendInput {©} | |
;~ ; Map Alt + o to ø | |
;~ !o::SendInput {ø} | |
;~ ; Map Alt + 5 to [ | |
;~ !5::SendInput {[} | |
;~ ; Map Alt + 6 to ] | |
;~ !6::SendInput {]} | |
;~ ; Map Alt + E to € | |
;~ !e::SendInput {€} | |
;~ ; Map Alt + - to – | |
;~ !-::SendInput {–} | |
;~ ; Map Alt + 8 to { | |
;~ !8::SendInput {{} | |
;~ ; Map Alt + 9 to } | |
;~ !9::SendInput {}} | |
;~ ; Map Alt + - to ± | |
;~ !+::SendInput {±} | |
;~ ; Map Alt + R to ® | |
;~ !r::SendInput {®} | |
;~ ; Map Alt + N to | | |
;~ !7::SendInput {|} | |
;~ ; Map Alt + W to ∑ | |
;~ !w::SendInput {∑} | |
;~ ; Map Alt + N to ~ | |
;~ !n::SendInput {~} | |
;~ ; Map Alt + 3 to # | |
;~ !3::SendInput {#} | |
; -------------------------------------------------------------- | |
; Custom mappings for special chars | |
; -------------------------------------------------------------- | |
;#ö::SendInput {[} | |
;#ä::SendInput {]} | |
;^ö::SendInput {{} | |
;^ä::SendInput {}} | |
; -------------------------------------------------------------- | |
; Application specific | |
; -------------------------------------------------------------- | |
;SciTE4AutoHotkey | |
#IfWinActive, ahk_class SciTEWindow | |
#f::Send, ^h ;; mac sends find and replace | |
#If | |
; 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 | |
; Chrome shotcuts | |
; ! = ALT | |
; ^ = RCtrl | |
; + = SHIFT | |
; # = WIN | |
$#t::Send ^t | |
$#+t::Send ^+t | |
$#+]::Send {RCtrl Down}{Tab Down}{Tab Up}{RCtrl Up} | |
$#+[::Send {RCtrl Down}{Shift Down}{Tab Down}{Tab Up}{Shift Up}{RCtrl Up} | |
$#l::Send ^l | |
#w::Send ^w | |
$#n::Send ^n | |
$#+n::Send ^+n | |
$#y::Send ^h | |
; hijack the windows key when using chrome and make it do nothing | |
; otherwise, it will bring up the start menu and that's annoying! | |
#If | |
;-- | |
; intellij | |
;-- | |
;; https://www.autohotkey.com/docs/v1/KeyList.htm#IME | |
SendSuppressedKeyUp(key) { | |
DllCall("keybd_event" | |
, "char", GetKeyVK(key) | |
, "char", GetKeySC(key) | |
, "uint", KEYEVENTF_KEYUP := 0x2 | |
, "uptr", KEY_BLOCK_THIS := 0xFFC3D450) | |
} | |
#IfWinActive ahk_group intellij | |
;; https://superuser.com/questions/1378315/use-scrolllock-key-as-a-modifier-with-autohotkey | |
; Test hotkey: | |
;;!LWin::MsgBox % A_ThisHotkey | |
/* | |
; Remap LWin to RCtrl in a way compatible with IME. | |
~LWin::SendInput {RCtrl down} ;; {vk5b down} ;; {Alt up}{RCtrl up} ;RCtrl + Alt + S | |
~LWin Up::SendInput {RCtrl up} ;; | |
*/ | |
/* | |
$#c::ControlSend ,,{Blind}{LWin down}{c down}{c up}{LWin up},ahk_exe idea64.exe ; $Copy & Editor Copy | |
$#x::ControlSend ,,{Blind}{LWin down}{x down}{x up}{LWin up},ahk_exe idea64.exe ; $Cut & Editor Cut | |
$#v::ControlSend ,,{Blind}{LWin down}{v down}{v up}{LWin up},ahk_exe idea64.exe ; $Paste & Editor Paste | |
$^#F1::ControlSend ,,{Blind}{RCtrl down}{LWin down}{F1 down}{F1 up}{LWin up}{RCtrl up},ahk_exe idea64.exe ; ActivateGradleToolWindow | |
$+#o::ControlSend ,,{Blind}{LShift down}{LWin down}{o down}{o up}{LWin up}{LShift up},ahk_exe idea64.exe ; CollapseAllRegions | |
$#o::ControlSend ,,{Blind}{LWin down}{o down}{o up}{LWin up},ahk_exe idea64.exe ; CollapseRegion | |
$+#c::ControlSend ,,{Blind}{LShift down}{LWin down}{c down}{c up}{LWin up}{LShift up},ahk_exe idea64.exe ; EditorToggleColumnMode | |
$+#e::ControlSend ,,{Blind}{LShift down}{LWin down}{e down}{e up}{LWin up}{LShift up},ahk_exe idea64.exe ; ExpandAllRegions | |
$#e::ControlSend ,,{Blind}{LWin down}{e down}{e up}{LWin up},ahk_exe idea64.exe ; ExpandRegion | |
$#f::ControlSend ,,{Blind}{LWin down}{f down}{f up}{LWin up},ahk_exe idea64.exe ; FindInPath | |
$^#g::ControlSend ,,{Blind}{RCtrl down}{LWin down}{g down}{g up}{LWin up}{RCtrl up},ahk_exe idea64.exe ; GotoDeclaration | |
$#F1::ControlSend ,,{Blind}{LWin down}{F1 down}{F1 up}{LWin up},ahk_exe idea64.exe ; Gradle.ExecuteTask | |
$+#=::ControlSend ,,{Blind}{LShift down}{LWin down}{= down}{= up}{LWin up}{LShift up},ahk_exe idea64.exe ; Graph.ZoomIn | |
$+#-::ControlSend ,,{Blind}{LShift down}{LWin down}{- down}{- up}{LWin up}{LShift up},ahk_exe idea64.exe ; Graph.ZoomOut | |
$#0::ControlSend ,,{Blind}{LWin down}{0 down}{0 up}{LWin up},ahk_exe idea64.exe ; HideActiveWindow | |
$^#e::ControlSend ,,{Blind}{RCtrl down}{LWin down}{e down}{e up}{LWin up}{RCtrl up},ahk_exe idea64.exe ; Images.EditExternaly | |
$#m::ControlSend ,,{Blind}{LWin down}{m down}{m up}{LWin up},ahk_exe idea64.exe ; MinimizeCurrentWindow | |
$#n::ControlSend ,,{Blind}{LWin down}{n down}{n up}{LWin up},ahk_exe idea64.exe ; NewElement | |
$+#]::ControlSend ,,{Blind}{LShift down}{LWin down}{] down}{] up}{LWin up}{LShift up},ahk_exe idea64.exe ; NextTab | |
$+#[::ControlSend ,,{Blind}{LShift down}{LWin down}{[ down}{[ up}{LWin up}{LShift up},ahk_exe idea64.exe ; PreviousTab | |
$#r::ControlSend ,,{Blind}{LWin down}{r down}{r up}{LWin up},ahk_exe idea64.exe ; Refactorings.QuickListPopupAction | |
$#u::ControlSend ,,{Blind}{LWin down}{u down}{u up}{LWin up},ahk_exe idea64.exe ; ReloadFromDisk | |
$+#t::ControlSend ,,{Blind}{LShift down}{LWin down}{t down}{t up}{LWin up}{LShift up},ahk_exe idea64.exe ; ReopenClosedTab | |
$+#f::ControlSend ,,{Blind}{LShift down}{LWin down}{f down}{f up}{LWin up}{LShift up},ahk_exe idea64.exe ; ReplaceInPath | |
$+#b::ControlSend ,,{Blind}{LShift down}{LWin down}{b down}{b up}{LWin up}{LShift up},ahk_exe idea64.exe ; ShowBookmarks | |
$^#b::ControlSend ,,{Blind}{RCtrl down}{LWin down}{b down}{b up}{LWin up}{RCtrl up},ahk_exe idea64.exe ; ToggleBookmark | |
$#b::ControlSend ,,{Blind}{LWin down}{b down}{b up}{LWin up},ahk_exe idea64.exe ; ToggleBookmarkWithMnemonic | |
$^#q::ControlSend ,,{Blind}{RCtrl down}{LWin down}{q down}{q up}{LWin up}{RCtrl up},ahk_exe idea64.exe ; Tool_Text Slicing & Dicing _fill-paragraph | |
$#l::ControlSend ,,{Blind}{LWin down}{l down}{l up}{LWin up},ahk_exe idea64.exe ; Tool_linters_PyCheckLint8 (VirtualEnv) | |
*/ | |
$#c:: | |
Send {LAlt down}{w down} | |
return | |
$#c Up:: | |
Send {w up}{LAlt up} | |
return | |
$#x:: | |
Send {RCtrl down}{w down} | |
return | |
$#x Up:: | |
Send {w up}{RCtrl up} | |
return | |
$#v:: | |
Send {RCtrl down}{y down} | |
return | |
$#v Up:: | |
Send {y up}{RCtrl up} | |
return | |
;;$#s::ControlSend ,,{Blind}{LWin down}{s down}{s up}{LWin up},ahk_exe idea64.exe ; Save | |
$#s:: | |
Send {Blind}{LWin down}{s down} | |
return | |
$#s Up:: | |
Send {s up}{LWin up} | |
;if(GetKeyState("LWin", "P")) | |
; Send {LWin up} | |
return | |
; Refactorings.QuickListPopupAction | |
$#r:: | |
Send {Shift down}{F6 down} | |
return | |
$#r Up:: | |
Send {F6 up}{Shift up} | |
return | |
$#z:: | |
Send {RCtrl down}{Shift down}{- down} | |
return | |
$#z Up:: | |
Send {- up}{Shift up}{RCtrl up} | |
return | |
$^#F1::ControlSend ,,{Blind}{RCtrl down}{LWin down}{F1 down}{F1 up}{LWin up}{RCtrl up},ahk_exe idea64.exe ; ActivateGradleToolWindow | |
$+#o::ControlSend ,,{Blind}{LShift down}{LWin down}{o down}{o up}{LWin up}{LShift up},ahk_exe idea64.exe ; CollapseAllRegions | |
$#o::ControlSend ,,{Blind}{LWin down}{o down}{o up}{LWin up},ahk_exe idea64.exe ; CollapseRegion | |
$+#c::ControlSend ,,{Blind}{LShift down}{LWin down}{c down}{c up}{LWin up}{LShift up},ahk_exe idea64.exe ; EditorToggleColumnMode | |
$+#e::ControlSend ,,{Blind}{LShift down}{LWin down}{e down}{e up}{LWin up}{LShift up},ahk_exe idea64.exe ; ExpandAllRegions | |
$#e::ControlSend ,,{Blind}{LWin down}{e down}{e up}{LWin up},ahk_exe idea64.exe ; ExpandRegion | |
$#f::ControlSend ,,{Blind}{LWin down}{f down}{f up}{LWin up},ahk_exe idea64.exe ; FindInPath | |
$^#g::ControlSend ,,{Blind}{RCtrl down}{LWin down}{g down}{g up}{LWin up}{RCtrl up},ahk_exe idea64.exe ; GotoDeclaration | |
$#F1::ControlSend ,,{Blind}{LWin down}{F1 down}{F1 up}{LWin up},ahk_exe idea64.exe ; Gradle.ExecuteTask | |
$+#=::ControlSend ,,{Blind}{LShift down}{LWin down}{= down}{= up}{LWin up}{LShift up},ahk_exe idea64.exe ; Graph.ZoomIn | |
$+#-::ControlSend ,,{Blind}{LShift down}{LWin down}{- down}{- up}{LWin up}{LShift up},ahk_exe idea64.exe ; Graph.ZoomOut | |
$#0::ControlSend ,,{Blind}{LWin down}{0 down}{0 up}{LWin up},ahk_exe idea64.exe ; HideActiveWindow | |
$^#e::ControlSend ,,{Blind}{RCtrl down}{LWin down}{e down}{e up}{LWin up}{RCtrl up},ahk_exe idea64.exe ; Images.EditExternaly | |
$#m::ControlSend ,,{Blind}{LWin down}{m down}{m up}{LWin up},ahk_exe idea64.exe ; MinimizeCurrentWindow | |
$#n::ControlSend ,,{Blind}{LWin down}{n down}{n up}{LWin up},ahk_exe idea64.exe ; NewElement | |
$+#]::ControlSend ,,{Blind}{LShift down}{LWin down}{] down}{] up}{LWin up}{LShift up},ahk_exe idea64.exe ; NextTab | |
$+#[::ControlSend ,,{Blind}{LShift down}{LWin down}{[ down}{[ up}{LWin up}{LShift up},ahk_exe idea64.exe ; PreviousTab | |
$#u::ControlSend ,,{Blind}{LWin down}{u down}{u up}{LWin up},ahk_exe idea64.exe ; ReloadFromDisk | |
$+#t::ControlSend ,,{Blind}{LShift down}{LWin down}{t down}{t up}{LWin up}{LShift up},ahk_exe idea64.exe ; ReopenClosedTab | |
$+#f::ControlSend ,,{Blind}{LShift down}{LWin down}{f down}{f up}{LWin up}{LShift up},ahk_exe idea64.exe ; ReplaceInPath | |
$+#b::ControlSend ,,{Blind}{LShift down}{LWin down}{b down}{b up}{LWin up}{LShift up},ahk_exe idea64.exe ; ShowBookmarks | |
$^#b::ControlSend ,,{Blind}{RCtrl down}{LWin down}{b down}{b up}{LWin up}{RCtrl up},ahk_exe idea64.exe ; ToggleBookmark | |
$#b::ControlSend ,,{Blind}{LWin down}{b down}{b up}{LWin up},ahk_exe idea64.exe ; ToggleBookmarkWithMnemonic | |
$^#q::ControlSend ,,{Blind}{RCtrl down}{LWin down}{q down}{q up}{LWin up}{RCtrl up},ahk_exe idea64.exe ; Tool_Text Slicing & Dicing _fill-paragraph | |
$#l::ControlSend ,,{Blind}{LWin down}{l down}{l up}{LWin up},ahk_exe idea64.exe ; Tool_linters_PyCheckLint8 (VirtualEnv) | |
#If | |
; -------------------------------------------------------------- | |
; VS Code | |
; -------------------------------------------------------------- | |
#IfWinActive ahk_group vscode | |
;; #p::send {Up} ; Allow for traversing quick list | |
#n::send {Down} ; Allow for traversing quick list | |
; Open file | |
#p::Send, ^p | |
; Open command | |
#+p::Send, ^+p | |
; Select matching | |
#d::Send, ^d | |
; Clears console | |
#k::Send, ^k | |
; Open terminal | |
#j::Send, ^j | |
; Search everywhere | |
#+f::Send, ^+f | |
; Replace everywhere | |
#+h::Send, ^+h | |
; Perform replace everywhere | |
!#Enter::Send, ^!{return} | |
; Open Extensions Page | |
#<+x::Send, ^+x | |
; Close all tabs | |
#r::Send, ^r | |
; Close all other tabs | |
#e::Send, ^e | |
; Go back | |
#\::Send, ^\ | |
; Go forward | |
#+\::Send, ^+\ | |
; Remap RCtrl+Shift to behave like macOS Sublimetext | |
; Will extend cursor to multiple lines | |
; #+Up::send ^!{Up} ; Default - ST2CODE | |
; !+Up::send ^!{Up} ; CB/IBM - ST2CODE | |
; #+Down::send ^!{Down} ; Default - ST2CODE | |
; !+Down::send ^!{Down} ; CB/IBM - ST2CODE | |
; Remap RCtrl+Cmd+G to select all matches | |
; #^g::send ^+{L} ; Default - ST2CODE | |
; !^g::send ^+{L} ; CB/IBM - ST2CODE | |
!+g::send ^+{G} ; View source control | |
; $#c::Send {RCtrl down}c{RCtrl up} ; Default - Sigints interrupt | |
; $!c::Send {RCtrl down}c{RCtrl up} ; CB/IBM | |
; $#x::Send {RCtrl down}x{RCtrl up} ; Default - Sigints interrupt | |
; $!x::Send {RCtrl down}x{RCtrl up} ; CB/IBM | |
; #Space::Send ^{Space} ; Default - Basic code completion | |
; !Space::Send ^{Space} ; CB/IBM - Basic code completion | |
#If | |
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
; Super hotkeys(win+r etc.) | |
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
; Pass a file path to an application using Windows shell | |
runInShell(command, show := true, wait := false) { | |
shell := ComObjCreate("WScript.Shell") | |
shell.Run(command, show, wait) | |
} | |
;; that's what's up -- https://github.com/dnordstrom/hotkeys/blob/cd647e5a20f358bdee26dd9e3bb61242fde16f1e/functions.ahk#L331 | |
toggleTaskView() { | |
runInShell("explorer.exe shell:::{3080F90E-D7AD-11D9-BD98-0000947B0257}") | |
} | |
MButton:: | |
toggleTaskView() | |
return | |
#r:: | |
Run, %A_AppData%\Microsoft\Windows\Start Menu\Programs\System Tools\Run.lnk ; Shortcut to open the run dialog | |
return | |
F23::AppsKey | |
return | |
;; Modifiers: Unlike a normal hotkey, custom combinations act as though they have the wildcard (*) modifier by default. | |
;; type F5 & F6 < 500ms: release keys | |
;; hold F5 & F6 down > 500ms: (on/off) show (pressed/stuck down) keys | |
;; q::Send, {Shift Down}{LCtrl Down} ; Test | |
F5 & F6:: | |
KeyWait, F6 | |
IF (A_TimeSinceThisHotkey < 500) | |
{ ; type F5 & F6 < 500ms: release keys | |
Loop, 0xFF | |
IF GetKeyState(Key:=Format("VK{:X}",A_Index)) | |
SendInput, {%Key% up} | |
} | |
Else ; hold F5 & F6 down > 500ms: (on/off) show (pressed/stuck down) keys | |
SetTimer, StuckKeys,% (StuckKeys:=!StuckKeys)?100:"Off" | |
Return | |
StuckKeys: | |
CoordMode, ToolTip, Screen | |
ToolTip,% StuckKeys?KeyCombination():, 0, 0 | |
Return | |
KeyCombination(ExcludeKeys:="") | |
{ ;All pressed keys and buttons will be listed | |
ExcludeKeys .= "{Shift}{Control}{Alt}{WheelUp}{WheelDown}" | |
Loop, 0xFF | |
{ | |
IF !GetKeyState(Key:=Format("VK{:02X}",0x100-A_Index)) | |
Continue | |
If !InStr(ExcludeKeys,Key:="{" GetKeyName(Key) "}") | |
KeyCombination .= RegexReplace(Key,"Numpad(\D+)","$1") | |
} | |
Return, KeyCombination | |
} | |
/* | |
; Modify LShift to send RCtrl Shift Tab when pressed and LShift when held | |
*LShift:: | |
Send {Blind}{LShift down} | |
return | |
*LShift up:: | |
Send {Blind}{LShift up} | |
; Tooltip, %A_PRIORKEY% | |
; SetTimer, RemoveTooltip, 1000 | |
if A_PRIORKEY = LShift | |
{ | |
Send {RCtrl down}{LShift down}{Tab}{LShift up}{RCtrl up} | |
} | |
return | |
; Modify RShift to send RCtrl Shift Tab when pressed and RShift when held | |
*RShift:: | |
Send {Blind}{RShift down} | |
return | |
*RShift up:: | |
Send {Blind}{RShift up} | |
; Tooltip, %A_PRIORKEY% | |
; SetTimer, RemoveTooltip, 1000 | |
if A_PRIORKEY = RShift | |
{ | |
Send {RCtrl down}{Tab}{RCtrl up} | |
} | |
return | |
*/ | |
;;<!#r::Send, {Reload} | |
/* | |
#l::DllCall("LockWorkStation") ; Shortcut for locking the Computer. | |
#r::Run %appdata%\Microsoft\Windows\Start Menu\Programs\System Tools\Run.lnk | |
#q::!F4 ; Super+Q to ALT+F4 (xKill if SuperF4 is running). | |
#z::WinMinimize, A ; Minimize Active window with Super+z. | |
#Enter::Run, cmder.exe ; Runs Cmder with Super+Return. | |
#+e::Run explorer.exe ; Runs the file explorer when Shift+Super+e is pressed. | |
return | |
*/ | |
;; GetKeyName | |
;; https://www.autohotkey.com/docs/v1/lib/GetKey.htm#ExBasic | |
/* | |
;; | |
;; | |
;; There is also a way to trigger the Start menu without sending any keys (add quotes for v2): | |
;; | |
;; > SendMessage WM_SYSCOMMAND:=0x112, SC_TASKLIST:=0xF130,,, ahk_class Progman | |
;; | |
;; or even without actually sending the message (for v1/v2): | |
;; | |
;; > DllCall("DefWindowProc", "ptr", A_ScriptHwnd, "uint", 0x112, "ptr", 0xF130, "ptr", 0) | |
;; | |
;; https://www.autohotkey.com/boards/viewtopic.php?t=101812 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Modifiers: Unlike a normal hotkey, custom combinations act as though they have the wildcard (*) modifier by default. | |
;; type F5 & F6 < 500ms: release keys | |
;; hold F5 & F6 down > 500ms: (on/off) show (pressed/stuck down) keys | |
;; q::Send, {Shift Down}{LCtrl Down} ; Test | |
F5 & F6:: | |
KeyWait, F6 | |
IF (A_TimeSinceThisHotkey < 500) | |
{ ; type F5 & F6 < 500ms: release keys | |
Loop, 0xFF | |
IF GetKeyState(Key:=Format("VK{:X}",A_Index)) | |
SendInput, {%Key% up} | |
} | |
Else ; hold F5 & F6 down > 500ms: (on/off) show (pressed/stuck down) keys | |
SetTimer, StuckKeys,% (StuckKeys:=!StuckKeys)?100:"Off" | |
Return | |
StuckKeys: | |
CoordMode, ToolTip, Screen | |
ToolTip,% StuckKeys?KeyCombination():, 0, 0 | |
Return | |
KeyCombination(ExcludeKeys:="") | |
{ ;All pressed keys and buttons will be listed | |
ExcludeKeys .= "{Shift}{Control}{Alt}{WheelUp}{WheelDown}" | |
Loop, 0xFF | |
{ | |
IF !GetKeyState(Key:=Format("VK{:02X}",0x100-A_Index)) | |
Continue | |
If !InStr(ExcludeKeys,Key:="{" GetKeyName(Key) "}") | |
KeyCombination .= RegexReplace(Key,"Numpad(\D+)","$1") | |
} | |
Return, KeyCombination | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Symbol Key | |
^ RCtrl | |
! Alt | |
# Windows Key (cmd in mac keyboard) | |
+ SHIFT | |
#c::Send, ^c | |
#v::Send, ^v | |
#x::Send, ^x | |
#w::Send, ^w | |
#s::Send, ^s | |
#t::Send, ^t | |
#z::Send, ^z | |
#f::Send, ^f | |
#r::Send, ^r | |
#a::Send, ^a | |
*/ | |
;----------------------------------------- | |
; Mac keyboard to Windows Key Mappings | |
;========================================= | |
; -------------------------------------------------------------- | |
; NOTES | |
; -------------------------------------------------------------- | |
; ! = ALT | |
; ^ = RCtrl | |
; + = SHIFT | |
; # = WIN | |
; | |
; Debug action snippet: MsgBox You pressed Control-A while Notepad is active. | |
#NoEnv ; Don't use environment (OS-level) variables. | |
#InstallKeybdHook | |
#InstallMouseHook | |
#UseHook | |
;;The lines below are optional. Delete them if you need to. | |
;; the below is not needed if you are using InstallKeybdHook | |
;; #HotkeyModifierTimeout 10 ; https://autohotkey.com/docs/commands/_HotkeyModifierTimeout.htm | |
;; ; (https://www.autohotkey.com/boards/viewtopic.php?t=31097) | |
;; #HotkeyInterval 150 ;~; Hotkey interval (default 2000 milliseconds). | |
#KeyHistory 100 ; https://autohotkey.com/docs/commands/_KeyHistory.htm ; useful for debugging. | |
;; https://www.autohotkey.com/boards/viewtopic.php?style=19&f=76&t=45932&hilit=vk07 | |
#MenuMaskKey vkE8 ;https://autohotkey.com/boards/viewtopic.php?f=76&t=57683 (vk07 conflicts w/ the XBox Game Bar) | |
#WinActivateForce ;https://autohotkey.com/docs/commands/_WinActivateForce.htm ;prevent taskbar flashing. | |
#SingleInstance,Force ;~; run replace old instance | |
;https://gist.github.com/Danik/5808330 | |
#Persistent ;~; Make the script run persistently | |
SetScrollLockState, AlwaysOff ;; make scroll-lock into a modifier! | |
SetCapsLockState, AlwaysOff | |
;;ListLines,Off ;~; don't show the most recently executed script line | |
;;AutoTrim,On ;~; Automatically remove leading and trailing spaces and tabs in variables | |
SendMode,Input ;~; Send keyboard and mouse clicks in a faster and more reliable way | |
CoordMode,Menu ;~; relative to the entire screen | |
SetBatchLines,-1 ;~; script executes at full speed | |
SetTitleMatchMode 2 | |
; The following line is a contribution of NTEmacs wiki http://www49.atwiki.jp/ntemacs/pages/20.html | |
SetKeyDelay 0 | |
;; Groups | |
GroupAdd, intellij, ahk_exe idea.exe | |
GroupAdd, intellij, ahk_exe idea64.exe | |
GroupAdd, vscode, ahk_exe VSCodium.exe | |
GroupAdd, vscode, ahk_exe Code.exe | |
GroupAdd, vscode, ahk_exe Code - Insiders.exe | |
;; EMACS START | |
; turns to be 1 when RCtrl-x is pressed | |
is_pre_x = 0 | |
; turns to be 1 when RCtrl-space is pressed | |
is_pre_spc = 0 | |
; Applications you want to disable emacs-like keybindings | |
; (Please comment out applications you don't use) | |
is_target() | |
{ | |
IfWinActive,ahk_class ConsoleWindowClass ; Cygwin | |
Return 1 | |
IfWinActive,ahk_class MEADOW ; Meadow | |
Return 1 | |
IfWinActive,ahk_class cygwin/x X rl-xterm-XTerm-0 | |
Return 1 | |
IfWinActive,ahk_class MozillaUIWindowClass ; keysnail on Firefox | |
Return 1 | |
; Avoid VMwareUnity with AutoHotkey | |
IfWinActive,ahk_class VMwareUnityHostWndClass | |
Return 1 | |
IfWinActive,ahk_class Vim ; GVIM | |
Return 1 | |
IfWinActive, ahk_group intellij | |
return 1 | |
; IfWinActive,ahk_class SunAwtFrame | |
; Return 1 | |
; IfWinActive,ahk_class SWT_Window0 ; Eclipse | |
; Return 1pr | |
; IfWinActive,ahk_class Xming X | |
; Return 1 | |
; IfWinActive,ahk_class Emacs ; NTEmacs | |
; Return 1 | |
; IfWinActive,ahk_class XEmacs ; XEmacs on Cygwin | |
; Return 1 | |
Return 0 | |
} | |
delete_char() | |
{ | |
Send {Del} | |
global is_pre_spc = 0 | |
Return | |
} | |
delete_backward_char() | |
{ | |
Send {BS} | |
global is_pre_spc = 0 | |
Return | |
} | |
kill_line() | |
{ | |
Send {ShiftDown}{END}{SHIFTUP} | |
Sleep 50 ;[ms] this value depends on your environment | |
Send ^x | |
global is_pre_spc = 0 | |
Return | |
} | |
open_line() | |
{ | |
Send {END}{Enter}{Up} | |
global is_pre_spc = 0 | |
Return | |
} | |
quit() | |
{ | |
Send {ESC} | |
global is_pre_spc = 0 | |
Return | |
} | |
newline() | |
{ | |
Send {Enter} | |
global is_pre_spc = 0 | |
Return | |
} | |
indent_for_tab_command() | |
{ | |
Send {Tab} | |
global is_pre_spc = 0 | |
Return | |
} | |
newline_and_indent() | |
{ | |
Send {Enter}{Tab} | |
global is_pre_spc = 0 | |
Return | |
} | |
isearch_forward() | |
{ | |
Send ^f | |
global is_pre_spc = 0 | |
Return | |
} | |
isearch_backward() | |
{ | |
Send ^f | |
global is_pre_spc = 0 | |
Return | |
} | |
kill_region() | |
{ | |
Send ^x | |
global is_pre_spc = 0 | |
Return | |
} | |
kill_ring_save() | |
{ | |
Send ^c | |
global is_pre_spc = 0 | |
Return | |
} | |
yank() | |
{ | |
Send ^v | |
global is_pre_spc = 0 | |
Return | |
} | |
undo() | |
{ | |
Send ^z | |
global is_pre_spc = 0 | |
Return | |
} | |
find_file() | |
{ | |
Send ^o | |
global is_pre_x = 0 | |
Return | |
} | |
save_buffer() | |
{ | |
Send, ^s | |
global is_pre_x = 0 | |
Return | |
} | |
kill_emacs() | |
{ | |
Send !{F4} | |
global is_pre_x = 0 | |
Return | |
} | |
move_beginning_of_line() | |
{ | |
global | |
if is_pre_spc | |
Send +{HOME} | |
Else | |
Send {HOME} | |
Return | |
} | |
move_end_of_line() | |
{ | |
global | |
if is_pre_spc | |
Send +{END} | |
Else | |
Send {END} | |
Return | |
} | |
previous_line() | |
{ | |
global | |
if WinActive("ahk_class Framework::CFrame") | |
{ | |
Send <^{Up} | |
Return | |
} | |
if is_pre_spc | |
Send +{Up} | |
Else | |
Send {Up} | |
Return | |
} | |
next_line() | |
{ | |
global | |
if WinActive("ahk_class Framework::CFrame") | |
{ | |
Send <^{Down} | |
Return | |
} | |
if is_pre_spc | |
Send +{Down} | |
Else | |
Send {Down} | |
Return | |
} | |
forward_char() | |
{ | |
global | |
if is_pre_spc | |
Send +{Right} | |
Else | |
Send {Right} | |
Return | |
} | |
backward_char() | |
{ | |
global | |
if is_pre_spc | |
Send +{Left} | |
Else | |
Send {Left} | |
Return | |
} | |
scroll_up() | |
{ | |
global | |
if is_pre_spc | |
Send +{PgUp} | |
Else | |
Send {PgUp} | |
Return | |
} | |
scroll_down() | |
{ | |
global | |
if is_pre_spc | |
Send +{PgDn} | |
Else | |
Send {PgDn} | |
Return | |
} | |
/* | |
^x:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
is_pre_x = 1 | |
Return | |
^f:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
{ | |
If is_pre_x | |
find_file() | |
Else | |
forward_char() | |
} | |
Return | |
*/ | |
!f:: | |
forward_char() | |
Return | |
/* | |
^c:: | |
If is_pre_x | |
kill_emacs() | |
Else | |
Send ^c | |
Return | |
*/ | |
^d:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
delete_char() | |
Return | |
/* | |
^h:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
delete_backward_char() | |
Return | |
^k:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
kill_line() | |
Return | |
*/ | |
;; ^o:: | |
;; If is_target() | |
;; Send %A_ThisHotkey% | |
;; Else | |
;; open_line() | |
;; Return | |
/* | |
^g:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
quit() | |
Return | |
*/ | |
;; ^j:: | |
;; If is_target() | |
;; Send %A_ThisHotkey% | |
;; Else | |
;; newline_and_indent() | |
;; Return | |
^m:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
newline() | |
Return | |
^i:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
indent_for_tab_command() | |
Return | |
^s:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
{ | |
If is_pre_x | |
save_buffer() | |
Else | |
Send ^s | |
} | |
Return | |
^r:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
isearch_backward() | |
Return | |
/* ^w:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
kill_region() | |
Return | |
!w:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
kill_ring_save() | |
Return | |
^y:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
yank() | |
Return | |
*/ | |
^/:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
undo() | |
Return | |
/* | |
;$^{Space}:: | |
;^vk20sc039:: | |
^vk20:: | |
If is_target() | |
Send {CtrlDown}{Space}{CtrlUp} | |
Else | |
{ | |
If is_pre_spc | |
is_pre_spc = 0 | |
Else | |
is_pre_spc = 1 | |
} | |
Return | |
^@:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
{ | |
If is_pre_spc | |
is_pre_spc = 0 | |
Else | |
is_pre_spc = 1 | |
} | |
Return | |
*/ | |
^a:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
move_beginning_of_line() | |
Return | |
^e:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
move_end_of_line() | |
Return | |
^p:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
previous_line() | |
Return | |
^n:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
next_line() | |
Return | |
^b:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
backward_char() | |
Return | |
<!b:: | |
backward_char() | |
Return | |
/* | |
^v:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
scroll_down() | |
Return | |
!v:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
scroll_up() | |
Return | |
*/ | |
^z:: Send ^z | |
^t:: Send ^t | |
^l:: Send ^l | |
^Space:: | |
If is_target() | |
Send %A_ThisHotkey% | |
Else | |
Send ^{space} | |
return | |
;; EMACS END | |
; -------------------------------------------------------------- | |
; OS X system shortcuts | |
; -------------------------------------------------------------- | |
;; Basic Keys for MacOS | |
; -------------------------------------------------------------- | |
; Mac-like screenshots in Windows (requires Windows 10 Snip & Sketch) | |
; -------------------------------------------------------------- | |
; DISABLES UNMODIFIED WIN-KEY IN FAVOR OF OSX SPOTLIGHT-LIKE BEHAVIOR | |
;; https://www.autohotkey.com/boards/viewtopic.php?t=101812 | |
;;~LWin::vkE8 | |
*~LWin::Send {Blind}{vkE8} | |
/* | |
~LWin:: | |
if not WinActive("ahk_group intellij") | |
Send {Blind}{vkE8} | |
else | |
Send {vk00} | |
return | |
*/ | |
;#Space::LWin | |
; Capture entire screen with CMD/WIN + SHIFT + 3 | |
#+3::send #{PrintScreen} | |
; Capture portion of the screen with CMD/WIN + SHIFT + 4 | |
#+4::#+s | |
; -------------------------------------------------------------- | |
; media/function keys all mapped to the right option key | |
; -------------------------------------------------------------- | |
/* | |
RAlt & F7::SendInput {Media_Prev} | |
RAlt & F8::SendInput {Media_Play_Pause} | |
RAlt & F9::SendInput {Media_Next}S | |
F10::SendInput {Volume_Mute} | |
F11::SendInput {Volume_Down} | |
F12::SendInput {Volume_Up} | |
*/ | |
; 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 | |
; Remap Windows + Left OR Right to enable previous or next web page | |
; Use only if swapping left command/windows key with left alt | |
;Lwin & Left::Send, !{Left} | |
;Lwin & Right::Send, !{Right} | |
;following section remaps command-arrow | |
;keys to mimic OSX behaviour | |
#Up::Send {RCtrl down}{Home}{RCtrl up} | |
#Down::Send {RCtrl down}{End}{RCtrl up} | |
#Left::Send {Home} | |
#Right::Send {End} | |
; OSX NAVIGATION AND SELECTION WITH ALT | |
;~ !Left::Send {RCtrl down}{Left}{RCtrl up} | |
;~ !Right::Send {RCtrl down}{Right}{RCtrl up} | |
;~ !+Left::Send {RCtrl down}{shift down}{Left}{shift up}{RCtrl up} | |
;~ !+Right::Send {RCtrl down}{shift down}{Right}{shift up}{RCtrl up} | |
; REMAPS RCtrl-LEFT-CLICK TO CMD AND REPLICATES OSX RCtrl-CLICK RIGHT-CLICK | |
LWIN & LBUTTON::send {rctrl down}{LButton}{rctrl up} | |
RWIN & LBUTTON::send {rctrl down}{LButton}{rctrl up} | |
RCTRL & LBUTTON::send {RButton} | |
; Refer to http://ahkscript.org/docs/misc/Remap.htm | |
*LCtrl:: | |
SetKeyDelay -1 | |
Send {Blind}{RCtrl DownTemp}{Shift DownTemp}{Alt DownTemp} | |
return | |
*LCtrl up:: | |
SetKeyDelay -1 | |
Send {Blind}{Alt Up}{Shift Up}{RCtrl Up} | |
return | |
; Eject Key | |
;F20::SendInput {Insert} ; F20 doesn't show up on AHK anymore, see #3 | |
/* ; F13-15, standard windows mapping3 | |
F13::SendInput {PrintScreen} | |
F14::SendInput {ScrollLock} | |
F15::SendInput {Pause} | |
;F16-19 custom app launchers, see http://www.autohotkey.com/docs/Tutorial.htm for usage info | |
F16::Run http://twitter.com | |
F17::Run http://tumblr.com | |
F18::Run http://www.reddit.com | |
F19::Run https://facebook.com | |
*/ | |
; Make RCtrl + S work with cmd (windows) key | |
;; These below are going to be mapped by the emacs keybindings? | |
#s::Gosub, ^s | |
; Selecting | |
#a:: | |
;; Send {RCtrl Down}{a}{RCtrl Up} ; Select All | |
Send, ^{HOME} ^+{END} | |
;;Send, | |
Return | |
; Copyingn | |
#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 | |
; New tab | |
#t::Send ^t | |
; close tab | |
#w::Send ^w | |
; Close windows (cmd + q to Alt + F4) | |
#q::Send !{F4} | |
#n::Send ^n | |
; Remap Windows + Tab to Alt + Tab. | |
;Lwin & Tab::AltTab | |
; Cmd Tab For App Switching | |
/* | |
LWin & Tab::AltTab | |
; Lwin Tab for In-App Tab Switching | |
#if GetKeyState("LWin") | |
; https://autohotkey.com/board/topic/72433-controltab/ | |
*Tab:: | |
if(!GetKeyState("LWin")) | |
Send {LWin Down} | |
Send {Tab} | |
SetTimer, WaitForWinUp, 10 | |
ToolTip trigger | |
return | |
WaitForWinUp: | |
if(!GetKeyState("LWin", "P")) | |
{ | |
Send {LWin Up} | |
SetTimer, WaitForWinUp, Off | |
} | |
return | |
*/ | |
; New AltTab and CtrlTab fix | |
*tab:: | |
{ | |
; Tertiary | |
if (GetKeyState("RCtrl", "P") AND GetKeyState("LShift", "P") = false) { | |
; Secondary | |
; Send {LCtrl down}{Secondary up}{tab} | |
Send {RCtrl down}{LAlt up}{tab} ; MacModifiers | |
KeyWait, tab | |
; Tertiary | |
} else if (GetKeyState("RCtrl", "P") AND GetKeyState("LShift", "P")) { | |
; Secondary | |
; Send {LCtrl down}{Secondary up}{LShift down}{tab} | |
Send {RCtrl down}{LAlt up}{LShift down}{tab} ; MacModifiers | |
KeyWait, tab | |
; Primary | |
} else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P") = false) { ; MacModifiers | |
Send {LAlt down}{tab} | |
KeyWait, tab | |
; Primary | |
} else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P")) { ; MacModifiers | |
Send {LAlt down}{LShift down}{tab} | |
KeyWait, tab | |
; Secondary | |
} else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P") = false) { ; MacModifiers | |
return | |
; Secondary | |
} else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P")) { ; MacModifiers | |
return | |
} else { | |
send {Blind}{tab} | |
} | |
return | |
} | |
tab::Send {tab} | |
+tab::Send {Shift down}{tab}{Shift up} | |
; minimize windows | |
#m::WinMinimize,a | |
; -------------------------------------------------------------- | |
; Others | |
; -------------------------------------------------------------- | |
;following section remaps alt-delete keys to mimic OSX | |
;command-delete deletes whole line | |
#BS::Send {LShift down}{Home}{LShift Up}{Del} | |
;alt-function-delete deletes next word | |
!Delete::Send {LShift down}{RCtrl down}{Right}{LShift Up}{RCtrl up}{Del} | |
;alt-delete deletes previous word | |
!BS::Send {LShift down}{RCtrl down}{Left}{LShift Up}{RCtrl up}{Del} | |
/* ; following section remaps alt-arrow and command-arrow | |
* ; keys to mimic OSX behaviour | |
* #Left::Send {Home} | |
* #Right::Send {End} | |
* #Up::Send {RCtrl down}{Home}{RCtrl up} | |
* #Down::Send {RCtrl down}{End}{RCtrl up} | |
* | |
* !Left::SendInput, ^{Left} ; Option left | |
* !Right::SendInput, ^{Right} ; Option right | |
* | |
* <!+Left::Send {RCtrl down}{shift down}{Left}{shift up}{RCtrl up} ; CMD shift left | |
* <!+Right::Send {RCtrl down}{shift down}{Right}{shift up}{RCtrl up} ; CMD shift right | |
* | |
* ; Selection (uses a combination of the above with shift) | |
* | |
* +#Left::Send {shift down}{Home}{shift up} | |
* +#Right::Send {shift down}{End}{shift up} | |
* !+Up::Send {RCtrl down}{shift down}{Up}{shift up}{RCtrl up} | |
* !+Down::Send {RCtrl down}{shift down}{Down}{shift up}{RCtrl up} | |
* #+Up::Send {RCtrl down}{shift down}{Home}{shift up}{RCtrl up} | |
* #+Down::Send {RCtrl down}{shift down}{End}{shift up}{RCtrl up} | |
* LWin::return ; (or run Launchy) | |
*/ | |
; -------------------------------------------------------------- | |
; OS X keyboard mappings for special chars | |
; -------------------------------------------------------------- | |
;~ ; Map Alt + L to @ | |
;~ !l::SendInput {@} | |
;~ ; Map Alt + N to \ | |
;~ +!7::SendInput {\} | |
;~ ; Map Alt + N to © | |
;~ !g::SendInput {©} | |
;~ ; Map Alt + o to ø | |
;~ !o::SendInput {ø} | |
;~ ; Map Alt + 5 to [ | |
;~ !5::SendInput {[} | |
;~ ; Map Alt + 6 to ] | |
;~ !6::SendInput {]} | |
;~ ; Map Alt + E to € | |
;~ !e::SendInput {€} | |
;~ ; Map Alt + - to – | |
;~ !-::SendInput {–} | |
;~ ; Map Alt + 8 to { | |
;~ !8::SendInput {{} | |
;~ ; Map Alt + 9 to } | |
;~ !9::SendInput {}} | |
;~ ; Map Alt + - to ± | |
;~ !+::SendInput {±} | |
;~ ; Map Alt + R to ® | |
;~ !r::SendInput {®} | |
;~ ; Map Alt + N to | | |
;~ !7::SendInput {|} | |
;~ ; Map Alt + W to ∑ | |
;~ !w::SendInput {∑} | |
;~ ; Map Alt + N to ~ | |
;~ !n::SendInput {~} | |
;~ ; Map Alt + 3 to # | |
;~ !3::SendInput {#} | |
; -------------------------------------------------------------- | |
; Custom mappings for special chars | |
; -------------------------------------------------------------- | |
;#ö::SendInput {[} | |
;#ä::SendInput {]} | |
;^ö::SendInput {{} | |
;^ä::SendInput {}} | |
; -------------------------------------------------------------- | |
; Application specific | |
; -------------------------------------------------------------- | |
;SciTE4AutoHotkey | |
#IfWinActive, ahk_class SciTEWindow | |
#f::Send, ^h ;; mac sends find and replace | |
#If | |
; 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 | |
; Chrome shotcuts | |
; ! = ALT | |
; ^ = RCtrl | |
; + = SHIFT | |
; # = WIN | |
$#t::Send ^t | |
$#+t::Send ^+t | |
$#+]::Send {RCtrl Down}{Tab Down}{Tab Up}{RCtrl Up} | |
$#+[::Send {RCtrl Down}{Shift Down}{Tab Down}{Tab Up}{Shift Up}{RCtrl Up} | |
$#l::Send ^l | |
#w::Send ^w | |
$#n::Send ^n | |
$#+n::Send ^+n | |
$#y::Send ^h | |
; hijack the windows key when using chrome and make it do nothing | |
; otherwise, it will bring up the start menu and that's annoying! | |
#If | |
;-- | |
; intellij | |
;-- | |
;; https://www.autohotkey.com/docs/v1/KeyList.htm#IME | |
SendSuppressedKeyUp(key) { | |
DllCall("keybd_event" | |
, "char", GetKeyVK(key) | |
, "char", GetKeySC(key) | |
, "uint", KEYEVENTF_KEYUP := 0x2 | |
, "uptr", KEY_BLOCK_THIS := 0xFFC3D450) | |
} | |
#IfWinActive ahk_group intellij | |
;; https://superuser.com/questions/1378315/use-scrolllock-key-as-a-modifier-with-autohotkey | |
; Test hotkey: | |
;;!LWin::MsgBox % A_ThisHotkey | |
/* | |
; Remap LWin to RCtrl in a way compatible with IME. | |
~LWin::SendInput {RCtrl down} ;; {vk5b down} ;; {Alt up}{RCtrl up} ;RCtrl + Alt + S | |
~LWin Up::SendInput {RCtrl up} ;; | |
*/ | |
/* | |
$#c::ControlSend ,,{Blind}{LWin down}{c down}{c up}{LWin up},ahk_exe idea64.exe ; $Copy & Editor Copy | |
$#x::ControlSend ,,{Blind}{LWin down}{x down}{x up}{LWin up},ahk_exe idea64.exe ; $Cut & Editor Cut | |
$#v::ControlSend ,,{Blind}{LWin down}{v down}{v up}{LWin up},ahk_exe idea64.exe ; $Paste & Editor Paste | |
$^#F1::ControlSend ,,{Blind}{RCtrl down}{LWin down}{F1 down}{F1 up}{LWin up}{RCtrl up},ahk_exe idea64.exe ; ActivateGradleToolWindow | |
$+#o::ControlSend ,,{Blind}{LShift down}{LWin down}{o down}{o up}{LWin up}{LShift up},ahk_exe idea64.exe ; CollapseAllRegions | |
$#o::ControlSend ,,{Blind}{LWin down}{o down}{o up}{LWin up},ahk_exe idea64.exe ; CollapseRegion | |
$+#c::ControlSend ,,{Blind}{LShift down}{LWin down}{c down}{c up}{LWin up}{LShift up},ahk_exe idea64.exe ; EditorToggleColumnMode | |
$+#e::ControlSend ,,{Blind}{LShift down}{LWin down}{e down}{e up}{LWin up}{LShift up},ahk_exe idea64.exe ; ExpandAllRegions | |
$#e::ControlSend ,,{Blind}{LWin down}{e down}{e up}{LWin up},ahk_exe idea64.exe ; ExpandRegion | |
$#f::ControlSend ,,{Blind}{LWin down}{f down}{f up}{LWin up},ahk_exe idea64.exe ; FindInPath | |
$^#g::ControlSend ,,{Blind}{RCtrl down}{LWin down}{g down}{g up}{LWin up}{RCtrl up},ahk_exe idea64.exe ; GotoDeclaration | |
$#F1::ControlSend ,,{Blind}{LWin down}{F1 down}{F1 up}{LWin up},ahk_exe idea64.exe ; Gradle.ExecuteTask | |
$+#=::ControlSend ,,{Blind}{LShift down}{LWin down}{= down}{= up}{LWin up}{LShift up},ahk_exe idea64.exe ; Graph.ZoomIn | |
$+#-::ControlSend ,,{Blind}{LShift down}{LWin down}{- down}{- up}{LWin up}{LShift up},ahk_exe idea64.exe ; Graph.ZoomOut | |
$#0::ControlSend ,,{Blind}{LWin down}{0 down}{0 up}{LWin up},ahk_exe idea64.exe ; HideActiveWindow | |
$^#e::ControlSend ,,{Blind}{RCtrl down}{LWin down}{e down}{e up}{LWin up}{RCtrl up},ahk_exe idea64.exe ; Images.EditExternaly | |
$#m::ControlSend ,,{Blind}{LWin down}{m down}{m up}{LWin up},ahk_exe idea64.exe ; MinimizeCurrentWindow | |
$#n::ControlSend ,,{Blind}{LWin down}{n down}{n up}{LWin up},ahk_exe idea64.exe ; NewElement | |
$+#]::ControlSend ,,{Blind}{LShift down}{LWin down}{] down}{] up}{LWin up}{LShift up},ahk_exe idea64.exe ; NextTab | |
$+#[::ControlSend ,,{Blind}{LShift down}{LWin down}{[ down}{[ up}{LWin up}{LShift up},ahk_exe idea64.exe ; PreviousTab | |
$#r::ControlSend ,,{Blind}{LWin down}{r down}{r up}{LWin up},ahk_exe idea64.exe ; Refactorings.QuickListPopupAction | |
$#u::ControlSend ,,{Blind}{LWin down}{u down}{u up}{LWin up},ahk_exe idea64.exe ; ReloadFromDisk | |
$+#t::ControlSend ,,{Blind}{LShift down}{LWin down}{t down}{t up}{LWin up}{LShift up},ahk_exe idea64.exe ; ReopenClosedTab | |
$+#f::ControlSend ,,{Blind}{LShift down}{LWin down}{f down}{f up}{LWin up}{LShift up},ahk_exe idea64.exe ; ReplaceInPath | |
$+#b::ControlSend ,,{Blind}{LShift down}{LWin down}{b down}{b up}{LWin up}{LShift up},ahk_exe idea64.exe ; ShowBookmarks | |
$^#b::ControlSend ,,{Blind}{RCtrl down}{LWin down}{b down}{b up}{LWin up}{RCtrl up},ahk_exe idea64.exe ; ToggleBookmark | |
$#b::ControlSend ,,{Blind}{LWin down}{b down}{b up}{LWin up},ahk_exe idea64.exe ; ToggleBookmarkWithMnemonic | |
$^#q::ControlSend ,,{Blind}{RCtrl down}{LWin down}{q down}{q up}{LWin up}{RCtrl up},ahk_exe idea64.exe ; Tool_Text Slicing & Dicing _fill-paragraph | |
$#l::ControlSend ,,{Blind}{LWin down}{l down}{l up}{LWin up},ahk_exe idea64.exe ; Tool_linters_PyCheckLint8 (VirtualEnv) | |
*/ | |
$#c:: | |
Send {LAlt down}{w down} | |
return | |
$#c Up:: | |
Send {w up}{LAlt up} | |
return | |
$#x:: | |
Send {RCtrl down}{w down} | |
return | |
$#x Up:: | |
Send {w up}{RCtrl up} | |
return | |
$#v:: | |
Send {RCtrl down}{y down} | |
return | |
$#v Up:: | |
Send {y up}{RCtrl up} | |
return | |
;;$#s::ControlSend ,,{Blind}{LWin down}{s down}{s up}{LWin up},ahk_exe idea64.exe ; Save | |
$#s:: | |
Send {Blind}{LWin down}{s down} | |
return | |
$#s Up:: | |
Send {s up}{LWin up} | |
;if(GetKeyState("LWin", "P")) | |
; Send {LWin up} | |
return | |
; Refactorings.QuickListPopupAction | |
$#r:: | |
Send {Shift down}{F6 down} | |
return | |
$#r Up:: | |
Send {F6 up}{Shift up} | |
return | |
$#z:: | |
Send {RCtrl down}{Shift down}{- down} | |
return | |
$#z Up:: | |
Send {- up}{Shift up}{RCtrl up} | |
return | |
$^#F1::ControlSend ,,{Blind}{RCtrl down}{LWin down}{F1 down}{F1 up}{LWin up}{RCtrl up},ahk_exe idea64.exe ; ActivateGradleToolWindow | |
$+#o::ControlSend ,,{Blind}{LShift down}{LWin down}{o down}{o up}{LWin up}{LShift up},ahk_exe idea64.exe ; CollapseAllRegions | |
$#o::ControlSend ,,{Blind}{LWin down}{o down}{o up}{LWin up},ahk_exe idea64.exe ; CollapseRegion | |
$+#c::ControlSend ,,{Blind}{LShift down}{LWin down}{c down}{c up}{LWin up}{LShift up},ahk_exe idea64.exe ; EditorToggleColumnMode | |
$+#e::ControlSend ,,{Blind}{LShift down}{LWin down}{e down}{e up}{LWin up}{LShift up},ahk_exe idea64.exe ; ExpandAllRegions | |
$#e::ControlSend ,,{Blind}{LWin down}{e down}{e up}{LWin up},ahk_exe idea64.exe ; ExpandRegion | |
$#f::ControlSend ,,{Blind}{LWin down}{f down}{f up}{LWin up},ahk_exe idea64.exe ; FindInPath | |
$^#g::ControlSend ,,{Blind}{RCtrl down}{LWin down}{g down}{g up}{LWin up}{RCtrl up},ahk_exe idea64.exe ; GotoDeclaration | |
$#F1::ControlSend ,,{Blind}{LWin down}{F1 down}{F1 up}{LWin up},ahk_exe idea64.exe ; Gradle.ExecuteTask | |
$+#=::ControlSend ,,{Blind}{LShift down}{LWin down}{= down}{= up}{LWin up}{LShift up},ahk_exe idea64.exe ; Graph.ZoomIn | |
$+#-::ControlSend ,,{Blind}{LShift down}{LWin down}{- down}{- up}{LWin up}{LShift up},ahk_exe idea64.exe ; Graph.ZoomOut | |
$#0::ControlSend ,,{Blind}{LWin down}{0 down}{0 up}{LWin up},ahk_exe idea64.exe ; HideActiveWindow | |
$^#e::ControlSend ,,{Blind}{RCtrl down}{LWin down}{e down}{e up}{LWin up}{RCtrl up},ahk_exe idea64.exe ; Images.EditExternaly | |
$#m::ControlSend ,,{Blind}{LWin down}{m down}{m up}{LWin up},ahk_exe idea64.exe ; MinimizeCurrentWindow | |
$#n::ControlSend ,,{Blind}{LWin down}{n down}{n up}{LWin up},ahk_exe idea64.exe ; NewElement | |
$+#]::ControlSend ,,{Blind}{LShift down}{LWin down}{] down}{] up}{LWin up}{LShift up},ahk_exe idea64.exe ; NextTab | |
$+#[::ControlSend ,,{Blind}{LShift down}{LWin down}{[ down}{[ up}{LWin up}{LShift up},ahk_exe idea64.exe ; PreviousTab | |
$#u::ControlSend ,,{Blind}{LWin down}{u down}{u up}{LWin up},ahk_exe idea64.exe ; ReloadFromDisk | |
$+#t::ControlSend ,,{Blind}{LShift down}{LWin down}{t down}{t up}{LWin up}{LShift up},ahk_exe idea64.exe ; ReopenClosedTab | |
$+#f::ControlSend ,,{Blind}{LShift down}{LWin down}{f down}{f up}{LWin up}{LShift up},ahk_exe idea64.exe ; ReplaceInPath | |
$+#b::ControlSend ,,{Blind}{LShift down}{LWin down}{b down}{b up}{LWin up}{LShift up},ahk_exe idea64.exe ; ShowBookmarks | |
$^#b::ControlSend ,,{Blind}{RCtrl down}{LWin down}{b down}{b up}{LWin up}{RCtrl up},ahk_exe idea64.exe ; ToggleBookmark | |
$#b::ControlSend ,,{Blind}{LWin down}{b down}{b up}{LWin up},ahk_exe idea64.exe ; ToggleBookmarkWithMnemonic | |
$^#q::ControlSend ,,{Blind}{RCtrl down}{LWin down}{q down}{q up}{LWin up}{RCtrl up},ahk_exe idea64.exe ; Tool_Text Slicing & Dicing _fill-paragraph | |
$#l::ControlSend ,,{Blind}{LWin down}{l down}{l up}{LWin up},ahk_exe idea64.exe ; Tool_linters_PyCheckLint8 (VirtualEnv) | |
#If | |
; -------------------------------------------------------------- | |
; VS Code | |
; -------------------------------------------------------------- | |
#IfWinActive ahk_group vscode | |
;; #p::send {Up} ; Allow for traversing quick list | |
#n::send {Down} ; Allow for traversing quick list | |
; Open file | |
#p::Send, ^p | |
; Open command | |
#+p::Send, ^+p | |
; Select matching | |
#d::Send, ^d | |
; Clears console | |
#k::Send, ^k | |
; Open terminal | |
#j::Send, ^j | |
; Search everywhere | |
#+f::Send, ^+f | |
; Replace everywhere | |
#+h::Send, ^+h | |
; Perform replace everywhere | |
!#Enter::Send, ^!{return} | |
; Open Extensions Page | |
#<+x::Send, ^+x | |
; Close all tabs | |
#r::Send, ^r | |
; Close all other tabs | |
#e::Send, ^e | |
; Go back | |
#\::Send, ^\ | |
; Go forward | |
#+\::Send, ^+\ | |
; Remap RCtrl+Shift to behave like macOS Sublimetext | |
; Will extend cursor to multiple lines | |
; #+Up::send ^!{Up} ; Default - ST2CODE | |
; !+Up::send ^!{Up} ; CB/IBM - ST2CODE | |
; #+Down::send ^!{Down} ; Default - ST2CODE | |
; !+Down::send ^!{Down} ; CB/IBM - ST2CODE | |
; Remap RCtrl+Cmd+G to select all matches | |
; #^g::send ^+{L} ; Default - ST2CODE | |
; !^g::send ^+{L} ; CB/IBM - ST2CODE | |
!+g::send ^+{G} ; View source control | |
; $#c::Send {RCtrl down}c{RCtrl up} ; Default - Sigints interrupt | |
; $!c::Send {RCtrl down}c{RCtrl up} ; CB/IBM | |
; $#x::Send {RCtrl down}x{RCtrl up} ; Default - Sigints interrupt | |
; $!x::Send {RCtrl down}x{RCtrl up} ; CB/IBM | |
; #Space::Send ^{Space} ; Default - Basic code completion | |
; !Space::Send ^{Space} ; CB/IBM - Basic code completion | |
#If | |
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
; Super hotkeys(win+r etc.) | |
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
; Pass a file path to an application using Windows shell | |
runInShell(command, show := true, wait := false) { | |
shell := ComObjCreate("WScript.Shell") | |
shell.Run(command, show, wait) | |
} | |
;; that's what's up -- https://github.com/dnordstrom/hotkeys/blob/cd647e5a20f358bdee26dd9e3bb61242fde16f1e/functions.ahk#L331 | |
toggleTaskView() { | |
runInShell("explorer.exe shell:::{3080F90E-D7AD-11D9-BD98-0000947B0257}") | |
} | |
MButton:: | |
toggleTaskView() | |
return | |
#r:: | |
Run, %A_AppData%\Microsoft\Windows\Start Menu\Programs\System Tools\Run.lnk ; Shortcut to open the run dialog | |
return | |
F23::AppsKey | |
return | |
;; Modifiers: Unlike a normal hotkey, custom combinations act as though they have the wildcard (*) modifier by default. | |
;; type F5 & F6 < 500ms: release keys | |
;; hold F5 & F6 down > 500ms: (on/off) show (pressed/stuck down) keys | |
;; q::Send, {Shift Down}{LCtrl Down} ; Test | |
F5 & F6:: | |
KeyWait, F6 | |
IF (A_TimeSinceThisHotkey < 500) | |
{ ; type F5 & F6 < 500ms: release keys | |
Loop, 0xFF | |
IF GetKeyState(Key:=Format("VK{:X}",A_Index)) | |
SendInput, {%Key% up} | |
} | |
Else ; hold F5 & F6 down > 500ms: (on/off) show (pressed/stuck down) keys | |
SetTimer, StuckKeys,% (StuckKeys:=!StuckKeys)?100:"Off" | |
Return | |
StuckKeys: | |
CoordMode, ToolTip, Screen | |
ToolTip,% StuckKeys?KeyCombination():, 0, 0 | |
Return | |
KeyCombination(ExcludeKeys:="") | |
{ ;All pressed keys and buttons will be listed | |
ExcludeKeys .= "{Shift}{Control}{Alt}{WheelUp}{WheelDown}" | |
Loop, 0xFF | |
{ | |
IF !GetKeyState(Key:=Format("VK{:02X}",0x100-A_Index)) | |
Continue | |
If !InStr(ExcludeKeys,Key:="{" GetKeyName(Key) "}") | |
KeyCombination .= RegexReplace(Key,"Numpad(\D+)","$1") | |
} | |
Return, KeyCombination | |
} | |
/* | |
; Modify LShift to send RCtrl Shift Tab when pressed and LShift when held | |
*LShift:: | |
Send {Blind}{LShift down} | |
return | |
*LShift up:: | |
Send {Blind}{LShift up} | |
; Tooltip, %A_PRIORKEY% | |
; SetTimer, RemoveTooltip, 1000 | |
if A_PRIORKEY = LShift | |
{ | |
Send {RCtrl down}{LShift down}{Tab}{LShift up}{RCtrl up} | |
} | |
return | |
; Modify RShift to send RCtrl Shift Tab when pressed and RShift when held | |
*RShift:: | |
Send {Blind}{RShift down} | |
return | |
*RShift up:: | |
Send {Blind}{RShift up} | |
; Tooltip, %A_PRIORKEY% | |
; SetTimer, RemoveTooltip, 1000 | |
if A_PRIORKEY = RShift | |
{ | |
Send {RCtrl down}{Tab}{RCtrl up} | |
} | |
return | |
*/ | |
;;<!#r::Send, {Reload} | |
/* | |
#l::DllCall("LockWorkStation") ; Shortcut for locking the Computer. | |
#r::Run %appdata%\Microsoft\Windows\Start Menu\Programs\System Tools\Run.lnk | |
#q::!F4 ; Super+Q to ALT+F4 (xKill if SuperF4 is running). | |
#z::WinMinimize, A ; Minimize Active window with Super+z. | |
#Enter::Run, cmder.exe ; Runs Cmder with Super+Return. | |
#+e::Run explorer.exe ; Runs the file explorer when Shift+Super+e is pressed. | |
return | |
*/ | |
;; GetKeyName | |
;; https://www.autohotkey.com/docs/v1/lib/GetKey.htm#ExBasic | |
/* | |
;; | |
;; | |
;; There is also a way to trigger the Start menu without sending any keys (add quotes for v2): | |
;; | |
;; > SendMessage WM_SYSCOMMAND:=0x112, SC_TASKLIST:=0xF130,,, ahk_class Progman | |
;; | |
;; or even without actually sending the message (for v1/v2): | |
;; | |
;; > DllCall("DefWindowProc", "ptr", A_ScriptHwnd, "uint", 0x112, "ptr", 0xF130, "ptr", 0) | |
;; | |
;; https://www.autohotkey.com/boards/viewtopic.php?t=101812 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment