Important: The information in this document is obsolete and should not be used for new development.
Xcode gives you a great deal of flexibility to customize the appearance of the editor. You can change the fonts and colors used to display text in the editor to suit your own preferences. You can also control the amount of information that Xcode displays about file locations and contents. This section describes how to change the default font and text editing colors for Xcode editors, and how to use the gutter, page guide, and file history menu to locate information in a file.
Setting Default Fonts and Colors
Displaying a Page Guide
Displaying the Editor Gutter
Viewing Column and Line Positions
You can change the font and colors used for text editing in Xcode in the Xcode Preferences window. Choose Xcode > Preferences and select Fonts & Colors. The Editor Font section displays the font used for text in the editor; to change this font, click the Set Font button.
Note: This font is also used for all text, regardless of its role, when syntax coloring is enabled, unless you specify otherwise. See “Setting Syntax Coloring” for more information.
To change the colors used in the editor, use the Editor Colors options. To change the color of an item, click its color well and choose a new color. You can change the default color for the following elements:
Text. This option controls the default color used for text in an editor. You can specify additional colors for text that represents particular code elements, such as strings. For a description of how to use syntax coloring in Xcode, see “Setting Syntax Coloring.”
Background. This option specifies the background color used for editor windows.
Selection. This option specifies the highlight color used to indicate selected text.
Insertion Point. This option controls the color of the blinking insertion point character in an editor window.
To help keep code lines no longer than a specified length, you can have Xcode display a guide line in every code editor at that column position in the file. To display a guide line, open the Text Editing pane of Xcode Preferences and select “Show page guide” in Display Options. Enter the location, in number of characters, at which you want the guide line displayed in the text field titled “Display at column.” Xcode displays a gray line in the right margin of all open editors, at the specified column.
Xcode does not wrap your code lines when they reach the guide line. The line serves only as a guide.
The gutter that appears on the left side of a code editor helps you quickly locate items in a file. This gutter can display:
Line numbers for the current file. Line numbers make it easy to find a location in a file. Xcode does not show line numbers by default; to change this, open the Text Editing pane of Xcode Preferences and select “Show line numbers” in Display Options.
Errors and warnings. To help you locate and fix problems in your code, Xcode displays error and warning icons next to the line at which an error or warning occurred. Clicking on the icon or pausing with the mouse over the icon displays the error or warning message.
Breakpoints. You can use the gutter to set, remove, and otherwise control the breakpoints in a file. Xcode indicates the location of a breakpoint by displaying an arrow next to the line at which the breakpoint is set. For more information on using breakpoints, see “Breakpoints.”
You can control the visibility of the gutter in a single editor or set the default behavior for all editors. To change the visibility of the gutter for all editors that you open, standalone and attached, open the Text Editing pane of Xcode Preferences and use the “Show gutter” option in Display Options. If this option is selected, as it is by default, the gutter is visible in all editors that you open. Otherwise, the gutter appears in all code editors only when you start debugging.
To show or hide the gutter in a particular instance of the editor, bring the window to the front and use the View > Hide Gutter and View > Show Gutter commands.
As you’ve seen in “The Navigation Bar,” the File History pop-up menu in the navigation bar not only lets you move between currently open files, it also shows you your current location in the file. For the file currently open in the editor, the File History menu shows the name and the line number of the line containing the insertion point. You can also have the File History menu display the column position of the insertion point; that is, the offset of the insertion point, in number of characters, from the left margin of the editor. Figure 15-8 shows the location of the current insertion point in the File History menu.
By default, Xcode does not display the column position of the insertion point. To change this, open the Text Editing pane of Xcode Preferences and select “Show column position.”
Last updated: 2006-11-07