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

Terminus

by randy3k ST3

Best Terminal Emulator of Sublime Text.

Details

Installs

  • Total 961
  • Win 437
  • OS X 310
  • Linux 214
Jul 17 Jul 16 Jul 15 Jul 14 Jul 13 Jul 12 Jul 11 Jul 10 Jul 9 Jul 8 Jul 7 Jul 6 Jul 5 Jul 4 Jul 3 Jul 2 Jul 1 Jun 30 Jun 29 Jun 28 Jun 27 Jun 26 Jun 25 Jun 24 Jun 23 Jun 22 Jun 21 Jun 20 Jun 19 Jun 18 Jun 17 Jun 16 Jun 15 Jun 14 Jun 13 Jun 12 Jun 11 Jun 10 Jun 9 Jun 8 Jun 7 Jun 6 Jun 5 Jun 4 Jun 3
Windows 1 38 15 18 71 32 19 23 16 5 15 11 21 21 39 43 24 31 44 7 2 3 6 4 2 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
OS X 1 16 12 15 71 12 14 12 8 3 5 12 14 22 24 19 11 12 18 4 3 8 3 1 4 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 16 4 16 37 10 11 4 8 7 4 6 10 11 14 25 12 10 16 4 4 3 0 4 1 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

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 temrinal 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 temrinal 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 “ bind '”\e[1;3C": forward-word' bind '“\e[1;3D”: backward-word'
- Zsh: add the following in `.zshrc`

bindkey “\e[1;3C” forward-word bindkey “\e[1;3D” backward-word

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 if config_name is None
        "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 identify the terminal
        "pre_window_hooks": [],  # a list of window hooks before opening temrinal
        "post_window_hooks": []  # a list of window hooks after opening temrinal
        "post_view_hooks": []    # a list of view hooks after opening temrinal
    }
)

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.