open-sublime-text-from-windows-cmd-command-line

Open Sublime Text from Windows Command Line (CMD) and Power Shell


This tutorial will help you set Sublime Text 3 on Windows Systems up, to launch Sublime text 3 from Windows Command Line – CMD or Windows Power Shell with subl command.

Create a User variable – subl

To create a new user variable on your system, click Windows menu button and look for “variable” and click the following option otherwise you can go to system’s variables from control panel as well.

system-variables

Perfect, now click the environment varialbes.

advanced system variables

Let’s create a new user variable by clicking new button from the upper section.

Locate the sublime text exe file path on your system. This is how it is on my Windows 10 64 bit system. Copy it.

C:\Program Files\Sublime Text 3\sublime_text.exe

Create a New User Variable

Now, launch System Environment Variables windows and create a new user variable to launch sublime text with from CMD or PowerShell. Give it a name, I have given subl and paste the Sublime text 3 exe file path in the variable value field and click OK.

 Create a User variable - subl

Add Sublime Text to System Variable Path

Select path from either top User Variables or bottom system variable and then click edit.

env-variable-path

To add Sublime text to the environment variable, copy the Sublime Text 3 directory and click NEW on right top and paste the Sublime Text 3 directory. and click ok*3 …

 Add Sublime Text to System Variable Path

Again just copy the Sublime Text directory path, and create a new ENV variable path.

Open Sublime Text with Windows command line CMD or Power Shell

Finally, relaunch your power shell or cmd or command line interface and locate to folder or directory that you want to open with sublime text and type subl .

.” means open the current directory with sublime text, so don’t forget to add dot sign when you want to open any particular folder with subl

C:\Users\TubeMint>subl .

Disable Sublime Text Hot Reload

To prevent the opening of previous projects, you should set the following properties of your Sublime User Settings:

  1. Preferences
  2. Settings
  3. Add the following lines to the right window
  4. Save it
  5. Relaunch Sublime Text
"hot_exit": false,
"remember_open_files": false
subl opens the previous projects fixed
subl opens the previous projects fixed

Adding Terminal to Sublime Text like VS CODE

To add terminal to Sublime text, like VS Code has, you need to install package ‘terminus’ and add your preferences to the terminus keybindings.

  1. Press CTRL + SHIFT + P
  2. Type “install package”
  3. Hit Enter
  4. Type ‘terminus’
  5. Install Terminus Package

Add Keybinding Preferences to terminus

  • Preferences
  • Package Settings
  • Terminus
  • Key Bindings
  • Add The Following Lines of Code
  • Save and Relaunch STE
	{ 
        "keys": ["alt+1"], "command": "toggle_terminus_panel"
    },
   {
        "keys": ["ctrl+alt+t"],
        "command": "terminus_open",
        "args": {
            "post_window_hooks": [
                ["carry_file_to_pane", {"direction": "down"}]
            ]
        }
    }

Press ‘ALT+`’ to open terminal panel

Press ‘ ctrl+alt+t’ to open terminal in a window

Open Linux terminal with terminus and change terminal color too

Remove [ ] from the file

  1. Preferences
  2. Package Settings
  3. Terminus
  4. Settings
{
    "default_config": {
        "linux": "login shell",    // login shell
        "osx": null,      // login shell
        "windows": "Command Prompt"
    },
    
    "theme": "user",
    "user_theme_colors": {      
        "foreground": "#b7b7e8"
    },

}

Increase Sublime Text Sidebar Font Size

  1. Preferences
  2. Browse Package
  3. User
  4. Default.sublime-theme
Filename: Default.sublime-theme

[
    {
        "class": "sidebar_label",
        "color": "orange",
        "font.bold": false,
        "font.size": 18
       
    },
    {
        "class": "sidebar_tree",
        "row_padding": [8, 3],
        "row_padding": [8, 7],
        "indent": 12,
        "indent_offset": 17,
        "indent_top_level": false,
        "layer0.tint": [230, 230, 230],
        "layer0.opacity": 0,
        "dark_content": true
}, 
]

Sublime Text Sidebar Font Size