Mac键位映射(部分)

win+q    退出程序                    win+w    关闭当前页面
win+h 隐藏当前窗口 win+shift+h 隐藏其他窗口
win+s 保存 win+o 打开
win+z 撤销 win+shift+z 恢复
win+c 复制 win+x 剪切
win+v 粘贴 alt+win+shift+v/CapsLock+insert 粘贴纯文本
win+backspace 删除 win+shift+backspace 清空回收站
alt+win+shift+backspace 清空回收站(无确认提示)
win+F3 显示桌面 win+i 显示属性

自定义快捷键(部分)

Win+LAlt    显示Win+X菜单(win10)
PageUp/win+F12 放大音量 PageDown/win+F11 减小音量
ScrollLock/win+F10 静音 CapsLock+PageUp/PageDown/ScrollLock 原PageUp/PageDown/ScrollLock
CapsLock+sapce 输入4个空格
CapsLock+backsapce 删除到行首 CapsLock+delete 删除到行尾
CapsLock+enter 新起一行 CapsLock+\ 新起一行(当前行下移)
CapsLock+RShift 分割行
CapsLock+d 复制一行 CapsLock+a 选中当前行
CapsLock+c 复制当前行 CapsLock+x 剪切当前行
CapsLock+v 粘贴一行 LAlt+v 粘贴并回车
LAlt+c 复制到行尾 LAlt+x 剪切到行尾
CapsLock+F1 置顶当前窗口 LAlt+space 启动Listary(需自行修改路径)
CapsLock+F9 当前目录启动PowerShell CapsLock+F10 在当前目录启动CMD
CapsLock+F11 当前目录启动Git-sh CapsLock+F12 启动MSYS

Git-sh是下载安装版git for windows时可用,第一次进入git-sh可以添加命令l、open和subl

$ echo 'alias l=ll open=\"$WINDIR/explorer.exe\"' >> ~/.bash_profile
$ echo 'alias subl=\"$PROGRAMFILES/Sublime\ Text\ 3/sublime_text.exe\"' >> ~/.bash_profile
$ source ~/.bash_profile

文本替换

]now    2016-4-21 15:13:23           ]time    15:13:30
]date 2016-4-21 ]longdate 2016年4月21日

源文件(持续更新)

github:https://github.com/m2nlight/AHKShortcutLikeMac

查看源文件:https://github.com/m2nlight/AHKShortcutLikeMac/blob/master/machotkey.ahk

下载:https://raw.githubusercontent.com/m2nlight/AHKShortcutLikeMac/master/machotkey.ahk

; Shortcuts like mac
; Written by Bob
; http://www.cnblogs.com/Bob-wei/p/5316158.html ; Win+F1 to show HotkeyList
#F1::ListHotkeys ; ## Menu ##
#H::WinMinimize, A
+#H::HideOtherWindow()
#Q::Send !{F4}
; File
#T::Send ^t
+#T::Send +^t
#N::Send ^n
#O::Send ^o
#W::Send ^w
#S::Send ^s
#P::Send ^p
; Edit
#Z::Send ^z
+#Z::Send ^y
#X::Send ^x
#C::Send ^c
#V::Send ^v
!+#V::
clipboard = %clipboard%
Send ^v
return
#A::Send ^a
#F::Send ^f
#G::Send {F3}
+#G::Send +{F3}
!#F::Send ^h
#Left::Send {Home}
#Right::Send {End}
#Up::Send {PgUp}
#Down::Send {PgDn}
!Left::Send ^{Left}
!Right::Send ^{Right}
#+Left::Send +{Home}
#+Right::Send +{End}
#+Up::Send +{PgUp}
#+Down::Send +{PgDn}
!+Left::Send +^{Left}
!+Right::Send +^{Right}
; View
^#F::Send {F11}
#=::Send ^{WheelUp}
#-::Send ^{WheelDown}
#0::Send ^0
; Finder
#Backspace::Send {Del}
+#3::Send {PrintScreen}
+^#3::Send {PrintScreen}
+#4::Send !{PrintScreen}
+^#4::Send !{PrintScreen}
#F3::Send #d
#I::Send !{Enter}
#F10::Send {Volume_Mute}
#F11::Send {Volume_Down}
#F12::Send {Volume_Up}
#+Backspace::EmptyBin()
#+!Backspace::EmptyBin(true)
; Explorer
#IfWinActive ahk_class CabinetWClass
#O::Send {Enter}
#Up::Send !{Up}
#Down::Send {Enter}
#IfWinActive ; ## custom ##
; special key
LWin & Alt::Send #x ; Show WinX menu in win10
PgUp::Send {Volume_Up} ; Volume Up
PgDn::Send {Volume_Down} ; Volume Down
ScrollLock::Send {Volume_Mute} ; Volume Mute
; normal key
CapsLock & PgUp::Send {PgUp} ; PageDown
CapsLock & PgDn::Send {PgDn} ; PageUp
CapsLock & ScrollLock::Send {ScrollLock} ; ScrollLock
; capslock + key
CapsLock & Space::SendInput {Space 4} ; Input 4 space
CapsLock & Left::Send +{Left} ; same to SHIFT+LEFT
CapsLock & Down::Send +{Down} ; same to SHIFT+DOWN
CapsLock & Up::Send +{Up} ; same to SHIFT+UP
CapsLock & Right::Send +{Right} ; same to SHIFT+RIGHT
CapsLock & H::Send {Left} ; Move left (VIM: h)
CapsLock & J::Send {Down} ; Move down (VIM: j)
CapsLock & K::Send {Up} ; Move up (VIM: k)
CapsLock & L::Send {Right} ; Move right (VIM: l)
CapsLock & N::Send {Down} ; Move down too (VIM: CTRL+N)
CapsLock & P::Send {Up} ; Move up too (VIM: CTRL+P)
CapsLock & 4::Send {End} ; Move to line end (VIM: SHIFT+$)
CapsLock & 6::Send {Home} ; Move to line begin (VIM: SHIFT+^)
CapsLock & Enter::Send {End}{Enter} ; Start new line
CapsLock & \::Send {Home}{Enter}{Up} ; Start new line at previous line
CapsLock & RShift::Send {Enter}{Left} ; Line split
CapsLock & Backspace::Send +{Home}{Backspace} ; Delete to line begin
CapsLock & Delete::Send +{End}{Backspace} ; Delete to line end
CapsLock & D::Send {Home}+{End}^c{End}{Enter}^v{Home} ; Duplicate line
CapsLock & A::Send {Home}+{End} ; Selected current line
CapsLock & C::Send {End}+{Home}^c ; Selected and Copy current line
CapsLock & X::Send {End}+{Home}^x{Delete} ; Cut current line
CapsLock & V::Send {Home}{Enter}{Up}^v ; Paste to current line
CapsLock & Insert:: ; Paste plain text
clipboard = %clipboard%
Send ^v
return
; left alt + key
LAlt & V::Send ^v{Enter} ; paste and go
LAlt & C::Send +{End}^c ; copy to line end
LAlt & X::Send +{End}^x ; cut to line end
LAlt & Space:: ; Run Listary or show/hide listary inputbox. Please use Listary v5.00 and Double-Ctrl hotkey is enabled.
RunOrActivate("C:\Program Files\Listary\Listary.exe", false)
Send {Ctrl 2}
Return
; function key
CapsLock & F1::WinSet, AlwaysOnTop, Toggle, A ; bring current window to TopMost
CapsLock & F8:: ; Run Everything. Please change "Toggle window Hotkey" to Win+` in Everything Options
RunOrActivate("C:\Tools\Everything\Everything.exe",,"The Everything is running. `n`nPress Win+`` to Show it.")
return
CapsLock & F9:: ; Run PowerShell
curPath := CurrentPath()
Run powershell.exe -NoExit "cd \"%curPath%\""
return
CapsLock & F10::RunCmd("") ; Run cmd
CapsLock & F11::RunCmd("""C:\Program Files\Git\bin\sh.exe"" --login") ; Run git sh
CapsLock & F12::RunCmd("C:\msys64\msys2_shell.bat") ; Run msys2 shell ; ## Hotstrings ##
:*:]date::
FormatTime, CurrentDateTime,, yyyy-M-d
SendInput %CurrentDateTime%
return
:*:]time::
FormatTime, CurrentDateTime,, HH:mm:ss
SendInput %CurrentDateTime%
return
:*:]now::
FormatTime, CurrentDateTime,, yyyy-M-d HH:mm:ss
SendInput %CurrentDateTime%
return
:*:]longdate::
FormatTime, CurrentDateTime,, LongDate
SendInput %CurrentDateTime%
return ; ## functions ##
RunCmd(command)
{
curPath := CurrentPath()
Run %comspec% /K "cd /d "%curPath%" & %command%"
} RunOrActivate(Program, isActivate=true, msg="")
{
SplitPath, Program, ExeFile
Process, Exist, %ExeFile%
PID = %ErrorLevel%
if (PID = 0) {
Run, %Program%
} else if (StrLen(msg) > 0) {
MsgBox ,,AHK,%msg%,3
}
if (isActivate)
{
WinActivate, ahk_pid %PID%
}
} EmptyBin(isNoConfirm=false)
{
;SHERB_NOCONFIRMATION = 0x000001;
;SHERB_NOPROGRESSUI = 0x000002;
;SHERB_NOSOUND = 0x000004;
dwFlags = 0x00
if(isNoConfirm) {
dwFlags = 0x01
}
DllCall("Shell32\SHEmptyRecycleBin", "Ptr", hwnd, "Ptr", NULL, "UInt", dwFlags)
} HideOtherWindow()
{
WinGetActiveTitle, curtitle
Send #m
Sleep,200
WinRestore, %curtitle%
} CurrentPath()
{
url := GetCurrentExplorerURL(true)
if (url)
return ConvertExplorerURLToPath(url)
return A_Desktop
} GetCurrentExplorerURL(getLastWhenNoFound=false)
{
WinGet, curhwnd, ID, A
for pExp in ComObjCreate("Shell.Application").Windows
{
if (pExp.FullName = "C:\WINDOWS\EXPLORER.EXE") {
if (pExp.hwnd = curhwnd) {
return pExp.LocationURL
}
if(StrLen(pExp.LocationURL)> 0) {
last := pExp.LocationURL
}
}
}
if(getLastWhenNoFound and last) {
return last
}
} ConvertExplorerURLToPath(url)
{
If !url
Return ""
path := url
path := RegExReplace(path, "ftp://.*@","ftp://")
StringReplace, path, path, file:///
StringReplace, path, path, /, \, All
Loop
If RegExMatch(path, "i)(?<=%)[\da-f]{1,2}", hex)
StringReplace, path, path, `%%hex%, % Chr("0x" . hex), All
Else Break
Return path
}

(#表示Win    !表示Alt    ^表示Ctrl    +表示Shift    ;开始是注释)

使用

使用方法是将脚本保存为扩展名.ahk的文本文件,用AutoHotkey.exe打开即可。从Windows托盘中退出AHK。

也可以用Ahk2Exe转换脚本为exe文件。

注:AHK 与 StartIsBack++ 1.2.1有开始按钮热键冲突,建议使用Stardock的Start10较新版本(目前是1.1)代替它。

AHK官网、下载、帮助文件以及源码的网址

https://www.autohotkey.com/download/
https://www.autohotkey.com/download/ahk-u32.zip
https://www.autohotkey.com/download/ahk-u64.zip
https://www.autohotkey.com/download/ahk-a32.zip
https://www.autohotkey.com/download/ahk2exe.zip
https://www.autohotkey.com/download/1.1/AutoHotkeyHelp.zip
https://github.com/Lexikos/AutoHotkey_L/

05-11 17:43