ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Terminus

by randy3k ST3

Best Terminal Emulator of Sublime Text.

Details

Installs

  • Total 3K
  • Win 1K
  • OS X 826
  • Linux 708
Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6 Sep 5 Sep 4 Sep 3 Sep 2 Sep 1 Aug 31 Aug 30 Aug 29 Aug 28 Aug 27 Aug 26 Aug 25 Aug 24 Aug 23 Aug 22 Aug 21 Aug 20 Aug 19 Aug 18 Aug 17 Aug 16 Aug 15 Aug 14 Aug 13 Aug 12 Aug 11 Aug 10 Aug 9 Aug 8 Aug 7 Aug 6 Aug 5 Aug 4
Windows 9 11 11 8 12 23 13 22 18 16 9 12 11 16 11 14 15 8 10 20 17 24 18 12 9 19 18 9 11 17 9 9 9 9 13 11 17 12 15 17 15 19 15 11 6 10
OS X 8 6 9 2 9 9 8 6 4 5 5 4 12 3 7 5 8 6 10 8 8 12 13 7 13 9 8 6 9 8 6 7 12 6 10 11 6 6 5 13 11 9 9 14 13 2
Linux 6 12 8 6 8 8 9 11 10 9 12 11 10 9 9 9 9 7 11 11 9 9 13 6 6 8 9 5 9 10 5 5 5 3 12 6 13 9 13 2 6 14 11 9 6 7

Readme

Source
raw.​githubusercontent.​com

Bring a real terminal to Sublime Text

The first cross platform terminal for Sublime Text.

Unix shell Cmd.exe
Terminal in panel

This package is heavily inspired by TerminalView. Compare with TerminalView, this has

  • Windows support
  • continuous history
  • easily customizable themes
  • unicode support
  • 256 colors support
  • better xterm support
  • terminal panel
  • imgcat support (PS: it also works on Linux / WSL)

Installation

Package Control.

Getting started

  • run Terminus: Open Default Shell in View

User Key Bindings

You may find these key bindings useful. To edit, run Preferences: Terminus Key Bindings. Check the details for the arguments of terminus_open below.

  • toggle terminal panel
[
    { "keys": ["alt+`"], "command": "toggle_terminus_panel" }
]
  • open a terminal view at current file directory
[
    { 
        "keys": ["ctrl+alt+t"], "command": "terminus_open", "args": {
            "config_name": "Default",
            "cwd": "${file_path:${folder}}"
        }
    }
]

or by passing a custom cmd, say ipython

[
    { 
        "keys": ["ctrl+alt+t"], "command": "terminus_open", "args": {
            "cmd": "ipython",
            "cwd": "${file_path:${folder}}"
        }
    }
]
  • open terminal in a split view
[
    {
        "keys": ["ctrl+alt+t"],
        "command": "terminus_open",
        "args": {
            "config_name": "Default",
            "pre_window_hooks": [
                ["set_layout", {
                    "cols": [0.0, 1.0],
                    "rows": [0.0, 0.5, 1.0],
                    "cells": [[0, 0, 1, 1], [0, 1, 1, 2]]
                }],
                ["focus_group", {"group": 1}]
            ]
        }
    }
]

or by applying Origami's carry_file_to_pane

[
    {
        "keys": ["ctrl+alt+t"],
        "command": "terminus_open",
        "args": {
            "config_name": "Default",
            "post_window_hooks": [
                ["carry_file_to_pane", {"direction": "down"}]
            ]
        }
    }
]

User Commands in Palette

  • run Preferences: Terminus Command Palette. Check the details for the arguments of terminus_open below
[
    {
        "caption": "Terminus: Open Default Shell at Current Location",
        "command": "terminus_open",
        "args"   : {
            "config_name": "Default",
            "cwd": "${file_path:${folder}}"
        }
    }
]

or by passing custom cmd, say ipython

[
    {
        "caption": "Terminus: Open iPython",
        "command": "terminus_open",
        "args"   : {
            "cmd": "ipython",
            "cwd": "${file_path:${folder}}",
            "title": "iPython"
        }
    }
]
  • open terminal in a split view
[
    {
        "caption": "Terminus: Open Default Shell in Split View",
        "command": "terminus_open",
        "args": {
            "config_name": "Default",
            "pre_window_hooks": [
                ["set_layout", {
                    "cols": [0.0, 1.0],
                    "rows": [0.0, 0.5, 1.0],
                    "cells": [[0, 0, 1, 1], [0, 1, 1, 2]]
                }],
                ["focus_group", {"group": 1}]
            ]
        }
    }
]

or by applying Origami's carry_file_to_pane

[
    {
        "caption": "Terminus: Open Default Shell in Split View",
        "command": "terminus_open",
        "args": {
            "config_name": "Default",
            "post_window_hooks": [
                ["carry_file_to_pane", {"direction": "down"}]
            ]
        }
    }
]

User Build System

Use Terminus as a build system. For example, the following can be added to your project settings to allow “SSH to Remote” build system.

{
    "build_systems":
    [
        {
            "cmd":
            [
                "ssh", "user@example.com"
            ],
            "name": "SSH to Remote",
            "target": "terminus_open",
            "working_dir": "$folder"
        }
    ]
}

Alt-Left/Right to move between words (Unix)

  • Bash: add the following in .bash_profile or .bashrc “ if test -n ”$TERMINUS_SUBLIME"; then bind '“\e[1;3C”: forward-word' bind '“\e[1;3D”: backward-word' fi
- Zsh: add the following in `.zshrc`

if test -n “$TERMINUS_SUBLIME”; then bindkey “\e[1;3C” forward-word bindkey “\e[1;3D” backward-word fi

Some programs, such as julia, does not recognize the standard keycodes for `alt+left` and `alt+right`. You could
bind them to `alt+b` and `alt+f` respectively
```json
[
    { "keys": ["alt+left"], "command": "terminus_keypress", "args": {"key": "b", "alt": true}, "context": [{"key": "terminus_view"}] },
    { "keys": ["alt+right"], "command": "terminus_keypress", "args": {"key": "f", "alt": true}, "context": [{"key": "terminus_view"}] }
]

Terminus API

  • A terminal could be opened using the command terminus_open with
window.run_command(
    "terminus_open", {
        "config_name": None,     # the shell config name, use "Default" for the default config
        "cmd": None,             # the cmd to execute
        "cwd": None,             # the working directory
        "working_dir": None,     # alias of "cwd"
        "env": {},               # extra environmental variables
        "title": None,           # title of the view
        "panel_name": None,      # the name of the panel if terminal should be opened in panel
        "tag": None,             # a tag to idFentify the terminal
        "pre_window_hooks": [],  # a list of window hooks before opening terminal
        "post_window_hooks": [], # a list of window hooks after opening terminal
        "post_view_hooks": [],   # a list of view hooks after opening terminal
        "auto_close": True       # auto close terminal if process exits successfully
    }
)

The fields cmd and cwd understand Sublime Text build system variables.

  • the setting view.settings().get("terminus_view.tag") can be used to identify the terminal and

  • keybind can be binded with specific tagged terminal

{
        "keys": ["ctrl+alt+w"], "command": "terminus_close", "context": [
            { "key": "terminus_view.tag", "operator": "equal", "operand": "YOUR_TAG"}
        ]
    }
  • text can be sent to the terminal with
window.run_command(
    "terminus_send_string", 
    {
        "string": "ls\n",
        "tag": "<YOUR_TAG>"        # ignore this or set it to None to send text to the first terminal found
    }
)

If tag is not provided or is None, the text will be sent to the first terminal found in the current window.

FAQ

Terminal panel background issue

If you are using DA UI and your terminal panel has weired background color, try playing with the setting panel_background_color in DA UI: Theme Settings.

{
    "panel_background_color": "$background_color"
}

Acknowledgments

This package won't be possible without pyte, pywinpty and ptyprocess.