O'Reilly logo

Coding with Coda by Eric J Gruber

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4. Tinkering with Preferences

When I was but a teenager, a neighbor of mine once bought a brand-new Harley-Davidson motorcycle and had it torn apart, sitting on stands in his front yard two days later. My dad and I walked over to see what he was doing, as we were completely shocked by what he had done.

“What’s wrong with your bike?” my dad asked him.

“Nothing,” he said. “I just wanted to tinker a little bit with it.”

It’s a good thing Coda doesn’t cost as much as a Harley-Davidson motorcycle, because one of the first things I want to do with any new program is to “tinker a little bit with it” and set it up to my preferences.

Selecting Coda → Preferences from the menu brings up a window where you can tinker to your heart’s content. There are nine tabs to choose from, so let’s set up Coda the way we like it.

General Preferences

Split Direction

When editing files that can be previewed within Coda, such as an HTML file, you can split the viewing area. For example, your code could be in one split pane, and a preview of what you’re editing could be in another. This preference sets the default for whether the split is horizontal or vertical.

An added bonus is that you can quickly switch to the opposite of your default setting by holding down the Option key when splitting a direction in editor, followed by clicking the Split button in the path bar.

Sidebar Position
This sets the default positioning of the sidebar in the editing area.
iCloud
This option is only available if you purchased Coda through the Mac App Store. If you did, you can sync your Sites and Clips (reusable snippets of code) through Apple’s iCloud service.
AppleScript
AppleScript fan? Click this option to show the Scripts icon in the menu bar.
MySQL rows per page
Coda 2 has a built-in MySQL editor. This sets how many rows are visible at a time.
Updates
For versions of Coda purchased outside of the Mac App Store, you can choose to automatically download and install updates, or just notify if there are updates. You can also not check for updates at all, although that doesn’t seem like a very good idea.

Editor Preferences

Default File Type
Select a file type (the default is HTML) from the dropdown. When a new file is created, it will use the type you selected here.
Default File Encoding

Don’t you just love it when you paste something from a word processing document only to have it to look all goofy when you load the page in a browser? We’ve all seen something like “— before. You can blame file encoding for that, causing things like your quotation marks and apostrophes to end up as “confused characters”.

Let’s take a file with ASCII text encoding. To display a letter in the English (Latin) alphabet, it might use a certain set of instructions that, when opened in a different text encoding, displays differently. This can occur when dealing with files across national boundaries, and if you’re ever in the position where you work with someone from another country, you should be aware of it. It would be a shame if all your A’s ended up looking like å or something.

You can select a default file encoding from this selection or customize the encodings list to have only what you prefer.

Default Line Endings

At some point, we’ll no doubt end up exchanging files with another developer who might be using a different system than a Mac. It’s a cruel world, but we have to live in it. Because of this, we’ll need to know some subtle nuances of other operating systems and how those systems use different ways for showing ends of a line in text files.

Choose from one of the three common line endings available for their respective operating systems:

  • Mac OS X/Unix like systems, which includes Linux, uses LF or line feed
  • Classic Mac OS (pre Mac OS X) uses CR or carriage return
  • Windows uses CR + LF or carriage return plus line feed endings
Other Options

Below the Default Line Endings selection are some additional options for your editor preferences:

  • Suggest completions while typing. This will attempt to complete your code for common design and development functions.
  • Automatically insert closing brackets. For example, this will give you a final “{” after you type the initial “{” (and so on).
  • Show invisible characters. An option that gives symbolic nomenclature for spaces, carriages returns, etc.
  • Select prefix when double clicking a variable. For example, in PHP, when you select the $ sign at the beginning of a variable rather than selecting a variable from $variable, you can pick the prefix associated with it.
  • Indent new lines. When checked, if you have spaces at the beginning of a line, those spaces are repeated when you move to a new line by hitting return. If left unchecked, you’ll just go to the beginning of the next line without the spaces.
  • Typing delimiters wraps selected text. Selected, you can type the world “hello,” highlight it, and then press Shift followed by the < key. The result will produce <hello>.
  • Wrap lines. Causes the text to flow within the viewable window area provided. Otherwise, you’d be doing a lot of right scrolling.
  • Indent wrapped lines by (number of) spaces. This is a visual tool so that if you have a line that wraps past the end without going to a new line, Coda will indent to give a visual effect that it is wrapped by the number of spaces specified.
Tab Width
Set how far the cursor moves when you press the Tab button by setting up its default behavior. Rubyists like to use two spaces, so this is where you’d set your default to only two and select “Use spaces instead of tabs.”
Editor Font
Change the fonts for the documents you work with. Click the Select button to find a new font and font size from the Font panel.
Custom Syntax Modes

In most cases, Coda will automatically match the correct syntax mode with the file extension, such as HTML for .html files or Ruby for .rb ones. However, it is possible to create a new file with no extension right off the bat, so be mindful of how to change it.

Coda is pretty smart, but there might be times where it doesn’t recognize a file extension and therefore doesn’t know which syntax mode to assign to the file. When this happens, you’ll need to do that here. Click the plus button at the bottom of the Custom Syntax Mode window. Then create the extension name and assign a syntax mode from the list of available options.

Additional modes can be downloaded as plug-ins from Panic’s website. After downloading a third-party plug-in, follow the instructions included. You can manually copy the .mode file using a Terminal window into ~/Library/Application\ Support/Coda\ 2/Modes/. Using the Finder, navigate to your user account’s Home folder, and then drop the file into Library → Application Support → Coda 2 → Modes.

Starting with Mac OS 10.7, the Home folder’s Library is hidden. To make it viewable in the finder, hold the Option key and select Go from the Finder menu. This will temporarily allow for easy access to the Library. For the daring, you can also open a Terminal window and type chflags nohidden ~/Library/ to make it appear, and chflags hidden ~/Library/ to hide it again if you wish.

Sharing Preferences

Coda includes a collaborative editing mode that lets multiple people simultaneously edit the same file in real time over a network. We cover this more extensively in Chapter 5.

The info in the Sharing tab includes the personal information you’ll display to a collaborator, as well as the color for your edits.

Colors Preferences

Stylesheet

Coda ships with four stylesheets. Birds of Paradise and Specials Board have darker backgrounds, while Coda Bright and Coda Classic are lighter. These act as a kind of base for customizing the colors of the text editor. Other customizations include highlighting the current line, syntax coloring, and the ability to change the document background, document text, line highlight, and invisible character colors.

Also included are text and background color options, as well as bold, italic, underline, and strikethrough settings.

Importing and Exporting

You won’t be limited to these options, however. To the right of the stylesheet dropdown is a setting menu for importing and exporting the .sss file associated with the color scheme chosen. The .sss file extension is a Coda stylesheet, and you can use this file to create your own style or to back up your preferred colors.

Fortunately, if you really screw up, there’s a Revert All button to help you get back to the style sheet defaults.

Files Preferences

View Options
Choose to use relative dates (today, yesterday, etc.) and to group folders together above files when viewing files.
Show Columns
Coda shows only the size and date of a file by default, but you also can pick kind, owner, group, and permissions visibility for both local and remote views.
Custom Editors
Use the plus, minus, and pencil editing buttons to edit the External Editors table with filename extensions and their respective applications. This makes it easy to right-click the file in the file browser and open it for quick editing in the proper application (like a .png image in Photoshop).
Subversion Tool Path, Git Tool Path
Default location of your source control management tool. This likely won’t need changing unless you’ve got your machine set up different than a typical install.
Source control changes

Have Coda choose from the following while your code is under version control, particularily when working with a repository that others are also making changes to:

  • Prompt me to update my repository. When changes have been pushed from a remote repository, this option will prompt you to decide whether you want to update your local version or not.
  • Automatically update my repository. This option tells Coda to go ahead and allow changes made to a remote repository on your local machine without being prompted to do so.
  • Do not update my repository. No changes will be made; your local repository will not be updated.

Transfers Preferences

When you’re ready to deploy your website or application, Coda gives you four options to set as default for downloading and uploading files and folders if an item already exists:

  • Ask me what to do
  • Replace the existing file (or folder)
  • Try to resume (or merge) the transfer
  • Skip the file (or folder)

Bandwidth

You can limit uploads and downloads to a set number of kilobits per second, and set the maximum number of files for simultaneous transfer.

Options

Here you can use passive mode for data transfers, although according to Coda’s Transfers tab, Sites “have their own passive setting which overrides this one.” Still, it is possible to transfer files outside of a Site in Coda, using its FTP. If you need this option, it’s available.

Also, you can choose to set an audible alert to let you know when a transfer has completed.

Lastly, there are ASCII File Extension options pre-loaded, or you can add (or delete) to your own preferences.

Rules Preferences

Coda’s Rules preferences will give you the ability to really fine tune your workflow. It allows you to hide certain files (overriding operating system defaults). Conversely, it allows you to hide certain things contrary to OS defaults. Lastly, it allows you to filter certain files from uploading (e.g., PSDs, BMPs, and so on). With File Rules and Permissions, Coda is at your disposal to play nicely with your preferred workflow.

Terminal Preferences

Coding with a plain, white background just doesn’t feel right. I prefer instead to set up my environment with a more colorful aesthetic.

Terminal Font
Click the Select button to change the font family, style and size.
Options

Click the checkboxes if you want each option to be “yes”:

  • Smooth terminal font (for type fanatics)
  • Use visual beep (which will give a “flash” when there is a user error)
Text colors
Choose the foreground and background colors for your Terminal window.
Prompt Before Closing
If you close Coda while a process is running (unless you specify an exception), Coda will ask you if you want to close the tab/window.

Advanced Preferences

Working with a proxy server? Coda has advanced options for integrating it into your work environment. Choose from Proxy Server Type, Proxy Server name, Proxy Port, Proxy User Name, Proxy Password, and an option to “Try to keep idle connections alive.” Advanced setting options are also available.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required