V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
IndexOutOfBounds
V2EX  ›  Vim

Finder 里双击文件,如何选择用终端的 vim 打开

  •  
  •   IndexOutOfBounds · 2021-11-13 13:17:41 +08:00 · 2083 次点击
    这是一个创建于 866 天前的主题,其中的信息可能已经有所发展或是发生改变。
    7 条回复    2021-11-17 12:23:03 +08:00
    kiwier
        1
    kiwier  
       2021-11-13 13:56:46 +08:00
    安装超级右键 lite 版
    IndexOutOfBounds
        2
    IndexOutOfBounds  
    OP
       2021-11-13 14:44:04 +08:00
    @kiwier 这个可行吗?
    我看只有 Open in Terminal ,这个直接把文本文件 当成可执行文件了
    我需要的是 Open in Vim
    minamike
        3
    minamike  
       2021-11-13 15:35:51 +08:00   ❤️ 1
    有 Alfred 的话 新建一个 workflow 就行
    可以选择用快捷键或者 file action 打开



    imKiva
        4
    imKiva  
       2021-11-13 21:21:22 +08:00   ❤️ 1
    我写过一个用快捷键在终端的 emacs 里打开的,楼主可以自己修改一下。双击打开的我也没找到什么好办法
    https://gist.github.com/imkiva/a460a57b03db591b1cda9d1fb259f1ed
    lex
        5
    lex  
       2021-11-13 22:07:39 +08:00   ❤️ 1
    azouever
        6
    azouever  
       2021-11-14 12:44:53 +08:00   ❤️ 1
    https://www.mattcrampton.com/blog/doubleclick_to_open_in_vim_on_osx/
    用 automator 封装 applescript 成一个操作,然后双击文件的时候执行这个操作,我改了改命令那行
    on run {input, parameters}

    set filename to POSIX path of input

    set cmd to "clear && cd `dirname " & filename & "` && vim '" & filename & "'"

    tell application "iTerm"
    set newWindow to (create window with default profile)
    tell current session of newWindow
    write text cmd
    end tell
    end tell

    end run
    ooops
        7
    ooops  
       2021-11-17 12:23:03 +08:00 via iPhone
    用命令行的 file manager 啊 nnn ranger 或者 vim 的,直接打开
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1211 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 23:14 · PVG 07:14 · LAX 16:14 · JFK 19:14
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.