From 463730fe1b4c1ba547a9d74f845d2f0bb7d051a8 Mon Sep 17 00:00:00 2001 From: "Schiano, Mattia" Date: Tue, 11 Aug 2020 15:51:50 -0400 Subject: [PATCH 1/7] Making autohotkey hotkey for ctrl + backspace only read raw keyboard input to prevent alt + backspace from triggering ctrl + backspace --- windows/kinto.ahk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/windows/kinto.ahk b/windows/kinto.ahk index 60d112a..429fb83 100644 --- a/windows/kinto.ahk +++ b/windows/kinto.ahk @@ -258,7 +258,7 @@ $^+Right::Send +{End} ^+Up::Send ^+{Home} ^Down::Send ^{End} ^+Down::Send ^+{End} -^Backspace::Send +{Home}{Delete} +$^Backspace::Send +{Home}{Delete} !Backspace::Send ^{Backspace} !Left::Send ^{Left} !+Left::Send ^+{Left} @@ -303,7 +303,7 @@ $^+Right::Send +{End} #+q::Send !q ;Context info #!o::Send ^!o ;Optimize imports #!i::Send ^!i ;Auto-indent line(s) - ^Backspace::Send ^y ;Delete line at caret + $^Backspace::Send ^y ;Delete line at caret #+j::Send ^+j ;Smart line join !Delete::Send ^{Delete} ;Delete to word end !Backspace::Send ^{Backspace} ;Delete to word start From c38cccdb4452b4eaa431566c6cf18426427ba354 Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Mon, 24 Aug 2020 01:49:30 -0500 Subject: [PATCH 2/7] - Added manual code completion for vscode and sublimetext. Closes #264 --- windows/kinto.ahk | 2 ++ xkeysnail-config/kinto.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/windows/kinto.ahk b/windows/kinto.ahk index 429fb83..441114d 100644 --- a/windows/kinto.ahk +++ b/windows/kinto.ahk @@ -363,6 +363,7 @@ $^Backspace::Send +{Home}{Delete} ; Sublime Text Remaps for VS Code #IfWinActive ahk_group vscode + #Space::Send ^{Space} ; Basic code completion ; Remap Ctrl+Shift to behave like macOS Sublimetext ; Will extend cursor to multiple lines ; #+Up::send ^!{Up} ; ST2CODE @@ -375,6 +376,7 @@ $^Backspace::Send +{Home}{Delete} #If #IfWinActive ahk_exe sublime_text.exe + #Space::Send ^{Space} ; Basic code completion #^Up::send !{O} ; Switch file #^f::send {F11} ; toggle_full_screen ^!v::send {Ctrl Down}k{Ctrl Up}{Ctrl Down}v{Ctrl Up} ; paste_from_history diff --git a/xkeysnail-config/kinto.py b/xkeysnail-config/kinto.py index 3ad6182..4fd35e5 100644 --- a/xkeysnail-config/kinto.py +++ b/xkeysnail-config/kinto.py @@ -213,6 +213,7 @@ define_keymap(None,{ }) define_keymap(lambda wm_class: wm_class.casefold() not in mscodes,{ + K("Super-Space"): K("C-Space"), # Basic code completion # Wordwise remaining - for Everything but VS Code K("M-Left"): K("C-Left"), # Left of Word K("M-Shift-Left"): K("C-Shift-Left"), # Select Left of Word @@ -272,6 +273,7 @@ define_keymap(re.compile(codeStr, re.IGNORECASE),{ # Keybindings for Sublime Text define_keymap(re.compile("Sublime_text", re.IGNORECASE),{ + K("Super-Space"): K("C-Space"), # Basic code completion K("C-Super-up"): K("M-o"), # Switch file K("Super-RC-f"): K("f11"), # toggle_full_screen K("C-M-v"): [K("C-k"), K("C-v")], # paste_from_history From b1d5aa68f3cbc704dd038a3d5aa8a74c3386fa36 Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Mon, 24 Aug 2020 03:50:16 -0500 Subject: [PATCH 3/7] - Added support for user profiles with spaces under Windows 10. Closes #266 --- setup.py | 27 ++++++++++++++------------- windows/detectUSB.ahk | 4 ++-- windows/kinto-start.vbs | 4 ++-- windows/kinto.ahk | 4 ++-- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/setup.py b/setup.py index f7a3024..24f1543 100755 --- a/setup.py +++ b/setup.py @@ -16,13 +16,13 @@ def windows_setup(): default = int(input("\nPlease enter your desired keymap (1 - " + str(len(keymaps)) + ") : ")) print("") # Short DOS path notation - path= cmdline('echo %cd%')[:-1] + path= cmdline('echo ''%cd%''')[:-1] if default > 0 and default < 3: print("Will now install chocolatey and autohotkey with elevated privileges...") print("This install will fail if you are not running with elevated privileges") os.system('powershell -executionpolicy bypass ".\\windows\\autohotkey.ps1"') print("Copying autohotkey combinations for Terminals & Editors...") - os.system("copy /Y " + path + "\\windows\\kinto.ahk " + path + "\\windows\\kinto-new.ahk") + os.system('copy /Y "' + path + '\\windows\\kinto.ahk" "' + path + '\\windows\\kinto-new.ahk"') if default == 1: os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; MacModifiers)/$2$3/g" .\\windows\\kinto-new.ahk') elif default == 2: @@ -36,27 +36,28 @@ def windows_setup(): print("Ending any running Kinto tasks...") os.system("(taskkill /IM autohotkey.exe) 2> nul") print("Removing Kinto from users profile directory...") - os.system('(rd /s /q %userprofile%\\.kinto) 2> nul') + os.system('(rd /s /q "%userprofile%\\.kinto") 2> nul') print("") print("Uninstall of Kinto is Complete.") if default > 0 and default < 3: stvscode = yn_choice(bcolors.CYELLOW2 + "Would you like to use Sublime Text 3 keymaps in VS Code?\n" + bcolors.ENDC) print("\nWill now install Ubuntu Termimnal Theme as default...") - os.system("regedit " + path + "\\windows\\theme_ubuntu.reg") - os.system('robocopy '+ path + '\\assets "%userprofile%\\.kinto\\assets" /E') + os.system('regedit "' + path + '\\windows\\theme_ubuntu.reg"') + os.system('robocopy "'+ path + '\\assets" "%userprofile%\\.kinto\\assets" /E') if(stvscode): os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; ST2CODE)/$2$3/g" .\\windows\\kinto-new.ahk') - os.system('copy /Y ' + path + '\\windows\\kinto-start.vbs "%userprofile%\\.kinto\\kinto-start.vbs') - os.system('copy /Y ' + path + '\\windows\\usb.vbs "%userprofile%\\.kinto\\usb.vbs"') - os.system('copy /Y ' + path + '\\windows\\detectUSB.ahk "%userprofile%\\.kinto\\detectUSB.ahk"') + os.system('copy /Y "' + path + '\\windows\\kinto-start.vbs" "%userprofile%\\.kinto\\kinto-start.vbs"') + os.system('copy /Y "' + path + '\\windows\\usb.vbs" "%userprofile%\\.kinto\\usb.vbs"') + os.system('copy /Y "' + path + '\\windows\\detectUSB.ahk" "%userprofile%\\.kinto\\detectUSB.ahk"') os.system('mklink "%userprofile%\\Start Menu\\Programs\\Startup\\kinto-start.vbs" "%userprofile%\\.kinto\\kinto-start.vbs"') - os.system('copy /Y '+ path + '\\windows\\NoShell.vbs "%userprofile%\\.kinto\\NoShell.vbs"') - os.system('copy /Y '+ path + '\\windows\\toggle_kb.bat "%userprofile%\\.kinto\\toggle_kb.bat"') - os.system('copy /Y '+ path + '\\windows\\kinto-new.ahk "%userprofile%\\.kinto\\kinto.ahk"') + os.system('copy /Y "'+ path + '\\windows\\NoShell.vbs" "%userprofile%\\.kinto\\NoShell.vbs"') + os.system('copy /Y "'+ path + '\\windows\\toggle_kb.bat" "%userprofile%\\.kinto\\toggle_kb.bat"') + os.system('copy /Y "'+ path + '\\windows\\kinto-new.ahk" "%userprofile%\\.kinto\\kinto.ahk"') os.system("del /f .\\windows\\kinto-new.ahk") os.system("del \"C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\kinto.ahk\" 2> nul") - os.system("%userprofile%\\AppData\\Roaming\\Microsoft\\Windows\\STARTM~1\\Programs\\Startup\\kinto-start.vbs") - + userpath = cmdline('cmd /c for %A in ("%userprofile%") do @echo %~sA')[:-1] + print('Starting... "' + userpath + '\\AppData\\Roaming\\Microsoft\\Windows\\STARTM~1\\Programs\\Startup\\kinto-start.vbs"') + os.system('"' + userpath + '\\AppData\\Roaming\\Microsoft\\Windows\\STARTM~1\\Programs\\Startup\\kinto-start.vbs"') # # print("\nPlease log off and back on for changes to take full effect.") print("If using WSL then please remember to right click on title bar -> Properties -> Edit Options -> Use Ctrl+Shift+C/V as Copy/Paste and enable it.") else: diff --git a/windows/detectUSB.ahk b/windows/detectUSB.ahk index f09c33f..c434a68 100644 --- a/windows/detectUSB.ahk +++ b/windows/detectUSB.ahk @@ -27,11 +27,11 @@ notify_change(wParam, lParam, msg, hwnd) if InStr(kbtype, "Apple") { ; MsgBox, Apple - Run, %A_ScriptDir%\NoShell.vbs %A_ScriptDir%\toggle_kb.bat mac, %A_ScriptDir% + Run, "%A_ScriptDir%\NoShell.vbs" "%A_ScriptDir%\toggle_kb.bat" mac, "%A_ScriptDir%" } else{ ; MsgBox, Windows - Run, %A_ScriptDir%\NoShell.vbs %A_ScriptDir%\toggle_kb.bat win, %A_ScriptDir% + Run, "%A_ScriptDir%\NoShell.vbs" "%A_ScriptDir%\toggle_kb.bat" win, "%A_ScriptDir%" } ; MsgBox % kbtype } diff --git a/windows/kinto-start.vbs b/windows/kinto-start.vbs index fbe1078..374a1a4 100644 --- a/windows/kinto-start.vbs +++ b/windows/kinto-start.vbs @@ -2,6 +2,6 @@ Set oShell = CreateObject("Shell.Application") Set wShell = WScript.CreateObject("WScript.Shell") Set fso = CreateObject("Scripting.FileSystemObject") -path = wShell.ExpandEnvironmentStrings("%userprofile%") -strFolder = fso.BuildPath(path, "\.kinto\kinto.ahk") +path = wShell.ExpandEnvironmentStrings("""%userprofile%") +strFolder = fso.BuildPath( path, "\.kinto\kinto.ahk""") oShell.ShellExecute "C:\Program Files\AutoHotkey\AutoHotkey.exe", strFolder, , "runas", 0 \ No newline at end of file diff --git a/windows/kinto.ahk b/windows/kinto.ahk index 441114d..60c749a 100644 --- a/windows/kinto.ahk +++ b/windows/kinto.ahk @@ -46,11 +46,11 @@ Menu, Tray, Add, Close, Exit Menu, Tray, Click, 1 winkb(){ - Run, %A_ScriptDir%\NoShell.vbs %A_ScriptDir%\toggle_kb.bat win, %A_ScriptDir% + Run, "%A_ScriptDir%\NoShell.vbs" "%A_ScriptDir%\toggle_kb.bat" win, "%A_ScriptDir%" } mackb(){ - Run, %A_ScriptDir%\NoShell.vbs %A_ScriptDir%\toggle_kb.bat mac, %A_ScriptDir% + Run, "%A_ScriptDir%\NoShell.vbs" "%A_ScriptDir%\toggle_kb.bat" mac, "%A_ScriptDir%" } min(){ From b1c361080aee2a742f1f1a8102ecaeb46ba8da12 Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Mon, 24 Aug 2020 03:57:22 -0500 Subject: [PATCH 4/7] - Prevents physical Ctrl+Space from remapping into Ctrl+Esc, aka start menu. #264 --- windows/kinto.ahk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows/kinto.ahk b/windows/kinto.ahk index 60c749a..94a562f 100644 --- a/windows/kinto.ahk +++ b/windows/kinto.ahk @@ -266,7 +266,7 @@ $^Backspace::Send +{Home}{Delete} !+Right::Send ^+{Right} ; Cmd+Space Alternative -^Space::Send ^{Esc} +$^Space::Send ^{Esc} #IfWinActive ahk_group intellij ; General From 0a5c52694191dec51ae964f7781eb2666d48e0dc Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Mon, 24 Aug 2020 14:30:50 -0500 Subject: [PATCH 5/7] - Additional fixes for Windows 10 user profile spaces --- windows/detectUSB.ahk | 3 +-- windows/usb.vbs | 12 +++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/windows/detectUSB.ahk b/windows/detectUSB.ahk index c434a68..18f9ddd 100644 --- a/windows/detectUSB.ahk +++ b/windows/detectUSB.ahk @@ -11,13 +11,12 @@ WinHide % "ahk_id " DllCall("GetConsoleWindow", "ptr") notify_change(wParam, lParam, msg, hwnd) { global lastkb - ; kbtype = % ComObjCreate("WScript.Shell").Exec("cscript /nologo usb.vbs").StdOut.ReadAll() DetectHiddenWindows On Run %ComSpec%,, Hide, pid WinWait ahk_pid %pid% DllCall("AttachConsole", "UInt", pid) WshShell := ComObjCreate("Wscript.Shell") - exec := WshShell.Exec("cscript /nologo usb.vbs") + exec := WshShell.Exec("cscript /nologo ""%userprofile%\.kinto\usb.vbs""") kbtype := exec.StdOut.ReadAll() DllCall("FreeConsole") Process Close, %pid% diff --git a/windows/usb.vbs b/windows/usb.vbs index ab0cdef..7cdf704 100644 --- a/windows/usb.vbs +++ b/windows/usb.vbs @@ -1,5 +1,5 @@ Option Explicit -Dim oWMISrv, collDvcs, iUSBDvc , iDvc, sDvcID, sPID, sVID +Dim oWMISrv, collDvcs, iUSBDvc , iDvc, sDvcID, sPID, sVID, deviceID ' add item to array Function AddItem(arr, val) @@ -49,21 +49,23 @@ Dim nonApple: nonApple = 0 Dim i If vcount = 1 Then + deviceID = deviceVID(0) If StrComp(deviceVID(0), "05AC") = 0 Then - Wscript.Echo "Apple" + Wscript.Echo "Apple " & deviceID Else - Wscript.Echo "Windows" + Wscript.Echo "Windows " & deviceID End If Else For i = 0 To counter-1 + deviceID = deviceVID(i) If StrComp(deviceVID(i), "05AC") = -1 Then nonApple = 1 End If Next If nonApple = 1 Then - Wscript.Echo "Windows" + Wscript.Echo "Windows " & deviceID Else - Wscript.Echo "Apple" + Wscript.Echo "Apple " & deviceID End If End If From a4dca21c225b32e9e7b323570eb3de9156d06f7d Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Tue, 25 Aug 2020 04:10:07 -0500 Subject: [PATCH 6/7] - Added VS Code Quick File List traversing --- windows/kinto.ahk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/windows/kinto.ahk b/windows/kinto.ahk index 94a562f..8054834 100644 --- a/windows/kinto.ahk +++ b/windows/kinto.ahk @@ -363,6 +363,8 @@ $^Space::Send ^{Esc} ; Sublime Text Remaps for VS Code #IfWinActive ahk_group vscode + #p::send {Up} ; Allow for traversing quick list + #n::send {Down} ; Allow for traversing quick list #Space::Send ^{Space} ; Basic code completion ; Remap Ctrl+Shift to behave like macOS Sublimetext ; Will extend cursor to multiple lines From 45e637a2a646f534c652972c032d7aa90067ab3d Mon Sep 17 00:00:00 2001 From: Ben Reaves Date: Tue, 25 Aug 2020 04:15:07 -0500 Subject: [PATCH 7/7] - Added virtualbox fix --- windows/kinto.ahk | 757 +++++++++++++++++++++++----------------------- 1 file changed, 383 insertions(+), 374 deletions(-) diff --git a/windows/kinto.ahk b/windows/kinto.ahk index 8054834..f8fc3e1 100644 --- a/windows/kinto.ahk +++ b/windows/kinto.ahk @@ -118,6 +118,10 @@ GroupAdd, editors, ahk_exe Code.exe GroupAdd, browsers, ahk_exe chrome.exe GroupAdd, browsers, ahk_exe opera.exe GroupAdd, browsers, ahk_exe firefox.exe +; Disable Key Remapping for Virtual Machines +; Disable for Remote desktop solutions too +GroupAdd, virtm, ahk_exe VirtualBoxVM.exe + ; Disabled Edge for now - no ability to close all instances ; GroupAdd, browsers, Microsoft Edge ahk_class ApplicationFrameWindow @@ -129,389 +133,394 @@ GroupAdd, vstudio, ahk_exe devenv.exe GroupAdd, intellij, ahk_exe idea.exe GroupAdd, intellij, ahk_exe idea64.exe -; New AltTab and CtrlTab fix -*tab:: -{ - ; Tertiary - if (GetKeyState("LCtrl", "P") AND GetKeyState("LShift", "P") = false) { +; SetCapsLockState, AlwaysOff ; CB/IBM + +#IfWinNotActive ahk_group virtm + + ; New AltTab and CtrlTab fix + *tab:: + { + ; Tertiary + if (GetKeyState("LCtrl", "P") AND GetKeyState("LShift", "P") = false) { + ; Secondary + ; Send {LCtrl down}{Secondary up}{tab} + ; Send {LCtrl down}{LWin up}{tab} ; WinModifiers + ; Send {LCtrl down}{LAlt up}{tab} ; MacModifiers + KeyWait, tab + ; Tertiary + } else if (GetKeyState("LCtrl", "P") AND GetKeyState("LShift", "P")) { + ; Secondary + ; Send {LCtrl down}{Secondary up}{LShift down}{tab} + ; Send {LCtrl down}{LWin up}{LShift down}{tab} ; WinModifiers + ; Send {LCtrl down}{LAlt up}{LShift down}{tab} ; MacModifiers + KeyWait, tab + ; Primary + ; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P") = false) { ; WinModifiers + ; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P") = false) { ; MacModifiers + Send {LAlt down}{tab} + KeyWait, tab + ; Primary + ; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P")) { ; WinModifiers + ; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P")) { ; MacModifiers + Send {LAlt down}{LShift down}{tab} + KeyWait, tab + ; Secondary + ; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P")) = false { ; WinModifiers + ; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P") = false) { ; MacModifiers + return ; Secondary - ; Send {LCtrl down}{Secondary up}{tab} -; Send {LCtrl down}{LWin up}{tab} ; WinModifiers -; Send {LCtrl down}{LAlt up}{tab} ; MacModifiers - KeyWait, tab - ; Tertiary - } else if (GetKeyState("LCtrl", "P") AND GetKeyState("LShift", "P")) { - ; Secondary - ; Send {LCtrl down}{Secondary up}{LShift down}{tab} -; Send {LCtrl down}{LWin up}{LShift down}{tab} ; WinModifiers -; Send {LCtrl down}{LAlt up}{LShift down}{tab} ; MacModifiers - KeyWait, tab - ; Primary -; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P") = false) { ; WinModifiers -; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P") = false) { ; MacModifiers - Send {LAlt down}{tab} - KeyWait, tab - ; Primary -; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P")) { ; WinModifiers -; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P")) { ; MacModifiers - Send {LAlt down}{LShift down}{tab} - KeyWait, tab - ; Secondary -; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P")) = false { ; WinModifiers -; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P") = false) { ; MacModifiers + ; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P")) { ; WinModifiers + ; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P")) { ; MacModifiers + return + } else { + send {Blind}{tab} + } return - ; Secondary -; } else if (GetKeyState("LWin", "P") AND GetKeyState("LShift", "P")) { ; WinModifiers -; } else if (GetKeyState("LAlt", "P") AND GetKeyState("LShift", "P")) { ; MacModifiers + } + + tab::Send {tab} + + +tab::Send {Shift down}{tab}{Shift up} + + ; Basic Remap + ; + ; Primary::LCtrl + ; Secondary::LAlt + ; Tertiary::LWin + + ; $LAlt::LCtrl ; WinModifiers + ; $RAlt::RCtrl ; WinModifiers + ; $LWin::LAlt ; WinModifiers + ; $LCtrl::LWin ; WinModifiers + + ; $LWin::LCtrl ; MacModifiers + ; $RWin::RCtrl ; MacModifiers + ; $LCtrl::LWin ; MacModifiers + + ; Hack to disable start menu on winkey + ; Static + $LCtrl up::Send {Ctrl down}{LWin up}{Ctrl up} + + ; temporary hack to ensure keys don't get stuck + ; impacts Alt-Tab fix + ; Primary + ; $LAlt up::Send {LWin up}{LAlt up}{LCtrl up} ; WinModifiers + ; $LWin up::Send {LWin up}{LAlt up}{LCtrl up} ; MacModifiers + + ; Close Apps + ^q::Send !{F4} + + ; Minimize specific Window + ^m::WinMinimize, A + + ; Minimize all but Active Window + !^m:: + WinGet, winid ,, A + WinMinimizeAll + WinActivate ahk_id %winid% + return + + ; hide all instances of active Program + ^h:: + WinGetClass, class, A + WinGet, AllWindows, List + loop %AllWindows% { + WinGetClass, WinClass, % "ahk_id " AllWindows%A_Index% + if(InStr(WinClass,class)){ + WinMinimize, % "ahk_id " AllWindows%A_Index% + } + } + return + + ; hide all but active program + !^h:: + WinGetClass, class, A + WinMinimizeAll + WinGet, AllWindows, List + loop %AllWindows% { + WinGetClass, WinClass, % "ahk_id " AllWindows%A_Index% + if(InStr(WinClass,class)){ + WinRestore, % "ahk_id " AllWindows%A_Index% + } + } + return + + ; Show Desktop + ^F3::Send #d + + ; Emoji Panel + #^Space::Send {LWin down};{LWin up} + + ; Full Screenshot + ^+3::Send {PrintScreen} + + ; Region Screenshot + ^+4::Send #+{S} + + ; wordwise support + $^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} + + ; Cmd+Space Alternative + $^Space::Send ^{Esc} + + #IfWinActive ahk_group intellij + ; General + ^0::Send !{0} ;Open corresponding tool window + ^1::Send !{1} ;Open corresponding tool window + ^2::Send !{2} ;Open corresponding tool window + ^3::Send !{3} ;Open corresponding tool window + ^4::Send !{4} ;Open corresponding tool window + ^5::Send !{5} ;Open corresponding tool window + ^6::Send !{6} ;Open corresponding tool window + ^7::Send !{7} ;Open corresponding tool window + ^8::Send !{8} ;Open corresponding tool window + ^9::Send !{9} ;Open corresponding tool window + #`::Send ^` ;Quick switch current scheme + ^,::Send ^!s ;Open Settings dialog + ^;::Send ^!+s ;Open Project Structure dialog + ; Debugging + ^!r::Send {F9} ;Resume program + ; Search/Replace + ^g::Send {F3} ;Find next + ^+F3::Send +{F3} ;Find previous + #g::Send !j ;Select next occurrence + ^#g::Send ^!+j ;Select all occurrences + #+g::Send !+j ;Unselect occurrence + ; Editing + #Space::Send ^{Space} ;Basic code completion + #+Space::Send ^+{Space} ;Smart code completion + #j::Send ^q ;Quick documentation lookup + ^n::Send !{Insert} ;Generate code... + #o::Send ^o ;Override methods + #i::Send ^i ;Implement methods + !Up::Send ^w ;Extend selection + !Down::Send ^+w ;Shrink selection + #+q::Send !q ;Context info + #!o::Send ^!o ;Optimize imports + #!i::Send ^!i ;Auto-indent line(s) + $^Backspace::Send ^y ;Delete line at caret + #+j::Send ^+j ;Smart line join + !Delete::Send ^{Delete} ;Delete to word end + !Backspace::Send ^{Backspace} ;Delete to word start + ^+::Send ^{NumpadAdd} ;Expand code block + ^-::Send ^{NumpadSub} ;Collapse code block + ^++::Send ^+{NumpadAdd} ;Expand all + ^+-::Send ^+{NumpadSub} ;Collapse all + ^w::Send ^{F4} ;Close active editor tab + ; Refactoring + ^Delete::Send !{Delete} ;Safe Delete + ^T::Send ^!+T ;Refactor this + ; Navigation + ^o::Send ^n ;Go to class + ^+o::Send ^+n ;Go to file + ^!o::Send ^!+n ;Go to symbol + #Right::Send !{Right} ;Go to next editor tab + #Left::Send !{Left} ;Go to previous editor tab + #l::Send ^g ;Go to line + #e::Send ^e ;Recent files popup + !Space::Send ^+i ;Open quick definition lookup + ^Y::Send ^+i ;Open quick definition lookup + #+b::Send ^+b ;Go to type declaration + #Up::Send !{Up} ;Go to previous + #Down::Send !{Down} ;Go to next method + #h::Send ^h ;Type hierarchy + #!h::Send ^!h ;Call hierarchy + ^Down::Send ^{Enter} ;Edit source/View source + !Home::Send !{Home} ;Show navigation bar + F2::Send {F11} ;Toggle bookmark + #F3::Send ^{F11} ;Toggle bookmark with mnemonic + #0::Send ^{0} ;Go to numbered bookmark + #1::Send ^{1} ;Go to numbered bookmark + #2::Send ^{2} ;Go to numbered bookmark + #3::Send ^{3} ;Go to numbered bookmark + #4::Send ^{4} ;Go to numbered bookmark + #5::Send ^{5} ;Go to numbered bookmark + #6::Send ^{6} ;Go to numbered bookmark + #7::Send ^{7} ;Go to numbered bookmark + #8::Send ^{8} ;Go to numbered bookmark + #9::Send ^{9} ;Go to numbered bookmark + ^F3::Send +{F11} ;Show bookmarks + ; Compile and Run + #!r::Send !+{F10} ;Select configuration and run + #!d::Send !+{F9} ;Select configuration and debug + #r::Send +{F10} ;Run + #d::Send +{F9} ;Debug + #+r::Send ^+{F10} ;Run context configuration from editor + #+d::Send ^+{F9} ;Debug context configuration from editor + ; VCS/Local History + #v::Send !` ;VCS quick popup + #If + + ; Close all browsers + #IfWinActive ahk_group browsers + ^q::send {Alt Down}f{Alt Up}x ; exit all windows + #If + + ; Sublime Text Remaps for VS Code + #IfWinActive ahk_group vscode + #p::send {Up} ; Allow for traversing quick list + #n::send {Down} ; Allow for traversing quick list + #Space::Send ^{Space} ; Basic code completion + ; Remap Ctrl+Shift to behave like macOS Sublimetext + ; Will extend cursor to multiple lines + ; #+Up::send ^!{Up} ; ST2CODE + ; #+Down::send ^!{Down} ; ST2CODE + ; Remap Ctrl+Cmd+G to select all matches + ; #^g::send ^+{L} ; ST2CODE + !+g::send ^+{G} ; View source control + ; Sigints - interrupt + $#c::Send {Ctrl down}c{Ctrl up} + #If + + #IfWinActive ahk_exe sublime_text.exe + #Space::Send ^{Space} ; Basic code completion + #^Up::send !{O} ; Switch file + #^f::send {F11} ; toggle_full_screen + ^!v::send {Ctrl Down}k{Ctrl Up}{Ctrl Down}v{Ctrl Up} ; paste_from_history + ^Up::Return ; cancel scroll_lines up + ^!Up::send ^{Up} ; scroll_lines up + ^Down::Return ; cancel scroll_lines down + ^!Down::send ^{Down} ; scroll_lines down + #+Up::send {shift up}^!{Up} ; multi-cursor up + #+Down::send {shift up}^!{Down} ; multi-cursor down + ^PgDn::Return ; cancel next_view + ^PgUp::Return ; cancel prev_view + ^+{::send ^{PgDn} ; next_view + ^+}::send ^{PgUp} ; prev_view + ^!Right::send ^{PgDn} ; next_view + ^!Left::send ^{PgUp} ; prev_view + Insert::Return ; cancel toggle_overwrite + ^!O::send {Insert} ; toggle_overwrite + !c::Return ; cancel toggle_case_sensitive + ^!c::send !{c} ; toggle_case_sensitive + ; ^h::Return ; cancel replace + ^!f::send ^{h} ; replace + ^+h::Return ; cancel replace_next + ^!e::send ^+{h} ; replace_next + F3::Return ; cancel find_next + ^g::send {F3} ; find_next + *F3::Return ; cancel find_prev, find_under, find_all_under + ^+g::send +{F3} ; find_prev + #!g::send ^{F3} ; find_under + #!+g::send ^+{F3} ; find_under_prev + #^g::send !{F3} ; find_all_under + ^+Up::Return ; cancel swap_line_up + #!Up::send ^+{Up} ; swap_line_up + ^+Down::Return ; cancel swap_line_down + #!Down::send ^+{Down} ; swap_line_down + ^Pause::Return ; cancel cancel_build + #c::send ^{Pause} ; cancel_build + F9::Return ; cancel sort_lines case_s false + F5::send {F9} ; sort_lines case_s false + #F9::Return ; cancel sort_lines case_s true + #F5::send #{F9} ; sort_lines case_s true + !+1::Return ; cancel set_layout + ^!1::send !+1 ; set_layout + !+2::Return ; cancel set_layout + ^!2::send !+2 ; set_layout + !+3::Return ; cancel set_layout + ^!3::send !+3 ; set_layout + !+4::Return ; cancel set_layout + ^!4::send !+4 ; set_layout + !+5::Return ; cancel set_layout + ^!5::send !+5 ; set_layout + !+8::Return ; cancel set_layout + ^!8::send !+8 ; set_layout + !+9::Return ; cancel set_layout + ^!9::send !+9 ; set_layout + #If + + #IfWinActive ahk_group terminals + + ; End of Line + #e:: + Send {End} return - } else { - send {Blind}{tab} - } - return -} -tab::Send {tab} + ; Beginning of Line + #a:: + Send {Home} + return -+tab::Send {Shift down}{tab}{Shift up} + ; Copy + ^c:: + SetKeyDelay -1 + Send {Blind}{LShift down}{c DownTemp} + return -; Basic Remap -; -; Primary::LCtrl -; Secondary::LAlt -; Tertiary::LWin + ^c up:: + SetKeyDelay -1 + Send {Blind}{c Up}{LShift Up} + return -; $LAlt::LCtrl ; WinModifiers -; $RAlt::RCtrl ; WinModifiers -; $LWin::LAlt ; WinModifiers -; $LCtrl::LWin ; WinModifiers + ; Sigints - interrupt + $#c::Send {Ctrl down}c{Ctrl up} -; $LWin::LCtrl ; MacModifiers -; $RWin::RCtrl ; MacModifiers -; $LCtrl::LWin ; MacModifiers + ; Paste + ^v:: + If WinActive("ahk_exe mintty.exe"){ + Send {Shift down}{Insert}{Shift up} + } + else if WinActive("ahk_group posix"){ + Send {Blind}{Shift down}v{Shift up} + } + else{ + Send {Blind}v + } + return + #If -; Hack to disable start menu on winkey -; Static -$LCtrl up::Send {Ctrl down}{LWin up}{Ctrl up} + #IfWinActive ahk_group posix + ; Open/Close Tab for those that support it + $^t:: + If not WinActive("ahk_group ConEmu"){ + Send {LCtrl down}{LShift down}t{LCtrl Up}{LShift Up} + } + else{ + Send ^t + } + return -; temporary hack to ensure keys don't get stuck -; impacts Alt-Tab fix -; Primary -; $LAlt up::Send {LWin up}{LAlt up}{LCtrl up} ; WinModifiers -; $LWin up::Send {LWin up}{LAlt up}{LCtrl up} ; MacModifiers + $^w:: + If not WinActive("ahk_group ConEmu"){ + Send {LCtrl down}{LShift down}w{LCtrl Up}{LShift Up} + } + else{ + Send ^w + } + return -; Close Apps -^q::Send !{F4} - -; Minimize specific Window -^m::WinMinimize, A - -; Minimize all but Active Window -!^m:: -WinGet, winid ,, A -WinMinimizeAll -WinActivate ahk_id %winid% -return - -; hide all instances of active Program -^h:: -WinGetClass, class, A -WinGet, AllWindows, List -loop %AllWindows% { - WinGetClass, WinClass, % "ahk_id " AllWindows%A_Index% - if(InStr(WinClass,class)){ - WinMinimize, % "ahk_id " AllWindows%A_Index% - } -} -return - -; hide all but active program -!^h:: -WinGetClass, class, A -WinMinimizeAll -WinGet, AllWindows, List -loop %AllWindows% { - WinGetClass, WinClass, % "ahk_id " AllWindows%A_Index% - if(InStr(WinClass,class)){ - WinRestore, % "ahk_id " AllWindows%A_Index% - } -} -return - -; Show Desktop -^F3::Send #d - -; Emoji Panel -#^Space::Send {LWin down};{LWin up} - -; Full Screenshot -^+3::Send {PrintScreen} - -; Region Screenshot -^+4::Send #+{S} - -; wordwise support -$^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} - -; Cmd+Space Alternative -$^Space::Send ^{Esc} - -#IfWinActive ahk_group intellij - ; General - ^0::Send !{0} ;Open corresponding tool window - ^1::Send !{1} ;Open corresponding tool window - ^2::Send !{2} ;Open corresponding tool window - ^3::Send !{3} ;Open corresponding tool window - ^4::Send !{4} ;Open corresponding tool window - ^5::Send !{5} ;Open corresponding tool window - ^6::Send !{6} ;Open corresponding tool window - ^7::Send !{7} ;Open corresponding tool window - ^8::Send !{8} ;Open corresponding tool window - ^9::Send !{9} ;Open corresponding tool window - #`::Send ^` ;Quick switch current scheme - ^,::Send ^!s ;Open Settings dialog - ^;::Send ^!+s ;Open Project Structure dialog - ; Debugging - ^!r::Send {F9} ;Resume program - ; Search/Replace - ^g::Send {F3} ;Find next - ^+F3::Send +{F3} ;Find previous - #g::Send !j ;Select next occurrence - ^#g::Send ^!+j ;Select all occurrences - #+g::Send !+j ;Unselect occurrence - ; Editing - #Space::Send ^{Space} ;Basic code completion - #+Space::Send ^+{Space} ;Smart code completion - #j::Send ^q ;Quick documentation lookup - ^n::Send !{Insert} ;Generate code... - #o::Send ^o ;Override methods - #i::Send ^i ;Implement methods - !Up::Send ^w ;Extend selection - !Down::Send ^+w ;Shrink selection - #+q::Send !q ;Context info - #!o::Send ^!o ;Optimize imports - #!i::Send ^!i ;Auto-indent line(s) - $^Backspace::Send ^y ;Delete line at caret - #+j::Send ^+j ;Smart line join - !Delete::Send ^{Delete} ;Delete to word end - !Backspace::Send ^{Backspace} ;Delete to word start - ^+::Send ^{NumpadAdd} ;Expand code block - ^-::Send ^{NumpadSub} ;Collapse code block - ^++::Send ^+{NumpadAdd} ;Expand all - ^+-::Send ^+{NumpadSub} ;Collapse all - ^w::Send ^{F4} ;Close active editor tab - ; Refactoring - ^Delete::Send !{Delete} ;Safe Delete - ^T::Send ^!+T ;Refactor this - ; Navigation - ^o::Send ^n ;Go to class - ^+o::Send ^+n ;Go to file - ^!o::Send ^!+n ;Go to symbol - #Right::Send !{Right} ;Go to next editor tab - #Left::Send !{Left} ;Go to previous editor tab - #l::Send ^g ;Go to line - #e::Send ^e ;Recent files popup - !Space::Send ^+i ;Open quick definition lookup - ^Y::Send ^+i ;Open quick definition lookup - #+b::Send ^+b ;Go to type declaration - #Up::Send !{Up} ;Go to previous - #Down::Send !{Down} ;Go to next method - #h::Send ^h ;Type hierarchy - #!h::Send ^!h ;Call hierarchy - ^Down::Send ^{Enter} ;Edit source/View source - !Home::Send !{Home} ;Show navigation bar - F2::Send {F11} ;Toggle bookmark - #F3::Send ^{F11} ;Toggle bookmark with mnemonic - #0::Send ^{0} ;Go to numbered bookmark - #1::Send ^{1} ;Go to numbered bookmark - #2::Send ^{2} ;Go to numbered bookmark - #3::Send ^{3} ;Go to numbered bookmark - #4::Send ^{4} ;Go to numbered bookmark - #5::Send ^{5} ;Go to numbered bookmark - #6::Send ^{6} ;Go to numbered bookmark - #7::Send ^{7} ;Go to numbered bookmark - #8::Send ^{8} ;Go to numbered bookmark - #9::Send ^{9} ;Go to numbered bookmark - ^F3::Send +{F11} ;Show bookmarks - ; Compile and Run - #!r::Send !+{F10} ;Select configuration and run - #!d::Send !+{F9} ;Select configuration and debug - #r::Send +{F10} ;Run - #d::Send +{F9} ;Debug - #+r::Send ^+{F10} ;Run context configuration from editor - #+d::Send ^+{F9} ;Debug context configuration from editor - ; VCS/Local History - #v::Send !` ;VCS quick popup -#If - -; Close all browsers -#IfWinActive ahk_group browsers - ^q::send {Alt Down}f{Alt Up}x ; exit all windows -#If - -; Sublime Text Remaps for VS Code -#IfWinActive ahk_group vscode - #p::send {Up} ; Allow for traversing quick list - #n::send {Down} ; Allow for traversing quick list - #Space::Send ^{Space} ; Basic code completion - ; Remap Ctrl+Shift to behave like macOS Sublimetext - ; Will extend cursor to multiple lines -; #+Up::send ^!{Up} ; ST2CODE -; #+Down::send ^!{Down} ; ST2CODE - ; Remap Ctrl+Cmd+G to select all matches -; #^g::send ^+{L} ; ST2CODE - !+g::send ^+{G} ; View source control - ; Sigints - interrupt - $#c::Send {Ctrl down}c{Ctrl up} -#If - -#IfWinActive ahk_exe sublime_text.exe - #Space::Send ^{Space} ; Basic code completion - #^Up::send !{O} ; Switch file - #^f::send {F11} ; toggle_full_screen - ^!v::send {Ctrl Down}k{Ctrl Up}{Ctrl Down}v{Ctrl Up} ; paste_from_history - ^Up::Return ; cancel scroll_lines up - ^!Up::send ^{Up} ; scroll_lines up - ^Down::Return ; cancel scroll_lines down - ^!Down::send ^{Down} ; scroll_lines down - #+Up::send {shift up}^!{Up} ; multi-cursor up - #+Down::send {shift up}^!{Down} ; multi-cursor down - ^PgDn::Return ; cancel next_view - ^PgUp::Return ; cancel prev_view - ^+{::send ^{PgDn} ; next_view - ^+}::send ^{PgUp} ; prev_view - ^!Right::send ^{PgDn} ; next_view - ^!Left::send ^{PgUp} ; prev_view - Insert::Return ; cancel toggle_overwrite - ^!O::send {Insert} ; toggle_overwrite - !c::Return ; cancel toggle_case_sensitive - ^!c::send !{c} ; toggle_case_sensitive - ; ^h::Return ; cancel replace - ^!f::send ^{h} ; replace - ^+h::Return ; cancel replace_next - ^!e::send ^+{h} ; replace_next - F3::Return ; cancel find_next - ^g::send {F3} ; find_next - *F3::Return ; cancel find_prev, find_under, find_all_under - ^+g::send +{F3} ; find_prev - #!g::send ^{F3} ; find_under - #!+g::send ^+{F3} ; find_under_prev - #^g::send !{F3} ; find_all_under - ^+Up::Return ; cancel swap_line_up - #!Up::send ^+{Up} ; swap_line_up - ^+Down::Return ; cancel swap_line_down - #!Down::send ^+{Down} ; swap_line_down - ^Pause::Return ; cancel cancel_build - #c::send ^{Pause} ; cancel_build - F9::Return ; cancel sort_lines case_s false - F5::send {F9} ; sort_lines case_s false - #F9::Return ; cancel sort_lines case_s true - #F5::send #{F9} ; sort_lines case_s true - !+1::Return ; cancel set_layout - ^!1::send !+1 ; set_layout - !+2::Return ; cancel set_layout - ^!2::send !+2 ; set_layout - !+3::Return ; cancel set_layout - ^!3::send !+3 ; set_layout - !+4::Return ; cancel set_layout - ^!4::send !+4 ; set_layout - !+5::Return ; cancel set_layout - ^!5::send !+5 ; set_layout - !+8::Return ; cancel set_layout - ^!8::send !+8 ; set_layout - !+9::Return ; cancel set_layout - ^!9::send !+9 ; set_layout -#If - -#IfWinActive ahk_group terminals - - ; End of Line - #e:: - Send {End} - return - - ; Beginning of Line - #a:: - Send {Home} - return - - ; Copy - ^c:: - SetKeyDelay -1 - Send {Blind}{LShift down}{c DownTemp} - return - - ^c up:: - SetKeyDelay -1 - Send {Blind}{c Up}{LShift Up} - return - - ; Sigints - interrupt - $#c::Send {Ctrl down}c{Ctrl up} - - ; Paste - ^v:: - If WinActive("ahk_exe mintty.exe"){ - Send {Shift down}{Insert}{Shift up} - } - else if WinActive("ahk_group posix"){ - Send {Blind}{Shift down}v{Shift up} - } - else{ - Send {Blind}v - } - return -#If - -#IfWinActive ahk_group posix - ; Open/Close Tab for those that support it - $^t:: - If not WinActive("ahk_group ConEmu"){ - Send {LCtrl down}{LShift down}t{LCtrl Up}{LShift Up} - } - else{ - Send ^t - } - return - - $^w:: - If not WinActive("ahk_group ConEmu"){ - Send {LCtrl down}{LShift down}w{LCtrl Up}{LShift Up} - } - else{ - Send ^w - } - return - - ^l::Send clear{Enter} - ; #l::return - ; Clear Terminal and Scroll Buffer - ^k::Send clear && printf '\e[3J'{Enter} - ; Nano editor shortcuts - #g::Send {LCtrl down}g{LCtrl Up} - #k::Send {LCtrl down}k{LCtrl Up} - #x::Send {LCtrl down}x{LCtrl Up} - #o::Send {LCtrl down}o{LCtrl Up} - #r::Send {LCtrl down}r{LCtrl Up} - #w::Send {LCtrl down}w{LCtrl Up} - #\::Send {LCtrl down}\{LCtrl Up} - #u::Send {LCtrl down}u{LCtrl Up} - #j::Send {LCtrl down}j{LCtrl Up} - #t::Send {LCtrl down}t{LCtrl Up} - #_::Send {LCtrl down}_{LCtrl Up} - #z::Send {LCtrl down}z{LCtrl Up} - #y::Send {LCtrl down}y{LCtrl Up} - #v::Send {LCtrl down}v{LCtrl Up} + ^l::Send clear{Enter} + ; #l::return + ; Clear Terminal and Scroll Buffer + ^k::Send clear && printf '\e[3J'{Enter} + ; Nano editor shortcuts + #g::Send {LCtrl down}g{LCtrl Up} + #k::Send {LCtrl down}k{LCtrl Up} + #x::Send {LCtrl down}x{LCtrl Up} + #o::Send {LCtrl down}o{LCtrl Up} + #r::Send {LCtrl down}r{LCtrl Up} + #w::Send {LCtrl down}w{LCtrl Up} + #\::Send {LCtrl down}\{LCtrl Up} + #u::Send {LCtrl down}u{LCtrl Up} + #j::Send {LCtrl down}j{LCtrl Up} + #t::Send {LCtrl down}t{LCtrl Up} + #_::Send {LCtrl down}_{LCtrl Up} + #z::Send {LCtrl down}z{LCtrl Up} + #y::Send {LCtrl down}y{LCtrl Up} + #v::Send {LCtrl down}v{LCtrl Up} + #If #If \ No newline at end of file