[GH #8] Read git's color settings
[tig.git] / tigrc.5.txt
blob3188ecbe85e2d0bdd199a0df85d0583e2ac503d5
1 tigrc(5)
2 ========
4 NAME
5 ----
6 tigrc - tig configuration file
9 SYNOPSIS
10 --------
11 [verse]
12 *set*   'variable' *=* 'value'
13 *bind*  'keymap' 'key' 'action'
14 *color* 'area' 'fgcolor' 'bgcolor' '[attributes]'
15 *source* 'path'
18 DESCRIPTION
19 -----------
21 You can permanently set an option by putting it in the `~/.tigrc` file.  The
22 file consists of a series of 'commands'.  Each line of the file may contain
23 only one command.
25 The hash mark ('#') is used as a 'comment' character. All text after the
26 comment character to the end of the line is ignored. You can use comments to
27 annotate your initialization file.
29 Alternatively, options can be set by putting them in one of the git
30 configuration files, which are read by tig on startup. See 'git-config(1)' for
31 which files to use.
33 Set command
34 -----------
36 A few selective variables can be configured via the set command. The syntax
37 is:
39 [verse]
40 *set* variables *=* value
42 Examples:
44 --------------------------------------------------------------------------
45 set show-author = abbreviated   # Show abbreviated author names.
46 set show-date = relative        # Show relative commit date.
47 set show-rev-graph = yes        # Show revision graph?
48 set show-refs = yes             # Show references?
49 set read-git-colors = no        # Do not read git's color settings.
50 set show-line-numbers = no      # Show line numbers?
51 set line-number-interval = 5    # Interval between line numbers
52 set horizontal-scroll = 33%     # Scroll 33% of the view width
53 set blame-options = -C -C -C    # Blame lines from other files
54 --------------------------------------------------------------------------
56 Or in the git configuration files:
58 --------------------------------------------------------------------------
59 [tig]
60         show-date = yes         # Show commit date?
61         author-width = 10       # Set width of the author column
62         line-graphics = no      # Disable graphics characters
63         tab-size = 8            # Number of spaces per tab
64 --------------------------------------------------------------------------
66 The type of variables are either bool, int, string, or mixed.
68 Valid bool values::
70         To set a bool variable to true use either "1", "true", or "yes".
71         Any other value will set the variable to false.
73 Valid int values::
75         A non-negative integer.
77 Valid string values::
79         A string of characters. Optionally, use either ' or " as delimiters.
81 Valid mixed values::
83         These values are composites of the above types. The valid values are
84         specified in the description.
86 Variables
87 ~~~~~~~~~
89 The following variables can be set:
91 'author-width' (int)::
93         Width of the author column. When set to 5 or below, the author name
94         will be abbreviated to the author's initials.
97 'filename-width' (int)::
99         Width of the filename column.
101 'blame-options' (string)::
103         A space separated string of extra blame options. Can be used for
104         telling git-blame(1) how to detect the origin of lines. The value
105         is ignored when tig is started in blame mode and given blame options
106         on the command line.
108 'line-graphics' (mixed) [ "ascii" | "default" | "utf8" | bool]::
110         What type of character graphics for line drawing.
112 'line-number-interval' (int)::
114         Interval between line numbers. Note, you have to toggle on line
115         numbering with ".".  The default is to number every fifth line.
117 'horizontal-scroll' (mixed)::
119         Interval to scroll horizontally in each step. Can be specified either
120         as the number of columns, e.g. '5', or as a percentage of the view
121         width, e.g. '33%', where the maximum is 100%. For percentages it is
122         always ensured that at least one column is scrolled. The default is to
123         scroll '50%' of the view width.
125 'read-git-colors' (bool)::
127         Whether to read git's color settings.
129 'show-author' (mixed) ["abbreviated" | "full" | bool]::
131         How to display author names. If set to "abbreviated" author initials
132         will be shown. Can be toggled.
134 'show-filename' (mixed) ["auto" | "always" | bool]::
136         When to display file names. If set to "auto" file names are shown
137         only when needed, e.g. when running: tig blame -C <file>.
139 'show-date' (mixed) ["relative" | "short" | "default" | "local" | bool]::
141         Whether and how to show date. If set to "relative" a relative date will be
142         used, e.g. "2 minutes ago". If set to "short" no time information is
143         shown. If set to "local", localtime(3) is used. Can be toggled.
145 'show-notes' (string)::
147         Argument passed to `git show --notes=`. The empty string means `--notes`.
149 'show-refs' (bool)::
151         Whether to show references (branches, tags, and remotes) in the main
152         view on start-up. Can be toggled.
154 'show-rev-graph' (bool)::
156         Whether to show revision graph in the main view on start-up.
157         Can be toggled. See also line-graphics options.
159 'show-changes' (bool)::
161         Whether to show staged and unstaged changes in the main view.
162         Can be toggled.
164 'split-view-height' (mixed)::
166         Height of the lower view in a split view. Can be specified either as
167         the number of rows, e.g. '5', or as a percentage of the view height,
168         e.g. '80%', where the maximum is 100%. It is always ensured that the
169         smaller of the views is at least four rows high. The default is a view
170         height of '66%'.
172 'status-untracked-dirs' (bool)::
174         Show untracked directories contents in the status view (analog to
175         `git ls-files --directory` option). On by default.
177 'tab-size' (int)::
179         Number of spaces per tab. The default is 8 spaces.
181 'diff-context' (int)::
183         Number of context lines to show for diffs.
185 'ignore-space' (mixed) ["no" | "all" | "some" | "at-eol" | bool]::
187     Ignore space changes in diff view. By default no space changes are ignored.
188     Changing this to "all", "some" or "at-eol" is equivalent to passing
189     "--ignore-all-space", "--ignore-space" or "--ignore-space-at-eol"
190     respectively to `git diff` or `git show`.
192 Bind command
193 ------------
195 Using bind commands keys can be mapped to an action when pressed in a given
196 key map. The syntax is:
198 [verse]
199 *bind* 'keymap' 'key' 'action'
201 Examples:
203 --------------------------------------------------------------------------
204 # A few keybindings
205 bind main w scroll-line-up
206 bind main s scroll-line-down
207 bind main space enter
208 bind diff a previous
209 bind diff d next
210 bind diff b move-first-line
211 # An external command to update from upstream
212 bind generic F !git fetch
213 --------------------------------------------------------------------------
215 Or in the git configuration files:
217 --------------------------------------------------------------------------
218 [tig "bind"]
219         # 'unbind' the default quit key binding
220         main = Q none
221         # Cherry-pick current commit onto current branch
222         generic = C !git cherry-pick %(commit)
223 --------------------------------------------------------------------------
225 Keys are mapped by first searching the keybindings for the current view, then
226 the keybindings for the *generic* keymap, and last the default keybindings.
227 Thus, the view keybindings shadow the generic keybindings which Shadow the
228 built-in keybindings.
232 Keymaps::
234 Valid keymaps are: *main*, *diff*, *log*, *help*, *pager*, *status*, *stage*,
235 *tree*, *blob*, *blame*, *branch*, and *generic*.  Use *generic* to set key
236 mapping in all keymaps.
238 Key values::
240 Key values should never be quoted. Use either the ASCII value or one of the
241 following symbolic key names. Symbolic key names are case insensitive, Use
242 *Hash* to bind to the `#` key, since the hash mark is used as a comment
243 character.
245 *Enter*, *Space*, *Backspace*, *Tab*, *Escape*, *Left*, *Right*, *Up*, *Down*,
246 *Insert*, *Delete*, *Hash*, *Home*, *End*, *PageUp*, *PageDown*, *F1*, *F2*, *F3*,
247 *F4*, *F5*, *F6*, *F7*, *F8*, *F9*, *F10*, *F11*, *F12*.
249 Action names::
251 Valid action names are described below. Note, all names are
252 case-insensitive, and you may use '-', '_', and '.' interchangeably,
253 e.g. "view-main", "View.Main", and "VIEW_MAIN" are the same.
257 Actions
258 ~~~~~~~
260 Apart from the action names listed below, all actions starting with a '!' will
261 be available as an external command. External commands can contain variable
262 names that will be substituted before the command is run. By default, commands
263 are run in the foreground with their console output shown, if they should be
264 run in the background wit no output prefix the command with '@'. Valid
265 variable names are:
267 .Browsing state variables
268 [frame="none",grid="none",cols="25<m,75<"]
269 |=============================================================================
270 |%(head)                |The currently viewed 'head' ID. Defaults to HEAD
271 |%(commit)              |The currently selected commit ID.
272 |%(blob)                |The currently selected blob ID.
273 |%(branch)              |The currently selected branch name.
274 |%(directory)           |The current directory path in the tree view;
275                          empty for the root directory.
276 |%(file)                |The currently selected file.
277 |%(ref)                 |The reference given to blame or HEAD if undefined.
278 |%(revargs)             |The revision arguments passed on the command line.
279 |%(fileargs)            |The file arguments passed on the command line.
280 |%(diffargs)            |The diff options passed on the command line.
281 |=============================================================================
283 As an example, the following external command will save the current commit as
284 a patch file: "!git format-patch -1 %(commit)". If your external command
285 require use of dynamic features, such as subshells, expansion of environment
286 variables and process control, this can be achieved by using a combination of
287 git aliases and tig external commands. The following example entries can be
288 put in either the .gitconfig or .git/config file:
290 --------------------------------------------------------------------------
291 [alias]
292         gitk-bg = !"gitk HEAD --not $(git rev-parse --remotes) &"
293         publish = !"for i in origin public; do git push $i; done"
294 [tig "bind"]
295         # @-prefix means that the console output will not be shown.
296         generic = V !@git gitk-bg
297         generic = > !git publish
298 --------------------------------------------------------------------------
300 .View switching
301 [frame="none",grid="none",cols="25<m,75<"]
302 |=============================================================================
303 |view-main              |Show main view
304 |view-diff              |Show diff view
305 |view-log               |Show log view
306 |view-tree              |Show tree view
307 |view-blob              |Show blob view
308 |view-blame             |Show blame view
309 |view-branch            |Show branch view
310 |view-status            |Show status view
311 |view-stage             |Show stage view
312 |view-pager             |Show pager view
313 |view-help              |Show help page
314 |=============================================================================
316 .View manipulation
317 [frame="none",grid="none",cols="25<m,75<"]
318 |=============================================================================
319 |enter                  |Enter current line and scroll
320 |next                   |Move to next
321 |previous               |Move to previous
322 |parent                 |Move to parent
323 |view-next              |Move focus to next view
324 |refresh                |Reload and refresh view
325 |maximize               |Maximize the current view
326 |view-close             |Close the current view
327 |quit                   |Close all views and quit
328 |=============================================================================
330 .View specific actions
331 [frame="none",grid="none",cols="25<m,75<"]
332 |=============================================================================
333 |status-update          |Update file status
334 |status-merge           |Resolve unmerged file
335 |stage-update-line      |Stage single line
336 |stage-next             |Find next chunk to stage
337 |diff-context-up        |Increase the diff context
338 |diff-context-down      |Decrease the diff context
339 |=============================================================================
341 .Cursor navigation
342 [frame="none",grid="none",cols="25<m,75<"]
343 |=============================================================================
344 |move-up                |Move cursor one line up
345 |move-down              |Move cursor one line down
346 |move-page-down         |Move cursor one page down
347 |move-page-up           |Move cursor one page up
348 |move-first-line        |Move cursor to first line
349 |move-last-line         |Move cursor to last line
350 |=============================================================================
352 .Scrolling
353 [frame="none",grid="none",cols="25<m,75<"]
354 |=============================================================================
355 |scroll-line-up         |Scroll one line up
356 |scroll-line-down       |Scroll one line down
357 |scroll-page-up         |Scroll one page up
358 |scroll-page-down       |Scroll one page down
359 |scroll-first-col       |Scroll to the first column
360 |scroll-left            |Scroll one column left
361 |scroll-right           |Scroll one column right
362 |=============================================================================
364 .Searching
365 [frame="none",grid="none",cols="25<m,75<"]
366 |=============================================================================
367 |search                 |Search the view
368 |search-back            |Search backwards in the view
369 |find-next              |Find next search match
370 |find-prev              |Find previous search match
371 |=============================================================================
373 .Misc
374 [frame="none",grid="none",cols="25<m,75<"]
375 |=============================================================================
376 |prompt                 |Bring up the prompt
377 |screen-redraw          |Redraw the screen
378 |screen-resize          |Resize the screen
379 |show-version           |Show version information
380 |stop-loading           |Stop all loading views
381 |options                |Open options menu
382 |toggle-lineno          |Toggle line numbers
383 |toggle-date            |Toggle date display
384 |toggle-author          |Toggle author display
385 |toggle-filename        |Toggle file name display
386 |toggle-rev-graph       |Toggle revision graph visualization
387 |toggle-graphic         |Toggle (line) graphics mode
388 |toggle-refs            |Toggle reference display
389 |edit                   |Open in editor
390 |none                   |Do nothing
391 |=============================================================================
394 Color command
395 -------------
397 Color commands control highlighting and the user interface styles. If your
398 terminal supports color, these commands can be used to assign foreground and
399 background combinations to certain areas. Optionally, an attribute can be
400 given as the last parameter. The syntax is:
402 [verse]
403 *color* 'area' 'fgcolor' 'bgcolor' '[attributes]'
405 Examples:
407 ------------------------------------------------------------------------------
408 # Overwrite the default terminal colors to white on black.
409 color default           white   black
410 # Diff colors
411 color diff-header       yellow  default
412 color diff-index        blue    default
413 color diff-chunk        magenta default
414 color "Reported-by:"    green   default
415 --------------------------------------------------------------------------
417 Or in the git configuration files:
419 --------------------------------------------------------------------------
420 [tig "color"]
421         # A strange looking cursor line
422         cursor          red     default underline
423         # UI colors
424         title-blur      white   blue
425         title-focus     white   blue    bold
426 ------------------------------------------------------------------------------
428 Area names::
430         Can be either a built-in area name or a custom quoted string. The
431         latter allows custom color rules to be added for lines matching a
432         quoted string.
433         Valid built-in area names are described below. Note, all names are
434         case-insensitive, and you may use '-', '_', and '.' interchangeably,
435         e.g. "Diff-Header", "DIFF_HEADER", and "diff.header" are the same.
437 Color names::
439         Valid colors include: *white*, *black*, *green*, *magenta*, *blue*,
440         *cyan*, *yellow*, *red*, *default*. Use *default* to refer to the
441         default terminal colors. This is recommended for background colors if
442         you are using a terminal with a transparent background.
444 Colors can also be specified using the keywords color0, color1, ..., colorN-1
445 (N being the number of colors supported by your terminal). This is useful when
446 you remap the colors for your display or want to enable colors supported by
447 256-color terminals.
449 Attribute names::
451         Valid attributes include: *normal*, *blink*, *bold*, *dim*, *reverse*,
452         *standout*, and *underline*. Note, not all attributes may be supported
453         by the terminal.
455 UI colors
456 ~~~~~~~~~
458 The colors and attributes to be used for the text that is not highlighted or
459 that specify the use of the default terminal colors can be controlled by
460 setting the *default* color option.
462 .General
463 [frame="none",grid="none",cols="25<m,75<"]
464 |=============================================================================
465 |default                |Overwrite default terminal colors (see above).
466 |cursor                 |The cursor line.
467 |status                 |The status window showing info messages.
468 |title-focus            |The title window for the current view.
469 |title-blur             |The title window of any backgrounded view.
470 |delimiter              |Delimiter shown for truncated lines.
471 |line-number            |Line numbers.
472 |date                   |The commit date.
473 |author                 |The commit author.
474 |mode                   |The file mode holding the permissions and type.
475 |=============================================================================
477 .Main view colors
478 [frame="none",grid="none",cols="25<m,75<"]
479 |=============================================================================
480 |graph-commit           |The commit dot in the revising graph.
481 |palette-[0-6]          |7 different colors,
482 used for distinguishing branches or commits.
483 example: palette-0 = red
484 |main-commit            |The commit comment.
485 |main-head              |Label of the current branch.
486 |main-remote            |Label of a remote.
487 |main-tracked           |Label of the remote tracked by the current branch.
488 |main-tag               |Label of a signed tag.
489 |main-local-tag         |Label of a local tag.
490 |main-ref               |Label of any other reference.
491 |=============================================================================
493 .Status view
494 [frame="none",grid="none",cols="25<m,75<"]
495 |=============================================================================
496 |stat-head              |The "On branch"-line.
497 |stat-section           |Status section titles,
498 |stat-staged            |Status flag of staged files.
499 |stat-unstaged          |Status flag of unstaged files.
500 |stat-untracked         |Status flag of untracked files.
501 |=============================================================================
503 .Blame view
504 [frame="none",grid="none",cols="25<m,75<"]
505 |=============================================================================
506 |blame-id               |The commit ID.
507 |=============================================================================
509 .Tree view
510 [frame="none",grid="none",cols="25<m,75<"]
511 |=============================================================================
512 |tree-head              |The "Directory /"-line
513 |tree-dir               |The directory name.
514 |tree-file              |The file name.
515 |=============================================================================
517 Highlighting
518 ~~~~~~~~~~~~
522 Diff markup::
524 Options concerning diff start, chunks and lines added and deleted.
526 *diff-header*, *diff-chunk*, *diff-add*, *diff-del*
528 Enhanced git diff markup::
530 Extra diff information emitted by the git diff machinery, such as mode
531 changes, rename detection, and similarity.
533 *diff-oldmode*, *diff-newmode*, *diff-copy-from*, *diff-copy-to*,
534 *diff-rename-from*, *diff-rename-to*, *diff-similarity*, *diff-dissimilarity*
535 *diff-tree*, *diff-index*
537 Pretty print commit headers::
539 Commit diffs and the revision logs are usually formatted using pretty printed
540 headers , unless `--pretty=raw` was given. This includes lines, such as merge
541 info, commit ID, and author and committer date.
543 *pp-author*, *pp-commit*, *pp-merge*, *pp-date*, *pp-adate*, *pp-cdate*,
544 *pp-refs*
546 Raw commit header::
548 Usually shown when `--pretty=raw` is given, however 'commit' is pretty much
549 omnipresent.
551 *commit*, *parent*, *tree*, *author*, *committer*
553 Commit message::
555 `Signed-off-by`, `Acked-by`, `Reviewed-by` and `Tested-by` lines are colorized.
557 *signoff*, *acked*, *reviewed*, *tested*
559 Tree markup::
561 Colors for information of the tree view.
563 *tree-dir*, *tree-file*
567 Source command
568 -------------
570 Sources commands makes it possible to read additional configuration files.
571 Sourced file are treated in-place, meaning when a 'source' command is
572 encountered it will be immediately read. Any commands, later in the current
573 configuration file will take precedence. The syntax is:
575 [verse]
576 *source* 'path'
578 Examples:
580 ------------------------------------------------------------------------------
581 source ~/.tig/colorscheme.tigrc
582 source ~/.tig/keybindings.tigrc
583 --------------------------------------------------------------------------
585 COPYRIGHT
586 ---------
587 Copyright (c) 2006-2010 Jonas Fonseca <fonseca@diku.dk>
589 Licensed under the terms of the GNU General Public License.
591 SEE ALSO
592 --------
593 manpage:tig[1], manpage:tigmanual[7], git-config(1),
594 and the http://jonas.nitro.dk/tig/manual.html[tig manual].