3.2 Finding Files
Finding files can be a slow task. In this lesson we'll take a look at the fastest ways we can find files in our project.
1.Introduction1 lesson, 01:29
2.The Basics2 lessons, 06:52
3.Getting Around4 lessons, 10:53
4.Snippets4 lessons, 15:59
5.Deep Git Integration3 lessons, 08:48
6.Packages9 lessons, 40:23
7.Automating Workflows4 lessons, 15:31
8.Conclusion1 lesson, 00:28
3.2 Finding Files
Whether you realize it or not, one of the most tedious parts of development is actually finding the file we need. A lot of times we'll be in the middle of editing a file, and we're completely in the zone. And then we realize that we have to change another file to keep continuing. At this point, we're so focused on what we're doing, it's hard to remember where anything is in the project. So we usually start by sifting through some folders. We may open up one folder and just see that there's three more below it. And from there we'll just keep opening them up until we finally find the file that we're looking for. And once we open it up, we realize that it was actually open in our buffer the entire time. And before you know it, this really can take up a lot of time. Sometimes finding a file can take up anywhere between 15 to 30 seconds. And while that may not seem like a lot to you, keep this fact in mind. If an action takes ten seconds, and you do it ten times a day for an entire year, that'll take over ten hours of your time. And that's a lot of time to have wasted when we really could have optimized it in the first place. The first thing we're gonna focus on is finding files that are currently open in our buffer. Right now there's way too many files open. Usually we want to keep this down to a minimum, but it happens during development. So when it does, how do we search through them? The first thing we'll do is we'll hit Cmd+B. And what we see is a list of all the files that are currently open in our buffer. So we can easily key though them, or we can go up and we can actually search for our file. Right now I'm looking for slide controller, and as I type in slide, three options for slide show up. I just go down to one, and then I get right into SlideCtrl. A tactic I prefer is that I usually can see the file, and all I have to do is hit the Cmd+Alt+Arrow key, and I can cycle through my files. It's good to know how to find a file that's open. But most of the time, we're gonna want to find a file that's somewhere buried in our project. And to do that we can use the fuzzy-finder. To enable the fuzzy-finder, we'll hit Cmd+P. And what this does is it allows us to search through our entire project files, and in this case I wanna find a file called nghack. So when I type nghack in, we can see it shows up in the search. And I hit Enter, and it opens up. But what if I wanna find a file that has a similar name? So enabling the fuzzy reader again, I'm gonna find a file called firepad. As soon as I type firepad in, we can see that we actually have a lot of selections available. And even if I restrict to extension by typing js, we can see that there's already a couple other files as well. And this is because it also includes the folder as well as the file name in the fuzzy-finder. The good about this is that we have filtered down to all the files that contain the firepad. The bad is is that we can really still spend some time searching through each file. And after it's open, we can open up the wrong one and then have to do another search again. So a better way of doing this is, is that I'm looking for a file called firepad that's within the directives folder. So just by saying directives/fire, I can see that the firepad file has opened up. So, when we're searching for files, we need to know a couple things. First, is the file open? If it is, we know we can hit Cmd+B. If the file is not open, we can use the fuzzy-finder, by hitting Cmd+T or Cmd+P. And the fuzzy-finder is fuzzy, it's not very specific. So, to be specific, we have to type in the folder as well as the file name. So that's all there is to finding files in Atom. Just remember, Cmd+B and Cmd+P. So now that we know how to quickly locate and open up files, we're gonna focus on actually doing quick actions within the file. So the next lesson we're gonna take a look at some common tedious coding tasks. And we're gonna use some commands as well as some shortcuts to optimize that workflow.