IndexOutOfBounds
V2EX  ›  Vim

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

  •  
  •   IndexOutOfBounds · Nov 13, 2021 · 3675 views
    This topic created in 1674 days ago, the information mentioned may be changed or developed.
    7 replies    2021-11-17 12:23:03 +08:00
    kiwier
        1
    kiwier  
       Nov 13, 2021
    安装超级右键 lite 版
    IndexOutOfBounds
        2
    IndexOutOfBounds  
    OP
       Nov 13, 2021
    @kiwier 这个可行吗?
    我看只有 Open in Terminal ,这个直接把文本文件 当成可执行文件了
    我需要的是 Open in Vim
    minamike
        3
    minamike  
       Nov 13, 2021   ❤️ 1
    有 Alfred 的话 新建一个 workflow 就行
    可以选择用快捷键或者 file action 打开



    imKiva
        4
    imKiva  
       Nov 13, 2021   ❤️ 1
    我写过一个用快捷键在终端的 emacs 里打开的,楼主可以自己修改一下。双击打开的我也没找到什么好办法
    https://gist.github.com/imkiva/a460a57b03db591b1cda9d1fb259f1ed
    lex
        5
    lex  
       Nov 13, 2021   ❤️ 1
    azouever
        6
    azouever  
       Nov 14, 2021   ❤️ 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  
       Nov 17, 2021 via iPhone
    用命令行的 file manager 啊 nnn ranger 或者 vim 的,直接打开
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2561 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 423ms · UTC 15:43 · PVG 23:43 · LAX 08:43 · JFK 11:43
    ♥ Do have faith in what you're doing.