有没有办法一键调用 vscode 打开文件夹

讨论 未结 15 52
gogocome
gogocome 会员 2022年4月26日 03:46 发表
<p>比如访达里打开一个文件夹,然后按个 f10 之类 然后用 vscode 打开这个文件夹.</p>
收藏(0)  分享
相关标签: 灌水交流
注意:本文归作者所有,未经作者允许,不得转载
15个回复
  • Aliencn
    2022年4月26日 03:46
    我是用 [自动操作] 设置了一个快捷方式,选中文件夹右键菜单里就能用 vs code 打开
    0 0
  • duxiansen
    2022年4月26日 03:46
    可以按住 command ,把 vscode 放到访达上面的工具栏里,然后把文件夹拖到上面就行了
    0 0
  • hteen
    2022年4月26日 04:15
    vscode 安装 code 命令到 PATH, 终端就可以直接 code /data/ 打开文件夹了
    0 0
  • goldenlove
    2022年4月26日 04:15
    刚用 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]
    0 0
  • whusnoopy
    2022年4月26日 06:49
    参考此文,按住 Cmd 把 VSCode 图标拖入 Finder 工具栏,未来在 Finder 里直接把目录拖到工具栏的 VSCode 图标上,就能用 VSCode 打开此文件夹或文件
    0 0
  • klarkzh
    2022年4月26日 06:49
    不建议软件的话 openinterminal
    0 0
  • gogocome
    2022年4月26日 09:18
    撸了个 karabiner 的: ``` { "description": "Open current dir in VsCode", "manipulators": [ { "conditions": [ { "bundle_identifiers": [ "^com.apple.finder" ], "type": "frontmost_application_if" } ], "from": { "key_code": "r", "modifiers": { "mandatory": [ "left_command" ] } }, "to": [ { "shell_command": "osascript -e '\ntell application \"Finder\"\n if exists Finder window 1 then\n set currentFolder to target of Finder window 1 as alias\n else\n return\n end if\nend tell\ntell application \"Visual Studio Code\" to open currentFolder\n'" } ], "type": "basic" } ] }, ```
    0 0
  • neptuno
    2022年4月26日 09:47
    我用的 qspace ,可以设置快捷启动,鼠标选择某个文件夹,点击一个按钮就能用特定 app 打开了
    0 0
  • imtianx
    2022年4月26日 09:47
    看到上面有说 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
    0 0
  • ivan_wl
    2022年4月26日 13:16
    我用的 qmenu ,可以像 windows 下一样右键 - open in vscode 了,这个软件和 qspace 是一个作者
    0 0