Sublime Forum

Command line and window behavior

#1

Hi,

After a lot of experimentation, I confess that I haven’t been able to decipher the behavior of using subl. If anyone could explain what I should expect I’d really appreciate it.

The scenarios I’ve tried to analyze:

subl file (no previous window)
subl file (previous window)
subl file (previous window, containing amongst other file the “file”)

The same for subl dir. The 2 additional options -n and -a are making things even more complicated.

tia,

:- alex )

0 Likes

#2

By now I’m wondering if:

  1. either all confusion is on my side and this works exactly as everyone expects
  2. or no one understands how this works
0 Likes

#3

I think that by default,
“subl” opens the last session (i.e. all the files, and windows like they were before closing),
“subl file” opens the last session and “file” on the last opened window.

If the file was already opened on the last opened window, subl will simply focus it.

“subl -n [file]” will open the last session and a new window [containing file].
“subl -a dir” will open the last session and add dir on the sidebar.
“subl -an dir” will open the last session and open a new window with dir in the sidebar.

See also the “hot_exit” and “remember_open_files” options.

I don’t understand what exactly is confusing you (or what you think the behavior should be).

0 Likes

#4

The simplest example I can give is that “subl -an dir” results in an inconsistent behavior:

  1. Start ST3.
  2. Close all windows
  3. Quit ST3
  4. subl -an dir ==> might or might not have the dir added to the sidebar
0 Likes