刚用 Hammerspoon 试了下,体验还不错……
Hammerspoon 介绍:
参考脚本:
我测试的快捷键是 cmd + t ,可按需修改:
[code]
function open_vscode()
local stat, path = hs.applescript('tell application "Finder" to get POSIX path of (insertion location as string)')
local command = "open -a \"Visual Studio Code\" " .. path
local result = hs.execute(command)
if path ~= nil then
hs.alert.show(string.format("VSCode 成功打开...%q", path))
end
end
hs.hotkey.bind({"cmd"}, 't', open_vscode)
[/code]
看到上面有说 alfread 的 workflow ,我用的是 sublime 打开文件查看,具体的 workflow:
on alfred_script(q)
set finderPath to ""
tell application "Finder"
try
set finderFolder to (folder of the front window as alias)
on error
set finderFolder to (path to home folder as alias)
end try
set finderPath to quoted form of POSIX path of finderFolder
do shell script "/Applications/Sublime' ' " & finderPath
end tell
end alfred_script