There are a number of behaviors in TextWrangler for which there are no UI controls in the Preferences window; this is typically because the settings are so obscure that placing them in the Preferences window would just make it complicated. In fact, some of these settings were in the Preferences window, and have been removed in order to simplify the interface; in such cases, any changes you made previously will be honored, even though the UI in the Preferences window is gone.
Note: Adjusting the settings described here involves using the Unix command line (in the Terminal or a suitable replacement). Most changes will not have any immediate visible effect, but will instead take effect the next time you perform a relevant action, or, at the latest, after quitting and restarting TextWrangler.
TextWrangler supports "camel case" navigation: press Control-left-arrow or Control-right-arrow to jump to the next (or previous) transition from lower-case to upper-case characters (or a word boundary, whichever comes first).
Note that this use of Control-left-arrow and Control-right-arrow replaces the pre-8.5 behavior of using these key combinations to scroll horizontally. If you prefer the old behavior, you can do the following from the command line:
defaults write com.barebones.textwrangler Editor_ControlArrowCamelCase -bool NO
defaults write com.barebones.textwrangler Editor_ControlArrowHScroll -bool YES
When you backspace from the insertion point, TextWrangler will delete a tab stop's worth of spaces if there are only spaces (and tabs) between the insertion point and the start of the line on which you're editing. This may be disabled by an expert preference if desired:
defaults write com.barebones.textwrangler Editor_DeleteIndentationWhitespaceToTabStop -bool NO
Automatic word counting is disabled for documents over a set size threshold, in order to avoid needless delays when working on very large documents. The factory default is 16M characters, but you may change this limit as desired using the following expert preference:
defaults write com.barebones.textwrangler Editor_AutoWordCountSizeThreshold -int 16777216
# Setting it to zero disables the limit check entirely.
Since "Find All Misspelled Words" is pretty much pointless on files over a certain size, the maximum amount of text checked by this command is limited to 1M (1024 squared) characters. This may be adjusted with an expert preference:
defaults write com.barebones.textwrangler Editor_SpellCheckLengthLimit -int NN
where "NN" is some decimal value. Use -int 0
to suppress the limit altogether.
Text completions that depend on examining the document's contents (both for tokens in the document, and for possible completions from the system spelling checker) are now skipped when the document is above a certain size. The cutoff can be adjusted:
defaults write com.barebones.textwrangler MaxDocumentLengthForCompletionTokenizer -int N
where "NN" is some decimal value. Use -int 0
to suppress the limit altogether.
By default, the "Balance" command (or double-clicking on a delimiter to balance) does not include the delimiters in the resulting selection. If you would like for it to do so:
defaults write com.barebones.textwrangler BalanceIncludesDelimiters -bool YES
When using the Un/Comment command, TextWrangler will use the line comment delimiter for the document's language whenever possible. If you would prefer to use block comments whenever possible:
defaults write com.barebones.textwrangler PreferLineCommentsWhenCommenting -bool NO
When using the Un/Comment command, if nothing is selected, TextWrangler will use the line comment delimiter to comment (or uncomment) the entire line. If you would prefer that TextWrangler insert the line-comment delimiter at the insertion point instead:
defaults write com.barebones.textwrangler CommentWholeLineWithInsertionPoint -bool NO
Settings are available for disabling passive FTP, in order to deal with hosts that misbehave when sent the PASV
command.
Passive FTP can be disabled per host, per domain, or globally:
# only for "foobar.example.com"
defaults write com.barebones.textwrangler DisablePassiveFTP:foobar.example.com -bool YES
# only for servers in "example.com"
defaults write com.barebones.textwrangler DisablePassiveFTP:example.com -bool YES
# global preference
defaults write com.barebones.textwrangler DisablePassiveFTP -bool YES
Our recommendation is that you disable per host in preference to globally or per-domain.
Some servers don't work correctly when SSH compression is enabled. To work around this, SSH compression can be disabled per host, per domain, or globally:
# only for "foobar.example.com"
defaults write com.barebones.textwrangler EnableSSHCompression:foobar.example.com -bool NO
# only for servers in "example.com"
defaults write com.barebones.textwrangler EnableSSHCompression:example.com -bool NO
# global preference
defaults write com.barebones.textwrangler EnableSSHCompression -bool NO
Our recommendation is that you disable per host in preference to globally or per-domain.
Most of the time, the default timeout for connecting to an SFTP server will suffice; however, if the server is heavily loaded it may take longer to respond. To adjust the SFTP connection timeout:
# set the timeout to 20 seconds -- note that "-int" is required
defaults write com.barebones.textwrangler SFTPConnectionTimeout -int 20
To control whether TextWrangler hides palettes when arranging windows after a Find Differences operation:
defaults write com.barebones.textwrangler DifferencesResults_HidePalettes -bool YES
To control whether TextWrangler keeps the differences results and document windows arranged when clicking on an item in a differences window:
defaults write com.barebones.textwrangler DifferencesResults_KeepWindowsArranged -bool YES
When comparing text files, TextWrangler will canonicalize RCS keywords to their unexpanded state, so that the values of RCS keywords are not significant to the differences calculations. If you wish, you can disable this, so that any change in the RCS keywords on a line will cause the line to appear in the differences:
# Ignore variances in RCS keyword values when comparing
defaults write com.barebones.textwrangler Diff_IgnoreRCSKeywords -bool NO
By default, TextWrangler will open AppleScript files using whatever application the OS claims is capable of doing so. If you wish to override this, change the "ScriptEditorBundleID" preference to the bundle ID of your preferred script editor. For example, to set the script editor to Script Debugger:
defaults write com.barebones.textwrangler ScriptEditorBundleID com.latenightsw.ScriptDebugger
The "Run in Terminal" and "Go Here in Terminal" commands will use Apple's "Terminal" application by default. If you would like to use a different one:
defaults write com.barebones.textwrangler TerminalBundleID -string "com.example.TerminalAppBundleID"
(Use the actual terminal's bundle ID in place of "com.example.TerminalAppBundleID"…)
If you like, you can set the default language for new untitled documents:
defaults write com.barebones.textwrangler DefaultLanguageNameForNewDocuments -string "<language name>"
"<language name>
" should be the name of a language shown as installed in the Language preferences. For example, if you want your new documents to be Markdown:
defaults write com.barebones.textwrangler DefaultLanguageNameForNewDocuments -string "Markdown"
Most of the factory supplied language modules generate fold ranges for any brace-delimited block that has at least one line, but to reduce noise, only block folds that have at least four lines are shown in editing windows. You can adjust this from the command line, using a language-specific preference key, which consists of "MinimumLinesForBlockFold_" (note the underscore) and the language name; for example:
defaults write com.barebones.textwrangler MinimumLinesForBlockFold_Objective-C
defaults write com.barebones.textwrangler MinimumLinesForBlockFold_Objective-C++ 4
defaults write com.barebones.textwrangler MinimumLinesForBlockFold_JavaScript 4
The C/C++/ObjC/ObjC++ language modules will generate entries in the function popup menu for prototypes (including forward declarations in classes, and some other constructs). If you don't wish to see these entries, you can turn them off:
defaults write com.barebones.textwrangler FunctionMenuShowFunctionPrototypes -bool NO
#do not include function prototypes in the menu
By default, items on the function popup menu are sorted by the order of their appearance in the file, and you can hold down the Shift key when clicking on the current function display to sort them by name instead. You can reverse the behaviors but setting sort-by-name as the default, in which case holding the Shift key down will sort the function menu by order in the file:
defaults write com.barebones.textwrangler FunctionMenuSortItemsByName -bool YES #sort the menu by name
Here are some language-specific settings for PHP. The settings with "Opaque" in their names refer to how certain structures are treated when scanning PHP code that's embedded in HTML; when the preference is YES (the factory default in most cases), the corresponding structure is skipped so that any syntactic elements within it are ignored. When the preference is NO, the comment/string/etc delimiters are ignored and the structure's contents are interpreted. (This is generally not desirable, but currently preserved for legacy compatibility.)
defaults write com.barebones.textwrangler OpaqueStrings_PHP -bool NO
defaults write com.barebones.textwrangler OpaqueBlockComments_PHP -bool NO
defaults write com.barebones.textwrangler OpaqueLineComments_PHP -bool NO
defaults write com.barebones.textwrangler OpaqueHereDoc_PHP -bool NO
If you want variables to appear in the function menu in PHP documents:
defaults write com.barebones.textwrangler ShowVariablesInFunctionList_PHP -bool YES
TextWrangler ordinarily recognizes image files as images, and will open them into image windows (or ignore them when filtering for text files). To have images possibly treated as text files (which can be potentially dangerous):
defaults write com.barebones.textwrangler QuickTimeImages -bool NO
By default, PDFs are considered text files and so may be opened and searched along with all other text files. To have PDFs treated as a special file type (they will be ignored for any operation that requires a text file):
defaults write com.barebones.textwrangler OpenPDFsAsText -bool NO
To control whether TextWrangler warns you when opening a malformed UTF-8 file:
defaults write com.barebones.textwrangler WarnMalformedUTF8 -bool YES
Ordinarily, TextWrangler will only ask you to choose a file's encoding when it can't otherwise figure out what the encoding is, and your "if the file's encoding can't be guessed" preference is a UTF-8 or UTF-16 variant. This should be fine for general use, but if for some reason you always want TextWrangler to ask you when it can't guess a file's encoding, even if your preference would do the job, you can:
defaults write com.barebones.textwrangler AskForUnguessableFileEncoding -bool YES
Beginning with version 3.5, TextWrangler stores document state (window position and various settings) in a central repository in your TextWrangler preferences folder. If you wish, you can ask TextWrangler to store document state in the resource fork of the document's file:
defaults write com.barebones.textwrangler UseResourceForkForDocumentState -bool YES
By default, TextWrangler will not store document state for documents located in any of the canonical locations for temporary files. (This also includes the "svn-commit.tmp" files used for Subversion commits.) If desired, you can change this::
defaults write com.barebones.textwrangler SaveDocumentStateForTempFiles -bool YES
By default, TextWrangler will avoid writing extended attributes (HFS Type/Creator) to volumes which don't natively support them (i.e. to avoid creating the ._FILE) when it is safe to do so (i.e. we'll be able to re-open the document correctly later.) If desired, you can fine-tune this behavior:
defaults write com.barebones.textwrangler WriteExtendedAttributes <value>
“value” should be one of the following:
Always: Always write the HFS file type and creator (the pre-8.6 behavior)
Never: Never set the HFS file type and creator (even if the document’s volume supports it).
Smart: Write HFS file type and creator only if the document’s volume supports it
For text documents whose size exceeds a certain threshold (expressed in bytes, factory default 1MB), TextWrangler will ignore the Soft Wrap Text preference and leave wrapping off in order to improve the performance of opening very large files. The threshold may be adjusted if desired:
defaults write com.barebones.textwrangler Editor_SoftWrapLengthThreshold -int 1048576
If you set the limit to zero, TextWrangler will always honor the Soft Wrap Text preference, even in situations where soft-wrapping a large file may cause it to take a very long time to open.
Document auto-save (for crash recovery) is on by default, with a save interval of one minute. To change either setting:
defaults write com.barebones.textwrangler EnableAutoSave_v2 -bool YES
defaults write com.barebones.textwrangler AutoSaveIntervalInMinutes_v2 -int 10
The "Sleep" command does not save any documents in place, since it creates an auto-save file for any open documents with unsaved changes. However, if you want TextWrangler to save any titled (i.e. opened from an existing file) documents to disk before sleeping, you can do so as follows:
defaults write com.barebones.textwrangler SaveTitledDocumentsBeforeSleeping -bool YES
TextWrangler provides control over whether documents on remote servers (FTP/SFTP) or unmounted volumes are opened when automatically reopening documents at application startup. You can modify its behavior with these settings:
defaults write com.barebones.textwrangler AllowVolumeMountDuringStateRestore -bool YES
# If set to YES, TextWrangler will not attempt to mount a volume
# containing a document it wants to reopen. defaults to NO.
defaults write com.barebones.textwrangler ReopenRemoteDocuments -bool YES
# If set to NO, TextWrangler will not attempt to open any documents
# that were opened from FTP/SFTP servers. Defaults to YES.
defaults write com.barebones.textwrangler PromptToReopenRemoteDocuments - bool YES
# If set to YES (the default), TextWrangler will prompt to give you the
# opportunity to skip remote documents.
# If set to NO, TextWrangler will open remote documents without
# asking, if ReopenRemoteDocuments is set to YES.
# Has no effect if ReopenRemoteDocuments is set to NO.
Whether or not TextWrangler uses font smoothing (anti-aliasing) may be adjusted separately for fixed-width and for proportional fonts:
defaults write com.barebones.textwrangler FixedWidthFontSmoothingThreshold -int 10
defaults write com.barebones.textwrangler FontSmoothingThreshold -int 4
The factory default smoothing thresholds are 10pt for fixed width fonts, and 4pt for proportional fonts, respectively. Font sizes above the specified threshold are smoothed; font sizes below the threshold are not.
By default, TextWrangler uses separate colors for HTML/XML attribute names and for their values. If you prefer a single color for all parts of a tag:
defaults write com.barebones.textwrangler UseDistinctColorsForHTMLAttributesAndValues -bool NO
Like many Mac OS X applications, TextWrangler supports the "Find Scrap", a feature of the OS that enables sharing of the "search for" string between applications. Some applications put inappropriate content (such as Web search strings) on the Find Scrap, which can cause the "search for" string in TextWrangler's Find dialog to be replaced when you didn't expect it.
To tell TextWrangler not to import the Find Scrap into its Find window, nor to export the "search for" string to the Find Scrap:
defaults write com.barebones.textwrangler FindDialog_UsesFindScrap -bool NO
Ordinarily, TextWrangler will color the search and replace patterns in the Find window. To disable coloring of these patterns:
defaults write com.barebones.textwrangler FindDialog_ColorGrepSyntax -bool NO
The Live Search bar is not visible by default, but appears when you choose "Live Search" from the Search menu. If you would like the Live Search bar to be visible in each new document that you create or open:
defaults write com.barebones.textwrangler Editor_AlwaysOpenQuickFind -bool YES
When performing a single-file "Replace All" operation, TextWrangler will show a confirmation sheet showing the number of replacements performed. If you would prefer not to see this confirmation, you can suppress it:
defaults write com.barebones.textwrangler ReportReplaceAllResults -bool NO
If you want to amaze and impress your friends and family with just how fast TextWrangler's Replace All is, there's an expert preference for that:
defaults write com.barebones.textwrangler ReplaceAllResultsIncludeTiming -bool YES
When turned on, the sheet (or growl notification) will display the amount of time required for the Replace All operation.
By default, an editing window opens with the file list hidden, and automatically makes it visible when you open a second document into the same window. If you would prefer for the file list to always stay hidden:
defaults write com.barebones.textwrangler AutoShowFileList -bool NO
On the other hand, if you want the file list to always be visible when you make a new editing window, you can do that as well:
defaults write com.barebones.textwrangler AlwaysShowFileList -bool YES
When using the "Previous Document" and "Next Document" commands on the View menu, or the navigation arrows in the navigation bar, the order in which TextWrangler navigates documents is determined by the order in which they were opened. If you prefer, these commands can be made to navigate the documents in the order shown in the file list.
defaults write com.barebones.textwrangler SurfNextPreviousInDisplayOrder -bool YES
TextWrangler attempts to move windows as little as possible when you zoom them. To override this and let TextWrangler place the window in the upper left-hand corner of the screen:
defaults write com.barebones.textwrangler ZoomWindowsInPlace -bool NO
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 prefer that a window in full-screen mode always occupy the entire display width, then you may do so:
defaults write com.barebones.textwrangler FullScreenWindowsHogScreen -bool YES
The "Remember the ... most recently used items" setting in the Application preferences applies to all item types. So, if it's set to 15, TextWrangler will remember 15 text documents, 15 folders, 15 images, and so on. If you want finer control, you can construct an expert pref using the name of the document type as it appears in the menu (and if that name contains spaces, you'll need to quote it). So, for example, if you only wanted to remember the ten most recent folders:
# remember only the ten most recent folders
defaults write com.barebones.textwrangler NSRecentDocumentsLimit:Folders -int 10
Or only the most recent shell worksheet:
# remember only the most recent worksheet
defaults write com.barebones.textwrangler "NSRecentDocumentsLimit:Shell Worksheets" -int 1
If you don't want to remember any recent documents of a particular type (they won't appear in the menu, either), you can set its limit to zero:
# don't remember any images
defaults write com.barebones.textwrangler NSRecentDocumentsLimit:Images -int 0
You can also control the number of items shown in the “Most Recently Used” group:
# Show up to 15 items in the “Most Recently Used” group:
defaults write com.barebones.textwrangler MostRecentItemsGroupLimit -int 15
Note that when setting any recent items limit, you must set it as an integer, using "-int <some number>
".
By default, TextWrangler does not remember recent items opened from any of the canonical locations for temporary files. (This also includes the "svn-commit.tmp" files used for Subversion commits.) If desired, you can change this:
defaults write com.barebones.textwrangler RecentItems_RememberTempFiles -bool YES
TextWrangler will warn you when opening a larger-than-normal number of items, just in case that isn't what you intended to do. The threshold can be adjusted:
defaults write com.barebones.textwrangler LotsOfFilesThreshold -int 24
Note that when setting this limit, you must set it as an integer, using "-int <some number>
". Use "-int 0
" to suppress the warning entirely.
By default, TextWrangler calibrates the vertical scrollbar so that the last line in the document is at the bottom of the window. If you wish, you can configure it to leave space after the last line, either half of the window's height or all of the window's height (less one line, so that the last line in the document is at the top of the window when scrolled all the way to the end). To set this:
# half of the window height
defaults write com.barebones.textwrangler ExtraSpaceInTextViews -string "EShp"
# all of the window height, less one line
defaults write com.barebones.textwrangler ExtraSpaceInTextViews -string "ESfp"
# no extra space (factory default)
defaults write com.barebones.textwrangler ExtraSpaceInTextViews -string "ESNo"
Ordinarily, the application will use the current editing view's font (at reduced size) for the numbers in the Line Numbers bar. If you would instead prefer to use the miniature system font at fixed size:
defaults write com.barebones.textwrangler UseEditorFontForLineBar -bool NO
When searching for matches, Open File by Name limits the number of matches to a reasonable maximum. The factory default is 200, and may be adjusted:
defaults write com.barebones.textwrangler OpenByNameMaxWildcardMatches -int 200