Skip to content

Instantly share code, notes, and snippets.

@transtone
Last active December 1, 2019 12:52
Show Gist options
  • Save transtone/2e4f04917ed547a43eb73d9b0e77d6b6 to your computer and use it in GitHub Desktop.
Save transtone/2e4f04917ed547a43eb73d9b0e77d6b6 to your computer and use it in GitHub Desktop.
; #CommentFlag ;
; Key Syntax
; Alt !
; Ctrl ^
; Shift +
; Win Logo #
#NoTrayIcon
ScrollLock::Capslock
Capslock::Ctrl
#t::
send {LWin Down}{Up}{LWin Up}
KeyWait, LWin
return
^space::
send {LWin Down}{space}{LWin Up}
KeyWait, LWin
return
!q::
send {Alt Down}{F4}{Alt Up}
KeyWait, Alt
return
!ESC::
return
;==================================================
;** 快捷键 Win+ESC 使当前窗口置顶/取消置顶
;==================================================
#Esc::
WinSet, AlwaysOnTop, toggle,A
WinGetTitle, getTitle, A
Winget, getTop,ExStyle,A
if (getTop & 0x8)
TrayTip 已置顶, 窗口标题: `n%getTitle%,10,1
else
TrayTip 取消置顶, 窗口标题:`n %getTitle%,10,1
return
; windows console 和 mintty 中使用 tmux
#If WinActive("ahk_class mintty") || WinActive("ahk_class ConsoleWindowClass") || WinActive("ahk_exe WindowsTerminal.exe")
; n,p,k,t for tmux
!n::
send {Ctrl Down}l{Ctrl up}n
KeyWait, Ctrl
return
!p::
send {Ctrl Down}l{Ctrl up}p
KeyWait, Ctrl
return
!t::
send {Ctrl Down}l{Ctrl up}c
KeyWait, Ctrl
return
#If
#If WinActive("ahk_exe WindowsTerminal.exe")
RButton::
send {ESC}
return
#If
; windows console (CMD/PoserShell) 快捷键
; 注意,在紧贴If的注释中不得出现“键”字,否则会影响 If 失效
; ========================
#If WinActive("ahk_class ConsoleWindowClass")
RButton::
send {ESC}
return
^y::
send {Ctrl Down}{Shift Down}v{Ctrl Up}{Shift Up}
KeyWait, Ctrl
KeyWait, Shift
return
^v::
Click Right
return
^m::
Click Right
return
!w::
send {Enter}
return
#If
setChineseLayout(){
KeyWait, Ctrl
KeyWait, Shift
send {Ctrl Down}{Shift Down}1{Ctrl up}{Shift up}
; send {Ctrl Down},{Ctrl up}
KeyWait, Ctrl
KeyWait, Shift
}
setEnglishLayout(){
KeyWait, Ctrl
KeyWait, Shift
send {Ctrl Down}{Shift Down}1{Ctrl up}{Shift up}
KeyWait, LWin
KeyWait, Space
send {LWin Down}{Space}{LWin Up}
; KeyWait, LWin
; KeyWait, Space
}
; vi 插件中,用 ESC 切回普通模式时自动切换英文输入法。如不生效快速按 ESC n次,直到生效
; =========
; #If WinActive("ahk_exe Code.exe") || WinActive("ahk_exe goland64.exe")|| WinActive("ahk_exe idea64.exe") || WinActive("ahk_exe webstorm64.exe")
#If WinActive("ahk_exe Code.exe")
ESC::
{
Run im-select 1033, , Hide
send {ESC}
return
}
;#If
#IfWinActive, ahk_exe vcxsrv.exe
^Space::
ControlSend, , ^{Space}
Return
^!::
ControlSend, , ^!
Return
#If
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment