Sublime Forum

Save in current folder, rather than most recent save location [solved]

#1

Most of the time when I work with Sublime Text, I’ve opened up a folder (or a file in a folder), and I want any new file I create to go in the same folder that I’m currently working in. If I’m not watching carefully, though, Sublime saves in the last folder I’ve saved to previously, which is often out of date.

Example workflow:
Open up folder A.
Edit 3 or 4 files from folder A, all in the same Sublime window.
Save a new file in folder A.
I’m finished for a while with the project in folder A.

Next day, open up folder B.
Look at or edit a couple files in folder B, in the same Sublime window.
Start a new file, still in folder B’s window, with all folder B stuff showing in the left sidebar.
Click save, and Sublime automatically tries to save to folder A, but I almost certainly want it in folder B. Depending on whether I notice this at the time, or whether a same-name file already exists in folder A, this can be more or less of an annoyance, and I may have to go find the file in folder A to move it later.

I assume this is pretty typical usage, based on the fact that Sublime shows the whole current folder and contents in that left sidebar. Why not save to this folder? (Maybe last-saved-location would be a good secondary guess, if I started a new file from somewhere that there IS no “current folder” on the left yet.) I also did a quick search and couldn’t find a way to adjust this behavior in the settings.

Thanks!

1 Like

#2

someone else has reported something similar here:

1 Like

#3

Hmmm, that’s strange. I looked at the other post, and the other poster requested in fact the opposite thing that I did — they were already receiving the behavior I asked for, and requesting the behavior I thought I already had. I went back to Sublime, and sure enough with 2 windows open, each window is already saving in the root folder for that window (not the last saved location.)

I did have a few files previously save accidentally to not where I expected them to save, so I’ll have to look into how that might be happening, but at the moment I just feel silly. I haven’t been using Sublime that long, but it’s already doing what I asked for. As per the other post, having the option to choose either of these default save systems would make sense, but as I already have the behavior I requested, this topic no longer servers a purpose and can be closed. Oops! I couldn’t seem to find how to close or delete my topic, though (perhaps as a new user I don’t have that privilege yet?), so I would appreciate it if you could close it for me, or direct me how to do it myself. Sorry for the trouble!

0 Likes

#4

Generally to mark a post as closed you would modify the topic to include the text [Solved] at the start (there should be a little pencil icon to the right of the topic at the top of this screen).

0 Likes

#5

Thanks! I saw the little pencil icon, but couldn’t find a “delete” or “mark solved” button, so I wasn’t sure what edit to make. Topic is now marked [Solved]

0 Likes

#6

You may also find AdvancedNewFile to be useful.

0 Likes

#7

I might be doing to much, but… I’ve done a plugin that combines SideBarEnhancement And AdvancedNewFile (but much cleaner). So, if you invoke the create command from a shortcut, the command palette, or from the Side Bar (right click -> New…), it’s exactly the same (you always get aliases, auto completions, nested creation, etc). And these things also apply to the move, duplicate, etc commands. It’s called FileManager.

0 Likes