Sublime运行终端Terminus

2024-01-01
#Unix

第一步,安装插件 Terminus:先 Ctrl + Shift + p,选中 Package Control: Install Package,输入 Terminus

第二步,设置 Terminus 的 Command Palette:

Settings > Package Settings > Terminus > Command Palette,输入:

[
   {
        "caption": "Terminus: Open Default Shell in Tab (View)",
        "command": "terminus_open",
        "args"   : {
           "cmd": "zsh",
           "cwd": "${file_path:${folder}}",
           "title": "Command Prompt",
           "panel_name": "Terminus"
        }
   }
]  

注意⚠️:zsh 可以替换成 bash 或 cmd.exe (Windows)

第三步,设置 Terminus 的 Key Bindings:

Settings > Package Settings > Terminus > Key Bindings,输入:

[
   {
       "keys": ["alt+1"],
       "command": "terminus_open",
        "args": {
            "cwd": "${file_path:${folder}}",
            "post_window_hooks": [
                ["carry_file_to_pane", {"direction": "down"}]
            ]
        }
   },
   { 
        "keys": ["alt+2"], 
        "command": "terminus_close", 
        "context": [{ "key": "terminus_view"}]
    }
] 

注意⚠️:

  • alt + 1 为打开终端(split view)的快捷键
  • alt + 2 为关闭终端的快捷键

延伸阅读