+/**
+ * ENVIRONMENT VARIABLES
+ * ---------------------
+ * Several options related to the interface with git can be configured
+ * via environment options.
+ *
+ * Repository references
+ * ~~~~~~~~~~~~~~~~~~~~~
+ * Commits that are referenced by tags and branch heads will be marked
+ * by the reference name surrounded by '[' and ']':
+ *
+ * 2006-03-26 19:42 Petr Baudis | [cogito-0.17.1] Cogito 0.17.1
+ *
+ * If you want to filter out certain directories under `.git/refs/`, say
+ * `tmp` you can do it by setting the following variable:
+ *
+ * $ TIG_LS_REMOTE="git ls-remote . | sed /\/tmp\//d" tig
+ *
+ * Or set the variable permanently in your environment.
+ *
+ * TIG_LS_REMOTE::
+ * Set command for retrieving all repository references. The command
+ * should output data in the same format as git-ls-remote(1).
+ **/
+
+#define TIG_LS_REMOTE \
+ "git ls-remote . 2>/dev/null"
+
+/**
+ * [[history-commands]]
+ * History commands
+ * ~~~~~~~~~~~~~~~~
+ * It is possible to alter which commands are used for the different views.
+ * If for example you prefer commits in the main view to be sorted by date
+ * and only show 500 commits, use:
+ *
+ * $ TIG_MAIN_CMD="git log --date-order -n500 --pretty=raw %s" tig
+ *
+ * Or set the variable permanently in your environment.
+ *
+ * Notice, how `%s` is used to specify the commit reference. There can
+ * be a maximum of 5 `%s` ref specifications.
+ *
+ * TIG_DIFF_CMD::
+ * The command used for the diff view. By default, git show is used
+ * as a backend.
+ *
+ * TIG_LOG_CMD::
+ * The command used for the log view. If you prefer to have both
+ * author and committer shown in the log view be sure to pass
+ * `--pretty=fuller` to git log.
+ *
+ * TIG_MAIN_CMD::
+ * The command used for the main view. Note, you must always specify
+ * the option: `--pretty=raw` since the main view parser expects to
+ * read that format.
+ **/
+
+#define TIG_DIFF_CMD \
+ "git show --patch-with-stat --find-copies-harder -B -C %s"
+
+#define TIG_LOG_CMD \
+ "git log --cc --stat -n100 %s"
+
+#define TIG_MAIN_CMD \
+ "git log --topo-order --stat --pretty=raw %s"
+
+/* ... silently ignore that the following are also exported. */
+
+#define TIG_HELP_CMD \
+ "man tig 2>/dev/null"
+
+#define TIG_PAGER_CMD \
+ ""
+
+
+/**
+ * FILES
+ * -----
+ * '~/.tig'::
+ * User configuration file. See "<<config-options, Configuration options>>"
+ * section for examples.
+ *
+ * '.git/config'::
+ * Repository config file. Read on startup with the help of
+ * git-repo-config(1).
+ **/
+/**
+ * [[config-options]]
+ * User Configuration file
+ * -----------------------
+ * You can permanently set an option by putting it in the `~/.tig` file.
+ * The file consists of a series of 'commands'. Each
+ * line of the file may contain only one command.
+ *
+ * The hash mark ('#'), or semi-colon (';') is used as a 'comment' character.
+ * All text after the comment character to the end of the line is ignored.
+ * You can use comments to annotate your initialization file.
+ *
+ * Some sample options:
+ *
+ * ==========================================================================
+ * # Diff colors
+ * color diff-header yellow default
+ * color diff-index blue default
+ * color diff-chunk magenta default
+ * # UI colors
+ * color title-blur white blue
+ * color title-focus white blue bold
+ * ==========================================================================
+ *
+ * [[color-options]]
+ * Color options
+ * ~~~~~~~~~~~~~
+ * Color options control highlighting and the user interface styles.
+ * If your terminal supports color, these commands can be used to assign
+ * foreground/backgound combinations to certain areas. Optionally, an
+ * attribute can be given as the last parameter. The syntax is:
+ *
+ * [verse]
+ * ..........................................................................
+ * *color* 'area' 'fgcolor' 'bgcolor' '[attributes]'
+ * ..........................................................................
+ *
+ * Valid colors include: *white*, *black*, *green*, *magenta*, *blue*, *cyan*,
+ * *yellow*, *red*, *default*. Use *default* to refer to the default terminal
+ * colors.
+ **/
+
+static struct int_map color_map[] = {
+#define COLOR_MAP(name) { #name, STRING_SIZE(#name), COLOR_##name }
+ COLOR_MAP(DEFAULT),
+ COLOR_MAP(BLACK),
+ COLOR_MAP(BLUE),
+ COLOR_MAP(CYAN),
+ COLOR_MAP(GREEN),
+ COLOR_MAP(MAGENTA),
+ COLOR_MAP(RED),
+ COLOR_MAP(WHITE),
+ COLOR_MAP(YELLOW),
+};
+
+/**
+ * Valid attributes include: *normal*, *blink*, *bold*, *dim*, *reverse*, *standout*,
+ * and *underline*. Note, not all attributes may be supported by the terminal.
+ **/
+
+static struct int_map attr_map[] = {
+#define ATTR_MAP(name) { #name, STRING_SIZE(#name), A_##name }
+ ATTR_MAP(NORMAL),
+ ATTR_MAP(BLINK),
+ ATTR_MAP(BOLD),
+ ATTR_MAP(DIM),
+ ATTR_MAP(REVERSE),
+ ATTR_MAP(STANDOUT),
+ ATTR_MAP(UNDERLINE),
+};
+
+/**
+ * Valid area names are described below. Note, all names are case-insensitive,
+ * and you may use '-', '_', and '.' interchangeably. So "Diff-Header",
+ * "DIFF_HEADER", and "diff.header" are the same.
+ *
+ * --
+ **/
+#define LINE_INFO \
+/**
+ * Diff markup::
+ *
+ * Options concerning diff start, chunks and lines added and deleted.
+ *
+ * *diff-header*, *diff-chunk*, *diff-add*, *diff-del*
+ **/ \
+LINE(DIFF_HEADER, "diff --git ", COLOR_YELLOW, COLOR_DEFAULT, 0), \
+LINE(DIFF_CHUNK, "@@", COLOR_MAGENTA, COLOR_DEFAULT, 0), \
+LINE(DIFF_ADD, "+", COLOR_GREEN, COLOR_DEFAULT, 0), \
+LINE(DIFF_DEL, "-", COLOR_RED, COLOR_DEFAULT, 0), \
+/**
+ * Enhanced git diff markup::
+ *
+ * Extra diff information emitted by the git diff machinery, such as mode
+ * changes, rename detection, and similarity.
+ *
+ * *diff-oldmode*, *diff-newmode*, *diff-copy-from*, *diff-copy-to*,
+ * *diff-rename-from*, *diff-rename-to*, *diff-similarity* *diff-dissimilarity*
+ * *diff-tree*, *diff-index*
+ **/ \
+LINE(DIFF_INDEX, "index ", COLOR_BLUE, COLOR_DEFAULT, 0), \
+LINE(DIFF_OLDMODE, "old file mode ", COLOR_YELLOW, COLOR_DEFAULT, 0), \
+LINE(DIFF_NEWMODE, "new file mode ", COLOR_YELLOW, COLOR_DEFAULT, 0), \
+LINE(DIFF_COPY_FROM, "copy from", COLOR_YELLOW, COLOR_DEFAULT, 0), \
+LINE(DIFF_COPY_TO, "copy to", COLOR_YELLOW, COLOR_DEFAULT, 0), \
+LINE(DIFF_RENAME_FROM, "rename from", COLOR_YELLOW, COLOR_DEFAULT, 0), \
+LINE(DIFF_RENAME_TO, "rename to", COLOR_YELLOW, COLOR_DEFAULT, 0), \
+LINE(DIFF_SIMILARITY, "similarity ", COLOR_YELLOW, COLOR_DEFAULT, 0), \
+LINE(DIFF_DISSIMILARITY,"dissimilarity ", COLOR_YELLOW, COLOR_DEFAULT, 0), \
+LINE(DIFF_TREE, "diff-tree ", COLOR_BLUE, COLOR_DEFAULT, 0), \
+/**
+ * Pretty print commit headers::
+ *
+ * Commit diffs and the revision logs are usually formatted using pretty
+ * printed headers , unless `--pretty=raw` was given. This includes lines,
+ * such as merge info, commit ID, and author and comitter date.
+ *
+ * *pp-author*, *pp-commit*, *pp-merge*, *pp-date*, *pp-adate*, *pp-cdate*
+ **/ \
+LINE(PP_AUTHOR, "Author: ", COLOR_CYAN, COLOR_DEFAULT, 0), \
+LINE(PP_COMMIT, "Commit: ", COLOR_MAGENTA, COLOR_DEFAULT, 0), \
+LINE(PP_MERGE, "Merge: ", COLOR_BLUE, COLOR_DEFAULT, 0), \
+LINE(PP_DATE, "Date: ", COLOR_YELLOW, COLOR_DEFAULT, 0), \
+LINE(PP_ADATE, "AuthorDate: ", COLOR_YELLOW, COLOR_DEFAULT, 0), \
+LINE(PP_CDATE, "CommitDate: ", COLOR_YELLOW, COLOR_DEFAULT, 0), \
+/**
+ * Raw commit header::
+ *
+ * Usually shown when `--pretty=raw` is given, however 'commit' is pretty
+ * much omnipresent.
+ *
+ * *commit*, *parent*, *tree*, *author*, *committer*
+ **/ \
+LINE(COMMIT, "commit ", COLOR_GREEN, COLOR_DEFAULT, 0), \
+LINE(PARENT, "parent ", COLOR_BLUE, COLOR_DEFAULT, 0), \
+LINE(TREE, "tree ", COLOR_BLUE, COLOR_DEFAULT, 0), \
+LINE(AUTHOR, "author ", COLOR_CYAN, COLOR_DEFAULT, 0), \
+LINE(COMMITTER, "committer ", COLOR_MAGENTA, COLOR_DEFAULT, 0), \
+/**
+ * Commit message::
+ *
+ * For now only `Signed-off-by lines` are colorized.
+ *
+ * *signoff*
+ **/ \
+LINE(SIGNOFF, " Signed-off-by", COLOR_YELLOW, COLOR_DEFAULT, 0), \
+/**
+ * UI colors::
+ *
+ * Colors for text not matching any of the above: *default*
+ *
+ * Status window colors: *status*
+ *
+ * Title window colors: *title-blur*, *title-focus*
+ *
+ * Cursor line colors: *cursor*
+ *
+ * Main view specific: *main-date*, *main-author*, *main-commit*, *main-delim*,
+ * *main-tag*, *main-ref*
+ **/ \
+LINE(DEFAULT, "", COLOR_DEFAULT, COLOR_DEFAULT, A_NORMAL), \
+LINE(CURSOR, "", COLOR_WHITE, COLOR_GREEN, A_BOLD), \
+LINE(STATUS, "", COLOR_GREEN, COLOR_DEFAULT, 0), \
+LINE(TITLE_BLUR, "", COLOR_WHITE, COLOR_BLUE, 0), \
+LINE(TITLE_FOCUS, "", COLOR_WHITE, COLOR_BLUE, A_BOLD), \
+LINE(MAIN_DATE, "", COLOR_BLUE, COLOR_DEFAULT, 0), \
+LINE(MAIN_AUTHOR, "", COLOR_GREEN, COLOR_DEFAULT, 0), \
+LINE(MAIN_COMMIT, "", COLOR_DEFAULT, COLOR_DEFAULT, 0), \
+LINE(MAIN_DELIM, "", COLOR_MAGENTA, COLOR_DEFAULT, 0), \
+LINE(MAIN_TAG, "", COLOR_MAGENTA, COLOR_DEFAULT, A_BOLD), \
+LINE(MAIN_REF, "", COLOR_CYAN, COLOR_DEFAULT, A_BOLD), \
+/**
+ * --
+ **/
+
+