Skip to content

Launch terminals from the current file or the root project folder.

License

Notifications You must be signed in to change notification settings

CodeByZach/sublime_terminal

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sublime Terminal

Latest Release

Shortcuts and menu entries for opening a terminal at the current file, or any directory in Sublime Text.

Installation

Download Package Control and use the Package Control: Install Package command from the command palette. Using Package Control ensures Terminal will stay up to date automatically.

Usage

  • Open Terminal at File Press Alt+Shift+T on Windows, Linux, or macOS.
  • Open Terminal at Project Folder Press Ctrl+Alt+Shift+T on Windows, Linux, or macOS.

In addition to the key bindings, terminals can also be opened via the editor context menu and the sidebar context menus.

Package Settings

The settings can be viewed and edited by accessing the Preferences > Package Settings > Terminal > Settings menu entry.

  • terminal
    • The terminal to execute, will default to the OS default if blank.
    • Default: ""
  • parameters
    • The parameters to pass to the terminal. These parameters will be used if no custom parameters are passed.
    • Default: []
  • env
    • The environment variables changeset. Default environment variables used when invoking the terminal are inherited from Sublime Text.
    • The changeset may be used to overwrite/unset environment variables. Use null to indicate that the environment variable should be unset.
    • Default: {}

Custom Parameters

By passing parameters argument to the open_terminal or open_terminal_project_folder commands, it is possible to construct custom terminal environments. You can do so by creating custom key bindings that call these commands with the arguments you want, as we'll document here, or by adding custom command palette or menu entries.

The following is an example, of passing the parameters -T 'Custom Window Title' to an XFCE terminal.

{
    "keys": ["ctrl+alt+t"],
    "command": "open_terminal",
    "args": {
        "parameters": ["-T", "Custom Window Title"]
    }
}

A parameter may also contain the %CWD% placeholder, which will be substituted with the current working directory the terminal was opened to.

{
    "keys": ["ctrl+alt+t"],
    "command": "open_terminal",
    "args": {
        "parameters": ["-T", "Working in directory %CWD%"]
    }
}

Example configurations

Here are some example configurations calling different terminals. Note that paths to executables might differ on your machine.

Cmder on Windows

{
    "terminal": "C:\\Program Files\\cmder_mini\\cmder.exe",
    "parameters": ["/START", "%CWD%"]
}

xterm on GNU/Linux

{
    "terminal": "xterm"
}

gnome-terminal for CJK users on GNU/Linux

We unset LD_PRELOAD, as it may cause problems for Sublime Text with imfix.

{
    "terminal": "gnome-terminal",
    "env": {"LD_PRELOAD": null}
}

iTerm on macOS

{
    "terminal": "iTerm.sh"
}

iTerm on macOS (with tabs)

{
    "terminal": "iTerm.sh",
    "parameters": ["--open-in-tab"]
}

iTerm2 v3 on macOS

{
    "terminal": "iTerm2-v3.sh"
}

Hyper on macOS

{
    "terminal": "hyper.sh"
}

Kitty on macOS

{
    "terminal": "/opt/homebrew/bin/kitty",
    "parameters": ["-d", "%CWD%"]
}
{
    "terminal": "C:/Users/yourusername/AppData/Local/Microsoft/WindowsApps/wt.exe",
    "parameters": ["-d", "."]
}

About

Launch terminals from the current file or the root project folder.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 65.8%
  • Shell 31.2%
  • PowerShell 2.5%
  • Batchfile 0.5%