If you’re working on a big, complicated document, bookmarks are going to be your life saver. You can place a bookmark on any line of code in any open document. They’ll all appear in the Project Explorer in the Bookmarks section. This will help you quickly jump to different parts of the code that you’re working on, need to reference, or for any other reason you can think to mark them.
To set a bookmark, ensure that the cursor is on the correct line of code and press Cmd+D. You can also go to Edit > Bookmarks > Toggle to perform the same function. You can use these same commands to remove a bookmark as well.
When the bookmark is set, two things will happen:
A green dot will appear in the gutter next to the chosen line of code:
The bookmark, (file and line number) appears in the Bookmarks section of the Project Explorer:
This list helps to maximize the efficiency of bookmarks by displaying all bookmarks in all open files in all projects, as shown here. (Noticee that bookmarks for two different HTML files are listed.)
To view the bookmarks in the Project Explorer pane, click the Show the Bookmarks navigator button at the bottom of the application:
Click any one of these bookmarks listed in the Project Explorer to be taken directly to the file and line it marks. You can open a list of all bookmarks by going to View > Bookmarks, by pressing Ctrl+Cmd+B, or by clicking the “Bookmarks” header in the Bookmarks Navigator (accessed by clicking the button seen above).
The Bookmarks window displays all available information about each bookmark. You may find it useful to leave a comment for each one to help you find the one you need quickly.
To enter a comment, click in the Comment column next to the bookmark to which you would like to add information. Enter your comments and press Enter when you’re done.
You can preview a bookmark in the list by single-clicking it or moving the arrow keys to it and pressing the Space bar. The bookmarked line is shown in the editor pane, but the cursor is not placed there yet.
To place the cursor on the bookmarked line, double-click the bookmark or move the arrow keys to it and press the Enter key. Now you can edit the code on the bookmarked line.
To delete a bookmark, click it in the Project Explorer or in the Bookmarks window and press the Ctrl+Cmd+Backspace shortcut. You can also simply toggle the bookmark by pressing Cmd+D while the cursor is on the bookmarked line in the editor pane.
Don’t be concerned that your bookmarks may be broken if you add more lines above them; bookmarks move alongside the line they mark. For example, we have a bookmark on line 15 of index.html:
But if we add another line of code above line 15, the bookmark will move down with the line it marks:
You may find that bookmarks are the most useful part of the Web Editor. They help keep your project organized so that you don’t forget where the code you’re looking for is located. The more complicated your project is, the more useful bookmarks become.