Launch terminals from the current file or the root project folder
Shortcuts and menu entries for opening a terminal at the current file, or the current root project folder in Sublime Text.
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.
The package provides two commands (Open Terminal at File and Open Terminal at Project Folder) that can be triggered either using key bindings, command palette or via the editor context menu and the sidebar context menus.
By default key bindings are not enabled and have to be set manually by opening Preferences: Terminal Key Bindings from the command palette.
The default settings can be viewed by accessing the undefinedPreferences > Package Settings > Terminal > Settingsundefined menu entry.
null to indicate that the environment variable should be unset.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"
}
{
"terminal": "hyper.sh"
}
{
"terminal": "C:/Users/yourusername/AppData/Local/Microsoft/WindowsApps/wt.exe",
"parameters": ["-d", "."]
}
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%"]
}
}