TextWrangler 4.0 Release Notes

This page documents all the new features, enhancements and visible changes included in the TextWrangler 4.0 release.

For information about the changes included in any specific version of TextWrangler, please see the release notes archive.

For detailed information on using any of TextWrangler's features, please refer to the user manual (choose "User Manual" from TextWrangler's Help menu).


TextWrangler 4 requires Mac OS X 10.6 or later (10.6.8 or later recommended).

PowerPC-based Macs are not supported.


  • There is a new folder in Application Support/TextWrangler/, named Setup. It contains data that previously was stored either in the application preferences or in the com.barebones.textwrangler.preferenceData folder that was in ~/Library/Preferences/. Specifically: file filters, FTP/SFTP bookmarks, Grep patterns, and key bindings are stored here.

  • The ability of TextWrangler to search inside of compressed files can now be controlled by a new option in the Multi-File Search window's "Options" sheet: "Search compressed files." When turned off, BBEdit will skip Zip, gz, and bz2 files while searching, even if they may contain compressed text files.

  • The twfind tool has been updated with a new option: -C (or --no-compressed-files), which if present suppresses the searching of Zip/gz/bz2 files as described above.

  • There's a new command on the View menu, "Show File List" (or "Hide File List"). When an MDI window is in front, this command quickly toggles the visibility of the list(s) on the left.

  • Discrete Change Case options are now available on a submenu below the main "Change Case" command.

  • FTP browsers get a "Manage Bookmarks" command, which opens the Setup window and selects the Bookmarks list.

  • The Find and Multi-File Search windows get "Manage Patterns" and "Manage Filters" commands, which open the Setup window and select the Patterns (and Filters, respectively) lists.

  • There's a new command, on the Application menu: "Setup." This opens a window for configuring saved bookmarks, file filters, and Grep patterns. Use the "+" button to add something, "-" to remove it, double-click (or Enter) to edit.

  • The View menu now has commands for toggling the visibility of various sections in the project/MDI file list. (These commands will show or hide the section entirely, versus using the disclosure triangle to collapse or expand them.) You can assign keyboard equivalents in the Menus and Shortcuts preferences, if desired.

  • There's a new expert preference: "AutoShowFileList". By default, it's set to YES, but if you set it to `NO', the file list will not automatically become visible when you open the second document into an editing window:

    defaults write com.barebones.textwrangler AutoShowFileList -bool NO

  • You can now use the "Menus and Shortcuts" preferences pane to assign key shortcuts for Scripts, Stationery, and Text Filters.

  • FTP browsers get a "Kind" column.

  • When MDI is turned on, documents are now opened (or created) in something that looks and behaves substantially like a project window. The Documents Drawer has been retired: use the file list on the left for navigation, or the document menu in the navigation bar. The "Show Documents Drawer" command has been removed from the View menu, the document drawer icon has been removed from the toolbar.

    • The file list is manually reorderable, which addresses a longstanding request from heavy users of the drawer.
  • There is a new preference in the Application preferences, subordinate to "Reopen documents that were open at last quit". The new setting, "Restore unsaved documents", causes TextWrangler to capture any unsaved document contents when you quit (including untitled documents) and restore them when it starts up. If you prefer the previous Quit behavior, turn this preference off.

  • There is a new command on the File menu: "Print Selection". When chosen, it will print the selected range of text in the document.

  • There's a new control in the Editor preferences: "Line Spacing". You can use this to adjust the amount of space between lines of text in editing views. The minimum value is consistent with previous versions of TextWrangler.

  • Verilog and VHDL language modules are now built in. These were previously written by Yasuhisa Kato.

  • The "Text Colors" preferences now add an interface for loading and saving color schemes. The format for color scheme files is the same one used by BBColors and in fact, TextWrangler will import any BBColors files that you have created. Color schemes live in ~/Library/Application Support/TextWrangler/Color Schemes/.

    Note: Using the bbcolors command-line tool to make color changes will have no effect in TextWrangler 4.

  • Added support for the include command/directive in ActionScript files. Included files are now listed in the file inclusions popup.

  • TextWrangler now stores document state for files opened using the built-in FTP/SFTP interface.

  • Simple Emacs repetitions (ctl-U followed by a number) can now be used to insert repetitions of a single character. Try this:

    `ctl-U 80 -`

    (that is, type Control-U, the numeral 80, and then press the "-" key)

  • For languages backed by a codeless language module, TextWrangler now generates fold points for delimited blocks. (A good example of this is the "Go" language module, available at http://www.barebones.com/support/bbedit/plugin_library.html, but there are no doubt others.)

  • The Ruby module now supports the standard callouts for the function popup, including FIXME:, NOTE: REVIEW: TODO: ???: and !!!: Example:

    #NOTE: this block will not work if the moon is full

  • Added ".md" and ".mdown" to the default suffix mappings for Markdown.

  • When doing a "Paste Column", TextWrangler will perform a "fill down" in the selection range if the text being pasted contains no line break (or contains only a single line break at the end).

  • Added "Capfile" to the default name mappings for Ruby.

  • Full-screen mode is supported for editing windows on Mac OS X 10.7. Use the "Enter Full Screen" command on the View menu. (This command is hidden when running on 10.6.x.)

  • The dock menu has a new command: "New Text Document" It creates a new, empty text document in the same location File->New Text Document would have, then pulls TextWrangler to the foreground.

  • The "Show items starting with '.'" switch in FTP browsers is now 'sticky'; whether it is turned on (or off) will be applied for the next time you create an FTP browser or use "Open from FTP/SFTP Server".

  • Callouts (FIXME, TODO, MARK, etc) are now supported in PHP comments.

  • "Open File by Name" has gotten a makeover. The window that opens is now modeless, and you can leave it open while doing other things in TextWrangler. Activating the Open File by Name window (or choosing the menu command) will place keyboard focus in the search box and select its contents, so that you can just start typing. Use the "x" widget to clear your entry.

    As you enter a file name, TextWrangler will search for the name as well as wildcard matches, and present all of the possible matches in the name field's combo box. If the name you enter contains wildcard characters (such as * or ?, e.g. NS*.h or index.*) then the entered name is used as a wildcard pattern. If the name you enter does not contain wildcards, then TextWrangler will use it as a basis for casting a pretty wide net. Searching is capped to a maximum number of matches, so that performance is reasonable while typing in the dialog box. The factory default is 200, and may be adjusted:

    defaults write com.barebones.textwrangler OpenByNameMaxWildcardMatches -int 200

    If you desire, you can enter an absolute path (e.g. /usr/include/stdio.h), a home relative path (~/Library/), or a URL (http, ftp, sftp, and several other schemes are supported internally), and clicking the "Open" button will open the indicated item (assuming it exists).

    Otherwise, if no matches are found for the string you entered, the "Open" button will instead read "Search". Clicking the Search button will search for appropriate matches to the file name: a wildcard match if you employed any wildcard characters when entering the name; or an exact-name match if not.

    There's a search history; when you open a matched item, the string you used is stored. The magnifying glass contains a popup menu listing the recently used strings.

    Fun things to try:

    • Drag the "favicon" from your Web browser's address bar into the edit field, and note that the URL appears there. Now hit the "Open" button.

    • Type "NS*.h" while an Xcode project is open (or while Xcode is running).

    Other notes:

    • Choosing "Open Selection" (which is available when appropriate text is selected in the front editing view) will now bring up the Open File by Name window, and populate the search box with the selected text (and the search results, if any).

    • The contents of the search box are now accessible via the scripting interface, as the search string property:

      `get search string of open file by name window`
      `set search string of open file by name window to "Hello World"`

      Changing the search string will update the results.

  • There's a new script attachment point for documents: documentShouldFinalizeAuthenticatedSave. This gets called in cases where an authenticated save is necessary (for text documents only). An attachment script for this purpose might look like this (the comments are important, so read them!):

on documentShouldFinalizeAuthenticatedSave(theDocument, tempFilePath, destinationPath)

-- on input: tempFilePath points to the contents of the document
-- written to a temp file, ready to move to the destination;
-- destinationPath is where the file should be copied.

-- on exit: if the operation succeeded, delete the temp file (or
-- else the application will assume the operation failed) and
-- return YES for success

--  this is pretty straightforward: "cp tmpFilePath destinationPath"

do shell script "cp" & " " & quoted form of tempFilePath & " " & quoted form of destinationPath with administrator privileges

--  now remove the temp file, this indicates to the application that we did the work

do shell script "rm" & " " & quoted form of tempFilePath

return true

end documentShouldFinalizeAuthenticatedSave

  • The "Strip trailing whitespace" and "Ensure file ends with line break" options can now be configured per-language, if desired.

  • Added a "Privacy" button in the Application preferences for non-App Store builds, linked to the privacy policy on our web site.


  • TextWrangler now requires Mac OS X 10.6.

  • Made some pretty significant changes to the way scripts and filters are installed and managed:

    1. The artificial separation between different types of scripts (i.e. AppleScript and Unix scripts) is gone.

    2. There are two fundamental types of runnable file: "text filters", which accept the selection range (or entire document, if no selection) as input, and which return text that replaces the selection range (or document); and "scripts", which do neither. In unix-y terms, text filters accept the selection range on STDIN, and STDOUT replaces the selection range.

    3. The arrangement in the Application Support/TextWrangler/ folder is as follows:

      • Scripts: contains executable Unix files and AppleScript filesworkflows. These are run simply by loading the item and calling it directly, without providing any inputs. (Naturally, AppleScript scripts can query the application, and #! scripts have some information passed to argc and argv as usual.)

      • Text Filters: contains the same type of items as Scripts, but when chosen, the selected text (or front document contents, if there is no selection) is passed as argv[1] to Unix executables, as a reference to a RunFromBBEdit entry point in AppleScripts.

        If an AppleScript script does not have a RunFromBBEdit entry point, TextWrangler will call its run handler, again passing a reference to the current selection range. AppleScript scripts are expected to return a string which will replace the selection range; #! scripts should write to STDOUT, and the contents of STDOUT will replace the selection range.

      Thus, both folders can contain identical items, but how an item is invoked, and the effect that it has on the front document, will depend solely on which folder it lives in at the time of invocation.

    4. The menu arrangement is as follows: the Scripts menu (and palette) contains all eligible items from the Scripts folder. The "Unix Scripts" and "Unix Filters" items have been removed from the #! menu (and their palettes from the Window menu). The Text Factories menu has been removed. (Text Factory execution is no longer supported.) The "Apply Text Factory" commands on the Text menu are renamed to "Apply Text Filter", and are now at the top of the Text menu. The "Apply Text Filter" submenu shows all eligible items contained in the Text Filters folder.

  • NB: Text Factory execution is no longer supported.

  • When starting up, TextWrangler 4 will copy items from your Unix Scripts and Unix Filters folders into your Scripts and Text Filters folders, as appropriate. TextWrangler leaves a cookie behind in its Application Support folder to indicate that this has been done.

  • The old modal Find dialog is gone.

  • The Super Get Info icon has been removed from the toolbar, and the "Open in Super Get Info" command has been removed from the View menu.

  • Unix filters now operate as "pure" text filters: they take the selection as input (a path to a temporary file is passed as the first argument), and replace the selection with stdout. If anything is present on stderr, then the selection is not replaced, and the output is instead placed in the Unix Script Output window (as well as being parsed for errors). This was the default behavior before; it is the only behavior now.

  • The old "what to do with unknown file types" expert pref has been disconnected and is no longer supported. If a file's name matches an extension-to-language mapping in the Languages preferences, or if its name maps to something the system recognizes as text, then we'll treat it as a text file; otherwise we won't. This change primarily affects file filtering, as used during multi-file search and replace, folder comparison, disk browser and project lists, and various other places.

  • The Languages preferences have been reworked and re-imagined. Rather than presenting an overwhelming list of installed languages and filename extension mappings, per-language settings (including color schemes) and extension mappings are now handled on a "customizing" basis.

    So, instead of having to root around for a language and then dig through its settings to manipulate them, and then figure out which ones should be different from factory settings, all you need to do is add a customization for that language, by using the "+" popup menu under the "Custom Language Preferences" list, adjust the settings in the sheet, and you're done.

    Similarly, if you find that a file name extension isn't being mapped to your desired language, just add it in the "Custom Extension Mappings" list. Custom mappings will always take precedence over built-in mappings if there's a conflict.

    The list of installed languages and versions no longer takes up space in the preferences window. as before, they're listed in the About box. In addition, the new "Installed Languages" button in the Languages preferences will display a list of installed languages and versions, as well as the default extension mappings for that language.

  • The Find Differences dialog box has been rewritten and modernized.

  • "Save Default Window" on the Window menu now shows the type name of the window whose defaults you are saving: "Save Default Text Window", "Save Default FTP Browser", etc.

  • The "Unix Scripting Tools" palette has been consigned to the dustbin of history.

  • The "Run..." command on the #! menu is now visible at all times, instead of being buried behind an alternate modifier.

  • The UI for creating and editing file filters has been completely rewritten.

  • Filename extensions are now hidden on the Scripts menu/palette as well as on the Text Filters menu/palette.

  • The "Arrange..." command on the Window menu has been replaced with a simple "Arrange", which cascades windows down and to the right, in customary fashion. Hold down the Option key, and "Arrange" changes to to "Tile Two Front Windows" (and does just that).

  • The "Get Info" command and its associated toolbar icon have been retired. (All of the relevant information is presented directly in the editing view itself, except for pagination, and if you care about that, you can run a print preview...)

  • Single-click line selection is now on by default.

  • The Text Statistics status bar display now automatically toggles between selection-only and whole-document display: when there is a selection, it'll show status for the selection; when there isn't, for the whole document.

  • The "Text Printing" settings have been removed from the Print dialog. This is to improve compatibility with current versions of Mac OS X, and to ensure compatibility with future versions of the OS. You can still modify the settings using the "Printing Options" command on the Edit menu.

  • The "Print Watermark" (or "rubber stamp") option has been removed; the system provides a facility which is actually more featureful, so the built-in feature is no longer required.

  • The system key equivalent for "Enter Full Screen" is Cmd-Option-F, which was also the factory default for "Live Search". We must perforce give way, so Live Search is now Cmd-Control-F by default. As always, both of these may be adjusted to taste in the "Menus & Shortcuts" preferences.

  • The preference system's internals have been extensively reworked, and the Preferences window has been completely rewritten and reimagined. Many obsolete preferences, as well as settings never used in daily operation, have been removed from the GUI. The name space has been overhauled, so virtually every preference key has been renamed. Existing preferences are converted where appropriate. The conversion is non-destructive, so old settings are left in place (but will never change).

  • Safe saves are now off by default. The benefits are abstract, but because the system's implementation changes file permissions and breaks hard links, the downsides (when encountered) outweigh the (abstract) benefits.

  • The "Text Files Only" filtering in disk browsers now looks inside of files if necessary, for improved filtering accuracy. This may be disabled (restoring the behavior of previous versions) with an expert preference:

    defaults write com.barebones.textwrangler InspectTextFileContentsForListFiltering -bool NO

  • JavaScript and ActionScript now have separate preferences to control the display of anonymous functions in the function popup.

    defaults write com.barebones.textwrangler ShowAnonymousFunctions_JavaScript -bool yes defaults write com.barebones.textwrangler ShowAnonymousFunctions_ActionScript -bool yes

  • Tools (and their man pages) are no longer copied to /usr/local/bin, but are instead symlinked out of the bundle to those locations. Thus, updating the application automatically updates the tools, once the symlinks are installed.

  • Shift-key at startup no longer suppresses the loading of #! menu content.

  • Saved window positions for "property" windows (in which there is only one in the application, such as the Find window, or any of the floating windows) are now keyed by display configuration, for the convenience of those using the application on laptops that spend part of their time connected to an external display.

  • The option dialogs for "Run" and "Run…" on the #! menu have been modernized.

  • Made the spelling panel accessory checkbox a little less unnaturally large.

  • Vertical scrollbars in list views are now hidden when they're not required.

  • Unix filters (run from the "Apply Text Filter" menu) now accept the selection on STDIN. This is a change from previous versions, in which TextWrangler wrote a temporary file and passed it as argv[0]. If you have any Unix scripts in the "Text Filters" folder, you will need to modify them in order for them to continue working. On the other hand, this change will generally make Unix filters easier to write, and makes it possible to share Unix filters with BBEdit text factories where desired, because the latter has run their filters this way since forever.

  • When entering full screen mode, document windows are now sized to the same width as they were before entering full screen mode, which preserves the "distraction free" semantics of full screen mode.

    If you want your full-screen windows to consume screen real estate like a hungry wumpus, you can hold down the Command key while clicking on the "enter full screen" widget, or use an expert preference:

    defaults write com.barebones.textwrangler FullScreenWindowsHogScreen -bool YES

  • Support for reading QuickTime movies has been removed (it was off by default, anyway).

  • Added support for the emacs esc-T (transpose-words) gesture.

  • TextWrangler now makes a reasonable guess at a filename extension when using "Save As" for a new document.

    Language modules can specify a "BBLMPreferredFilenameExtension" key, with a string value. This will be used if necessary. If it is absent, the first item in the BBLMSuffixMap array is used.

    You can also use an expert preference to set the preferred extension on a per-language basis:

    defaults write com.barebones.textwrangler PreferredFilenameExtension_<LanguageName> -string "abc"

    Replace <LanguageName> with the actual language name; for example:

    defaults write com.barebones.textwrangler PreferredFilenameExtension_C++ -string "cxx" defaults write com.barebones.textwrangler PreferredFilenameExtension_YAML -string "yaml"

    Note that the extension you specify should not include the leading period.

  • The user manual is no longer included in the application package. When you choose "User Manual" from the help menu, the application will download the proper user manual PDF and store it in the Application Support folder. (Thus, it only needs to download the PDF once, unless you remove it or update to a new version.)

  • The "Open the User Manual" option has been removed from the first run dialog.

  • The file filter menu used in disk browsers and project windows has been reworked to make it a little more useful. The options are now:

    • All Available: When selected, an item is listed if TextWrangler recognizes it as one of its own document types. This includes text files, images, and so on.

    • Text Files Only: Only text files will be listed.

    • Everything: Every item is listed, including invisible files and folders.

  • The default keyboard equivalent for "Un/Comment Selection" is now Command-/, for consistency with Xcode.

  • When using Un/Comment, if nothing is selected, TextWrangler will apply the line-comment delimiter to the entire line containing the insertion point. If you preferred the old behavior:

    defaults write com.barebones.textwrangler CommentWholeLineWithInsertionPoint -bool NO

    The PreferLineCommentsWhenCommenting expert preference now defaults to YES (and it is documented in the Expert Preferences help now), so TextWrangler will prefer to use the language's line-comment delimiter whenever possible.