Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"subl -n -w foo" start two windows instead of the single one I want #28

Open
mburr opened this issue Apr 29, 2013 · 5 comments
Open

"subl -n -w foo" start two windows instead of the single one I want #28

mburr opened this issue Apr 29, 2013 · 5 comments

Comments

@mburr
Copy link

mburr commented Apr 29, 2013

(Note: this bug also applies to ST2)

If ST3 is not running, the command:

/opt/sublime_text/sublime_text -n -w foobar

will start two windows - one with the "foobar" file opened in a new window (as desired and specified by the command line options) and one with the previous set of files that were opened when ST3 was last running.

This is with a fresh, new installation of ST3 build 3030, on a Linux Ubuntu 12.04 LTS box that has never had ST installed on it - so whatever preferences are set by default are in effect.

My intentions are to use the "-n -w" options in a script so I can get normal behavior when ST is specified in the EDITOR environment variable so that git or subversion (or whatever) can invoke ST3 as the 'system editor'.

(similar behavior occurs if the -w option is omitted).

This problem is discussed in the ST forum at http://www.sublimetext.com/forum/viewtopic.php?f=2&t=11293

@FichteFoll
Copy link
Collaborator

I think this issue is more about ST's default bhaviour when run from the command line with "remember_open_files": true and no open window. The userecho ticket Add '--new-instance' and '--no-remembered-files' command line options, which is also linked in the forum thread, suggests the addition of new command line options which seems more useful to me (hence the enhancement label).

Plus, when ST has been started with --no-remembered-files it could just not remember the files of this session (maybe with some notice on the top or something) which would make it work exceptionally well for this purpose as both a quick editor and the editor it already is.

@FichteFoll
Copy link
Collaborator

Image/video from the #617 duplicate:

img

@gerardroche
Copy link

gerardroche commented Dec 5, 2017

I think this issue is more about ST's default bhaviour when run from the command line with "remember_open_files": true and no open window. The userecho ticket Add '--new-instance' and '--no-remembered-files' command line options, which is also linked in the forum thread, suggests the addition of new command line options which seems more useful to me (hence the enhancement label).

Plus, when ST has been started with --no-remembered-files it could just not remember the files of this session (maybe with some notice on the top or something) which would make it work exceptionally well for this purpose as both a quick editor and the editor it already is.

An option to explicitly not repoen files might be useful, but it should be unnecessary in some contexts.

For example, open a directory e.g. current directory subl . should not repoen the previous session files. It shouldn't require an option. Passing a directory, or file for that matter, is an implicit --no-remembered-files. This is what most people will expect to happen.

@BenjaminSchaaf
Copy link
Member

Sublime Text needs to always restore the previous session as it may contain unsaved files. Having subl . always drop the previous session would mean deleting user data. If you don't want Sublime Text to restore the previous session you can set "hot_exit": false and it will instead prompt you for any unsaved changes.

@FichteFoll
Copy link
Collaborator

It was suggested to add a different operation mode where the session was explicitly not restored for cases where you just want ST as a quick editor for some file opened via the command line (or some other mechanism). As it stands right now, this can be achieved by keeping a portable instance around with "hot_exit": false and mirror settings and packages otherwise, if you need them. That's a reasonable workaround, but one that takes effort to set up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants