Sublime Forum

Create a new file in a directory?

#1

This is the one big issue that I’m having, and I can’t seem to figure it out. I’m using Sublime Text 2 for Mac and when I want to make a new file in some directory, right clicking on the directory doesn’t give me a menu, and clicking File -> New just gives me a new scratch file which I have to save by navigating the whole tree down to the folder that I want. Is there some really easy way to do this that I’m missing?

0 Likes

#2

You could do the following until that kind of rodent-ridden, er… mouse-driven operation is available:

  1. ctrl + p (Goto Anything)
  2. enter
  3. ctrl + n
  4. ctrl + s

In 3), Sublime will change the working dir to point to the opened file’s directory. It’s faster than it may seem to be.

0 Likes

#3

[quote=“guillermooo”]You could do the following until that kind of rodent-ridden, er… mouse-driven operation is available:

  1. ctrl + p (Goto Anything)
  2. enter
  3. ctrl + n
  4. ctrl + s

In 3), Sublime will change the working dir to point to the opened file’s directory. It’s faster than it may seem to be.[/quote]

Ah, I didn’t notice that now when saving a new file I don’t start at the root of the project. That must have changed, or somehow I was screwing it up before. Thank you.

I just have one more question, if you don’t mind: now that I’ve got a file open after using Goto Anything, how do I reveal it in the project tree? I see reveal in finder, but that’s it.

0 Likes

#4

I don’t quite understand what you mean by “reveal” here… Doesn’t it show up for you in the sidebar (project tree)? Also, are you talking about the existing file you used to chdir, or the newly created file? If it’s the latter, Sublime won’t sync with the disk until you save.

0 Likes

#5

[quote=“guillermooo”]

I don’t quite understand what you mean by “reveal” here… Doesn’t it show up for you in the sidebar (project tree)? Also, are you talking about the existing file you used to chdir, or the newly created file? If it’s the latter, Sublime won’t sync with the disk until you save.[/quote]

No, if I open a file with Goto Anything I get the file open, but it doesn’t open all it’s parent directories and show me where it is in the project tree. That’s totally the expected behavior, but sometimes I want to know where a file is just to get context, see the files near it, etc.

0 Likes

#6

I see… Yeah, I don’t think that’s possible with the sidebar. Sublime Text 1 used to let you control whether you’d look for dirs or base names in the QuickPanel (watered-down Goto Anything kind of thing). I used to find that extremely useful for exactly what you say.

0 Likes