Setting Up Sublime Text

Based off of: https://www.sublimetext.com/docs/command_line.html

First install Sublime Text from https://www.sublimetext.com/

Sublime Text offers a command-line tool called subl that allows users to open files and projects directly from the terminal.

Setup Instructions:

  • Windows:
    • Locate subl.exe in the Sublime Text installation directory.
    • Add this directory to the system's Path environment variable to enable usage from the Command Prompt or PowerShell.
  • macOS:
    • Add subl to the PATH in ~/.bash_profile

    • For example, if Sublime Text is in the Applications folder, run:

      echo 'export PATH="/Applications/Sublime Text.app/Contents/SharedSupport/bin/":$PATH' >> ~/.bash_profile
      
    • and after that, open a new terminal window, and then you should be able to run: subl , and it will open Sublime.

      \

Usage Examples:

  • Open a specific file:

    subl filename.txt
    
  • Open a directory as a project:

    subl /path/to/project/
    
  • Open a new window:

    subl -n
    
  • Add a folder to the current window:

    bash
    

    \

  • Use Sublime Text as the editor for commands like git commit:

    export EDITOR='subl -w'
    

For a comprehensive list of options, run subl --help in the terminal.