Configuration and customization

rsms edited this page Apr 29, 2011 · 23 revisions

Configuration and customization

This article documents how Kod can be customized using different configurations.

Manipulating settings:

Currently Kod does not provide any interface for manipulating settings so you will need to use the defaults tool.

Example of changing or adding a setting:

defaults write se.hunch.kod groupNewDocuments/enabled -bool NO

Example of removing a setting, effectively causing Kod to use it's built-in default:

defaults delete se.hunch.kod groupNewDocuments/enabled

See man defaults for details on how to use the defaults tool.

User interface

Type Name Default value Description
bool groupNewDocuments/enabled YES Enable or disable automatic grouping of new documents
bool groupNewDocuments/byEditDistance YES When using automatic grouping of new documents, employ edit-distance to find "fuzzy" matches
bool window/newTabButton/enable NO Enables a button which appear to the right of the last tab in the tab strip. When clicked, it adds a new tab. Note that enabling this reduces the amount of space available to display tabs in the tab strip.
number window/splitView/position 180.0 Position (or width of the sidebar) split view when not collapsed.
bool window/splitView/collapsed YES Toggle visibility of the left sidebar. Note: This setting is currently ignored when creating new windows and forced to YES when opening a file directory.
bool window/statusBar/hidden NO Toggle visibility of the status bar at the bottom of the window.
number recentDocuments/count 50 Number of recently visited documents to display in the "File > Recent documents" menu. Setting this to zero will disable recording of visited document.
bool window/columnGuide/enabled NO Toggle visibility of a column guide -- a thin vertical line at column window/columnGuide/position
uint window/columnGuide/position 80 What column number to draw a column guide at. E.g. to draw a column after the 80th character, give this a value of 80.

Text editor

Type Name Default value Description
string editor/text/indentation 2×SP A string which is used when adding or removing indentations. For example, if tab characters are preferred, type defaults write se.hunch.kod editor/text/indentation -string "<TAB>" Note: because TAB is typically a special character in the terminal, you must first type <ctrl> + V before pressing the TAB key.
string editor/text/newline "\n" Inserted to terminate new lines
bool editor/indent/newline YES Controls whether Kod performs "magic" when inserting new lines (namely retaining the previous indentation level or not).
bool editor/indent/tabkey YES Enables translating a TAB key press into indentation adjustment. When enabled, using the Shift key modifier decreases the indentation level and holding the Alt key modifier inserts a regular tab character. If disabled, pressing TAB inserts a regular tab character.
bool editor/metaRuler/hidden NO Toggle visibility of the "ruler" (the thing with line numbers). Note: When setting the hasMetaRuler property of a document, this setting is changed to the (inverted) value. Also to be noted is that altering this setting only have an effect on new documents (use the hasMetaRuler property of a current document to toggle the ruler of that document).


Type Name Default value Description
string style/url {}/Contents/Resources/style/default.css URL of the current style.

Reading and writing files (KFileURLHandler)

Type Name Default value Description
bool KFileURLHandler/write/atomic NO Enables "atomic writes" -- writing the file to a temporary location and upon success, hard-re-linking the target filename to the new data written.
bool KFileURLHandler/write/async YES Enables asynchronous writing of files. When enabled, e.g. pressing Cmd+S will make a snapshot of the documents data and then defer the write operation in a background thread. If disabled, the user interface will block during the duration of writing data to disk. If you are saving files to mounted remote file systems, it's not recommended to disable this.

Experimental features and debugging

These flags can be toggled to enable or disable runtime debugging features or experimental features.

Type Name Default value Description
bool debug/astviewer/enabled NO Enable the AST GUI inspector
bool experimental/astparser/incremental NO Enable incremental parsing

Internal state

These are properties used by Kod to keep state. You should not mess around with these from "the outside".

Type Name Default value Description
URL cli/symlink/url "" If non-empty, this is the URL of the "kod" CLI program symbolic link. If this is set, Kod will check the integrity of the link at start-up and offer to repair the symlink if it's missing or points to something else.
bool firstLaunchMarker NO Kod uses this to deduce if it is launching for the first time (for the current user). If the value is NO, Kod will present some introductory material to the user, namely "Would you like to activate the CLI helper?".
string lastLaunchedVersion "" Holds the value of the last launched CFBundleVersion. At launch, Kod compares this value to the current version and presents the changelog if the value changed.