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 907K
  • Win 494K
  • Mac 217K
  • Linux 197K
Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7 Mar 6 Mar 5
Windows 46 43 54 47 46 43 56 53 45 54 59 47 44 44 52 47 54 66 42 29 42 49 70 45 57 57 39 53 55 62 63 53 54 43 46 56 68 50 63 63 50 45 62 73 83 57
Mac 16 20 19 17 25 13 15 25 16 16 19 25 17 11 19 20 16 22 14 11 14 18 21 21 15 20 14 15 15 21 30 26 23 15 15 19 28 20 21 26 7 14 13 22 18 18
Linux 22 25 25 13 33 18 12 19 21 29 19 28 12 14 25 28 19 27 23 18 14 27 25 28 23 20 14 20 29 25 24 34 21 21 16 24 28 20 22 36 22 18 23 19 25 22

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", "."]
}