Search code examples
sublimetextsublimetext4

Sublime Text 4: open multiple windows from terminal


Sublime Text 4 was just released. A behavior change from Sublime Text 3/2 has been implemented. In new Sublime Text 4, if a window is already open when the User (me) uses the $ subl . command from the terminal, it takes me to the currently open Sublime Text window. This is not the behavior I want.

Previously in Sublime 3/2, subsequent use of $ subl . command would open a new Sublime Text window in this directory (I would now have 2 separate windows, both in this directory with all of this projects sub-directories in the sidebar).

How do I get Sublime Text 4 to open Additional Windows from the terminal? I would like to open multiple windows in the same project from the terminal.

Thank you.


Solution

  • The command line argument -n or --new-window tells subl to create a new window.

    λ subl --help
    Sublime Text build 4106
    
    Usage: subl [arguments] [files]         Edit the given files
       or: subl [arguments] [directories]   Open the given directories
       or: subl [arguments] -- [files]      Edit files that may start with '-'
       or: subl [arguments] -               Edit stdin
    
    Arguments:
      --project <project>:    Load the given project
      --command <command>:    Run the given command
      -n or --new-window:     Open a new window
      --launch-or-new-window: Only open a new window if the application is open
      -a or --add:            Add folders to the current window
      -w or --wait:           Wait for the files to be closed before returning
      -b or --background:     Don't activate the application
      -s or --stay:           Keep the application activated after closing the file
      --safe-mode:            Launch using a sandboxed (clean) environment
      -h or --help:           Show help (this message) and exit
      -v or --version:        Show version and exit
    
    Filenames may be given a :line or :line:column suffix to open at a specific
    location.