Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
If your days end up anything like mine, by noon you have dozens of documents open, and for the life of you, you can't remember exactly what you were working on or where that last file was that you needed to change. One of the things I love most about CF Builder is just how fast it allows you to get around your code and find what you are looking for. There are a ton of keyboard shortcuts and toolbar buttons that help you find what you want as fast as possible. To start with, we will take a look at navigating between documents. Right now, I have my ColdFusion Builder start page open and four documents, which has just enough room to show all of the tabs along the top here.
But if I go over to my cfcs directory and open up a couple of components, I no longer have room to display every file that I am working on. So, over here to the side, you can see there is a small double arrow with a number that shows how many documents are open, besides the ones that are currently showing in the tabs. So, if we click this little button, we can see at the top, I have four bolded documents that are not viewable in the tabs along the top, and then at the bottom I have everything that I can currently see in the tabs.
If I start to type, at the top, I can filter down that list to find exactly what I want. Use my arrow keys to select the document and press Enter, and then that document comes into focus. I can get to this same list by pressing Command+E or Ctrl+E on Windows to bring up the file list. I will type in login, choose login.cfm, and press Enter, and then that tab comes into focus. Now, you will notice that CF Builder will continually redraw the tabs to fit as many as it can, and now my file list shows that there are five additional documents open.
So, just expect your tabs to jump around a little bit and for this number to change as you move through your documents. Now, what about navigating around a single document? Let's go to the ARTDAO. And this file is fairly long. We have got about 140 lines. If I move over to the Outline view, I can see the structure of my ARTDAO.cfc. I can also go up here to the Filter and filter down my list to find exactly the method that I am looking for.
So, for example, I type cre. I can scroll down and find my Create method and it gets highlighted over in the code editor, but there is also a way to do this directly inside of the code editor, without having to reach for my mouse. If I press Command+O, it brings up the same Outline view. I can start typing a method that I want to find, use my arrow keys, select it, and press Enter, and it will go directly to that method. Also, in the little Outline pop-up, I can click this menu and choose whether or not I want it to remember the size and location.
So, for example, I can make the window larger. I can also choose whether items should be sorted alphabetically or in the order they appear in my code. I can collapse and expand everything directly from here, and I can hide private methods that won't be available to my CFM files. To get rid of the Outline view, I can just press Esc, and I am back to my file. Another way I tend to move quickly through my code is by searching for specific variables that I am using. So, as an example, here in my Create method, I have an argument called ARTID.
If I want to know everywhere that the ARTID method is used, I could open the Find dialog, but it's easier to use the Find Selection keyboard shortcut, which is Command+K or Ctrl+K. If I hold down Command+K, it will cycle through all of the instances of the word ARTID. So, I am just pressing Command+K and it's jumping through every match for the current selection. If I hold down Command+Shift+K, it will go backwards through the document. So, I can move back and forth through my entire document and find everywhere that I am using a particular string of text.
Now, there are also times when I need to jump to a specific line in my code. To do that, I can press Command+L or Ctrl+L, and that brings up the Go to Line dialog. Then I can just type in Line 50, press Enter, and it will jump directly to that line. So, those are the ways to navigate to a specific location if you actually know where you want to go. But oftentimes, if I am five or six files down into solving a problem, sometimes I forget where I have been. Across the top of CF Builder, in the toolbar, we have Back and Forward buttons, just like you have in a Web browser.
You can click the Back and Forward buttons to actually move through your code, to go back to where you have been. I can see I have been in six different locations in the ARTDAO. Before that I was in login.cfm, and before that, I was in ARTGateway. I can click the Back buttons and cycle back through each of those positions, and then I can click Forward to go back through that same list. This far left icon is the last Edit location, and this goes back to the last line where I actually changed a line of code.
I didn't just stop and select something, but actually edited part of the file. So, if I click that link, it takes me back to the login.cfm, which I was actually editing in the previous video. Those are the quickest ways to navigate around your documents inside of CFBuilder. To find additional keyboard shortcuts, spend some time in the General Keys preferences.
Get unlimited access to all courses for just $25/month.Become a member