General Actions

Because all TEA actions are currently text actions (as opposed to file actions), you will find them in the Actions menu along with most other custom actions created by Sugars.

In most Espresso installations, the TEA general actions are the collection of actions that are immediately beneath the actions bundled with Espresso in the menu. TEA’s general actions are useful for almost all coding languages, but since most of them are not things you’ll need to access often they mostly lack keyboard shortcuts. If you find yourself using some of the general actions often enough, you may wish to add your own keyboard shortcuts using the System Preferences Keyboard preference pane.

Spaces To Tabs… and Tabs To Spaces…

As you might expect, these actions convert the type of indentation in your document or (if it exists) your selected text. When you run the actions you’ll be prompted to enter the number of spaces per tabs you wish to use (it defaults to whatever is in your Espresso preferences, so you can just hit enter most of the time):

Trim Line(s)

Trim Line(s) will, when invoked, either trim all of the lines in your selection or the current line the cursor is on (if no selection exists). Unlike some trim lines actions, TEA’s Trim Line(s) attempts to be smart about what whitespace it removes:

  • All whitespace at the end of the line will be stripped
  • Any whitespace at the beginning of the line that isn’t part of the indentation will be stripped

What the latter means is that if in the Espresso preferences you have the program set to use spaces instead of tabs with four spaces per tab, and the beginning of a line has ten spaces, two of the spaces will be stripped. The action typically handles mixed spaces and tabs intelligently, as well.

Selection actions

Select → Word (command-shift-W)

Immediately selects the current word under the cursor. A word is defined as a collection of alpha-numeric characters or an underscore or dash.

Select → Line (command-shift-L)

Selects the entire line under the cursor, including the linebreak. If there is already a selection, the cursor is defined as the beginning of the selection.

Select → Line Contents (command-option-L)

Selects only the contents of the line under the cursor, excluding all leading and trailing whitespace. Particularly useful given that Espresso doesn’t treat leading whitespace as a word.

Select → Balance (control-B)

Attempts to locate the balanced delimiters around the cursor and select their contents. This action will move outward if you invoke it multiple times. For instance, if you have a paragraph wrapped in a div (pipe represents cursor):

<div><p>My paragraph|.</p></div>

The first time you invoke Balance, My paragraph. will be selected. The second time, <p>My paragraph.</p> will be selected, and so forth. When editing HTML or XML, Balance uses zen coding’s balancing algorithms. When editing other languages, it will attempt to balance your selection using the itemizers (itemizers define the layout of the navigator in Espresso and provide the folding logic, as well). How well Balance functions outside of HTML will result largely in the quality of the itemizer definitions for whichever language you are using.

Select → Balance Inward (control-shift-B)

Much like Balance, this action will attempt to select the balanced delimiters around the cursor. However, it attempts to move inward (in the above example, if your cursor or selection were around the div, Balance Inward would select the paragraph).

Sorting actions

Sorting → Sort Lines (Ascending) and Sorting → Sort Lines (Descending)

As you might expect, these actions sort all lines in the selection (or document, if no selection) in ascending and descending order, respectively.

Sorting → Randomize Lines

This randomly sorts all lines in the selection (or document, if no selection).

Sorting → Remove Duplicate Lines

If for some reason you need to strip all duplicate lines from your selection or document, this is the command for you.

Clicky Web Analytics