Shortcuts and menu entries for opening a terminal at the current file, or the current root project folder in Sublime Text.
- Opens a terminal in the folder containing the currently edited file
- Opens a terminal in the project folder containing the currently edited file
- Download & Install
Sublime Text 3
(https://www.sublimetext.com/3) - Go to the menu
Tools -> Install Package Control
, then, wait few seconds until the installation finishes up - Now,
Go to the menu
Preferences -> Package Control
- Type
Add Channel
on the opened quick panel and press Enter - Then,
input the following address and press Enter
https://raw.githubusercontent.com/evandrocoan/StudioChannel/master/channel.json
- Go to the menu
Tools -> Command Palette... (Ctrl+Shift+P)
- Type
Preferences: Package Control Settings – User
on the opened quick panel and press Enter - Then,
find the following setting on your
Package Control.sublime-settings
file:"channels": [ "https://packagecontrol.io/channel_v3.json", "https://raw.githubusercontent.com/evandrocoan/StudioChannel/master/channel.json", ],
- And,
change it to the following, i.e.,
put the
https://raw.githubusercontent...
line as first:"channels": [ "https://raw.githubusercontent.com/evandrocoan/StudioChannel/master/channel.json", "https://packagecontrol.io/channel_v3.json", ],
- The
https://raw.githubusercontent...
line must to be added before thehttps://packagecontrol.io...
one, otherwise, you will not install this forked version of the package, but the original available on the Package Control default channelhttps://packagecontrol.io...
- The
- Now,
go to the menu
Preferences -> Package Control
- Type
Install Package
on the opened quick panel and press Enter - Then,
search for
TerminalShortcuts
and press Enter
See also:
- ITE - Integrated Toolset Environment
- Package control docs for details.
- Open Terminal at File
- Open Terminal at Project Folder
In addition to the key bindings, terminals can also be opened via the editor context menu and the sidebar context menus.
The default settings can be viewed by accessing the Preferences > Package Settings > TerminalShortcuts > Settings – Default menu entry. To ensure settings are not lost when the package is upgraded, make sure all edits are saved to Settings – User.
- terminal
- The terminal to execute, will default to the OS default if blank. OS X users may enter iTerm.sh to launch iTerm if installed.
- Default: ""
- parameters
- The parameters to pass to the terminal. These parameters will be used if no custom parameters are passed via a key binding.
- Default: []
- env
- The environment variables changeset. Default environment variables used when invoking the terminal are inherited from sublime.
- The changeset may be used to overwrite/unset environment variables. Use
null
to indicate that the environment variable should be unset. - Default: {}
Here are some example setups:
{
// Replace with your own path to cmder.exe
"terminal": "C:\\Program Files\\cmder_mini\\cmder.exe",
"parameters": ["/START", "%CWD%"]
}
{
"terminal": "xterm"
}
{
"terminal": "gnome-terminal",
// Unset LD_PRELOAD which may cause problems for sublime with imfix
"env": {"LD_PRELOAD": null}
}
{
"terminal": "iTerm.sh"
}
{
"terminal": "iTerm.sh",
"parameters": ["--open-in-tab"]
}
{
"terminal": "iTerm2-v3.sh"
}
With the parameters argument to the open_terminal and open_terminal_project_folder commands, it is possible to construct custom terminal environments.
The following is an example of passing the parameters -T 'Custom Window Title' to a terminal. Please note that this example is just an example, and is tailored to the XFCE terminal application. Your terminal may use the -T
option for some other features or setting. Custom key bindings such as this would be added to the file opened when accessing the Preferences > Key Bindings – User menu entry (the file name varies by operating system).
{
"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%"]
}
}