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

Terminal

by Will Bond (wbond) ALL Top 100

Launch terminals from the current file or the root project folder

Labels terminal

Details

Installs

  • Total 924K
  • Win 503K
  • Mac 220K
  • Linux 201K
Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3 Nov 2 Nov 1 Oct 31 Oct 30 Oct 29 Oct 28 Oct 27 Oct 26 Oct 25 Oct 24 Oct 23 Oct 22 Oct 21 Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7
Windows 25 29 23 70 43 47 41 0 0 64 64 64 56 60 62 53 63 49 51 52 64 50 56 77 71 36 49 62 65 84 53 64 42 51 65 78 58 56 48 56 44 59 56 59 58 51
Mac 8 14 6 14 12 16 12 0 0 18 12 13 10 20 11 20 23 19 11 12 22 15 13 8 16 13 17 20 17 13 16 20 15 10 23 23 21 20 18 12 9 22 26 15 12 20
Linux 8 15 7 11 9 19 11 0 0 17 19 25 20 22 19 25 21 26 7 26 17 22 20 37 23 21 18 15 18 13 15 24 19 28 19 21 26 21 22 21 18 21 14 20 22 19

Readme

Source
raw.​githubusercontent.​com

Sublime Terminal

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 Opens a terminal in the folder containing the currently opened file.
  • Open Terminal at Project Folder Opens a terminal in the project folder containing the currently opened file.

Terminals can be opened via the command palette, the editor context menu and the sidebar context menus. Additionally, you can set up key bindings.

Key bindings

To create keyboard shortcuts, open the Preferences > Package Settings > Terminal > Key Bindings menu entry. Our suggested key bindings are on the left, you can copy these over to your personal bindings on the right and tweak them to your liking. Example:

[
  { "keys": ["super+shift+t"], "command": "open_terminal" },
  { "keys": ["super+shift+alt+t"], "command": "open_terminal_project_folder" }
]

Note that in version 2 of this package, we stopped enabling these bindings by default. They conflicted with built-in bindings of Sublime Text, and users might have different preferences.

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 OS X

{
  "terminal": "/opt/homebrew/bin/kitty",
  "parameters": ["-d", "%CWD%"]
}

Windows Terminal

{
  "terminal": "C:/Users/yourusername/AppData/Local/Microsoft/WindowsApps/wt.exe",
  "parameters": ["-d", "."]
}