Expose repository variables to external commands
[tig.git] / doc / tigrc.5.adoc
blobd0e3293cdc8d125a82b0d9bc0a39494925eb2546
1 tigrc(5)
2 ========
3 :docext: adoc
5 NAME
6 ----
7 tigrc - Tig configuration file
10 SYNOPSIS
11 --------
12 [verse]
13 _______________________________________________________________________
14 *set*   'variable' *=* 'value'
15 *bind*  'keymap' 'key' 'action'
16 *color* 'area' 'fgcolor' 'bgcolor' '[attributes]'
17 *source* 'path'
18 _______________________________________________________________________
21 DESCRIPTION
22 -----------
24 You can permanently set an option by putting it in the `~/.tigrc` file.  The
25 file consists of a series of 'commands'.  Each line of the file may contain
26 only one command.  Commands can span multiple lines if each line is
27 terminated by a backslash ('\') character. 
29 The hash mark ('#') is used as a 'comment' character. All text after the
30 comment character to the end of the line is ignored. You can use comments to
31 annotate your initialization file.
33 Certain options can be manipulated at runtime via the option menu. In
34 addition, options can also be toggled with the `:toggle` prompt command
35 or by entering the configuration command into the prompt.
37 Git configuration
38 -----------------
40 Alternatively to using `~/.tigrc`, Tig options can be set by putting them in
41 one of the Git configuration files, which are read by Tig on startup. See
42 'git-config(1)' for which files to use. The following example show the basic
43 syntax to use for settings, bindings and colors.
45 // TEST: gitconfig
46 --------------------------------------------------------------------------
47 [tig] show-changes = true
48 [tig "color"] cursor = yellow red bold 
49 [tig "bind"] generic = P parent
50 --------------------------------------------------------------------------
52 In addition to tig-specific options, the following Git options are read from
53 the Git configuration:
55 'color.*'::
57         Colors for the various UI types. Can be configured via the 'git-colors'
58         setting.
60 'core.abbrev'::
62         The width of the commit ID. See also 'id-width' option.
64 'core.editor'::
66         The editor command. Can be overridden by setting GIT_EDITOR.
68 'core.worktree'::
70         The path to the root of the working tree.
72 'gui.encoding'::
74         The encoding to use for displaying of file content.
76 'i18n.commitencoding'::
78         The encoding used for commits. The default is UTF-8.
80 Set command
81 -----------
83 A few selective variables can be configured via the set command. The syntax
84 is:
86 [verse]
87 *set* variables *=* value
89 Examples:
91 // TEST: tigrc
92 --------------------------------------------------------------------------
93 set commit-order = topo         # Order commits topologically
94 set git-colors = no             # Do not read Git's color settings.
95 set horizontal-scroll = 33%     # Scroll 33% of the view width
96 set blame-options = -C -C -C    # Blame lines from other files
98 # Wrap branch names with () and tags with <>
99 set reference-format = (branch) <tag>
101 # Configure blame view columns using command spanning multiple lines.
102 set blame-view = \
103         date:default \
104         author:abbreviated \
105         file-name:auto \
106         id:yes,color \
107         line-number:yes,interval=5 text
108 --------------------------------------------------------------------------
110 Or in the Git configuration files:
112 // TEST: gitconfig
113 --------------------------------------------------------------------------
114 [tig]
115         line-graphics = no      # Disable graphics characters
116         tab-size = 8            # Number of spaces per tab
117 --------------------------------------------------------------------------
119 The type of variables is either bool, int, string, or mixed.
121 Valid bool values::
123         To set a bool variable to true use either "1", "true", or "yes".
124         Any other value will set the variable to false.
126 Valid int values::
128         A non-negative integer.
130 Valid string values::
132         A string of characters. Optionally, use either ' or " as delimiters.
134 Valid mixed values::
136         These values are composites of the above types. The valid values are
137         specified in the description.
139 Variables
140 ~~~~~~~~~
142 The following variables can be set:
144 'diff-options' (string)::
146         A space separated string of diff options to use in the diff view.
147         git-show(1) is used for formatting and always passes --patch-with-stat.
148         This option overrides any options specified in the TIG_DIFF_OPTS
149         environment variable (described in manpage:tig[1]), but is itself
150         overridden by diff flags given on the command line invocation.
152 'blame-options' (string)::
154         A space separated string of default blame options. Can be used for
155         telling git-blame(1) how to detect the origin of lines. The options
156         are ignored when Tig is started in blame mode and given blame options
157         on the command line.
159 'log-options' (string)::
161         A space separated string of default options that should be passed to the
162         git-log(1) command used by the log view. Options can be overridden by
163         command line options. Used internally override custom `pretty.format'
164         settings that break the log view.
166 'main-options' (string)::
168         A space separated string of default options that should be passed to the
169         git-log(1) command used by the main view. Options can be overridden by
170         command line options.
172 'reference-format' (string)::
174         A space separated string of format strings used for formatting reference
175         names. Wrap the name of the reference type with the characters you would
176         like to use for formatting, e.g. `[tag]` and `<remote>`. If no format is
177         specified for `local-tag`, the format for `tag` is used. Similarly, if no
178         format is specified for `tracked-remote` the `remote` format is used.
179         Prefix with `hide:` to not show that reference type, e.g. `hide:remote`.
180         Supported reference types are:
181          - head                 : The current HEAD.
182          - tag                  : A signed tag.
183          - local-tag            : An unsigned tag.
184          - remote               : A remote.
185          - tracked-remote       : The remote tracked by current HEAD.
186          - replace              : A replaced reference.
187          - branch               : Any other reference.
189 'line-graphics' (mixed) [ascii|default|utf-8|<bool>]::
191         What type of character graphics for line drawing.
193 'horizontal-scroll' (mixed)::
195         Interval to scroll horizontally in each step. Can be specified either
196         as the number of columns, e.g. '5', or as a percentage of the view
197         width, e.g. '33%', where the maximum is 100%. For percentages it is
198         always ensured that at least one column is scrolled. The default is to
199         scroll '50%' of the view width.
201 'git-colors' (list)::
203         A space separated list of "key=value" pairs where the key is a Git color
204         name and the value is a Tig color name, e.g. "branch.current=main-head"
205         and "grep.filename=grep.file". Set to "no" to disable.
207 'show-notes' (mixed) [<reference>|<bool>]::
209         Whether to show notes for a commit. When set to a note reference the
210         reference is passed to `git show --notes=`. Notes are enabled by
211         default.
213 'show-changes' (bool)::
215         Whether to show staged and unstaged changes in the main view.
217 'vertical-split' (mixed) [auto|<bool>]::
219         Whether to split the view horizontally or vertically.
220         "auto" (which is the default) means that it will depend on the window
221         dimensions. When true vertical orientation is used, and false sets the
222         orientation to horizontal.
224 'split-view-height' (mixed)::
226         The height of the bottom view in a horizontally split display. Can be
227         specified either as the number of rows, e.g. '5', or as a percentage of
228         the view height, e.g. '80%', where the maximum is 100%. It is always
229         ensured that the smaller of the views is at least four rows high. The
230         default is '67%'.
232 'split-view-width' (mixed)::
234         Width of the right-most view in a vertically split display. Can be
235         specified either as the number of column, e.g. '5', or as a percentage
236         of the view width, e.g. '80%', where the maximum is 100%. It is always
237         ensured that the smaller of the views is at least four columns wide. The
238         default is '50%'.
240 'status-untracked-dirs' (bool)::
242         Show untracked directories contents in the status view (analog to
243         `git ls-files --directory` option). On by default.
245 'tab-size' (int)::
247         Number of spaces per tab. The default is 8 spaces.
249 'diff-context' (int)::
251         Number of context lines to show for diffs.
253 'ignore-space' (mixed) [no|all|some|at-eol|<bool>]::
255         Ignore space changes in diff view. By default no space changes are
256         ignored. Changing this to "all", "some" or "at-eol" is equivalent to
257         passing "--ignore-all-space", "--ignore-space" or
258         "--ignore-space-at-eol" respectively to `git diff` or `git show`.
260 'commit-order' (enum) [auto|default|topo|date|author-date|reverse]::
262         Commit ordering using the default (chronological reverse) order,
263         topological order, date order or reverse order. When set to "auto"
264         (which is the default), topological order is automatically used in the
265         main view when the commit graph is enabled. In repositories with a long
266         commit history it is advised to set this option to "default" to speed up
267         loading of the main view.
269 'ignore-case' (bool)::
271         Ignore case in searches. By default, the search is case sensitive.
273 'mailmap' (bool)::
275         Read canonical name and email addresses for authors and committers from
276         `.mailmap`. Off by default. See `git-shortlog(1)`.
278 'wrap-lines' (bool)::
280         Wrap long lines. By default, lines are not wrapped.
281         Not compatible with line numbers enabled.
283 'focus-child' (bool)::
285         Whether to focus the child view when it is opened. When disabled the
286         focus will remain in the parent view, avoiding reloads of the child
287         view when navigating the parent view. True by default.
289 'editor-line-number' (bool)::
291         Whether to pass the selected line number to the editor command. The
292         line number is passed as `+<line-number>` in front of the file name.
293         Example: `vim +10 tig.c`
295 'mouse' (bool)::
297         Whether to enable mouse support. Off by default since it makes selecting
298         text from the terminal less intuitive. When enabled hold down Shift (or
299         Option on Mac) to select text. Mouse support requires that ncurses
300         itself support mouse events.
302 'mouse-scroll' (int)::
304         Interval to scroll up or down using the mouse. The default is 3 lines.
305         Mouse support requires that ncurses itself support mouse events and that
306         you have enabled mouse support in ~/.tigrc with `set mouse = true`.
308 'refresh-mode' (mixed) [manual|auto|after-command|periodic|<bool>]::
310         Configures how views are refreshed based on modifications to watched
311         files in the repository. When set to 'manual', nothing is refreshed
312         automatically. When set to 'auto', views are refreshed when a
313         modification is detected. When set to 'after-command' only refresh after
314         returning from an external command. When set to 'periodic', visible
315         views are refreshed periodically using 'refresh-interval'.
317 'refresh-interval' (int)::
319         Interval in seconds between view refresh update checks when
320         'refresh-mode' is set to 'periodic'.
322 'file-args' (args)::
324         Command line arguments referring to files. These are filtered using
325         `git-rev-parse(1)`.
327 'rev-args' (args)::
329         Command line arguments referring to revisions. These are filtered using
330         `git-rev-parse(1)`.
332 'cmdline-args' (args)::
334         All remaining command line arguments that are not either filtered into
335         'file-args' or 'rev-args'.
337 View settings
338 ~~~~~~~~~~~~~
340 The view settings define the order and options for the different columns of a
341 view. Each view setting expects a space separated list of column specifications.
342 Column specifications starts with the column type, and can optionally be
343 followed by a colon (`:`) and a list of column options. E.g. the following
344 column specification defines an 'author' column displaying the author email and
345 with a maximum width of 20 characters: `author:email,width=20`.
347 The first option value in a column specification is always the 'display' option.
348 When no 'display' value is given, 'yes' is assumed. For 'display' options
349 expecting an enumerated value this will automatically resolve to the default
350 enum value. For example, `file-name` will automatically have its 'display'
351 setting resolve to 'auto'.
353 Specifications can also be given for a single column, for example to override
354 the defaults in the system tigrc file. To override a single column, use the
355 column name as a suffix after the view setting name, e.g. `main-view-date` will
356 allow to set the date in the main view.
358 Examples:
359 // TEST: tigrc
360 --------------------------------------------------------------------------
361 # Enable both ID and line numbers in the blame view
362 set blame-view = date:default author:full file-name:auto id:yes,color \
363                  line-number:yes,interval=5 text
365 # Change grep view to be similar to `git grep` format
366 set grep-view = file-name:yes line-number:yes,interval=1 text
368 # Show file sizes as units
369 set tree-view = line-number:no,interval=5 mode author:full \
370                 file-size:units date:default id:no file-name
372 # Show line numbers for every 10th line in the pager view
373 set pager-view = line-number:yes,interval=10 text
375 # Shorthands to change view settings for a previously defined column
376 set main-view-date = short
377 set blame-view-line-number = no
378 # Use Git's default commit order, even when the commit graph is enabled.
379 set commit-order = default
380 --------------------------------------------------------------------------
382 The following list shows which the available view settings and what column types
383 they support:
385 blob-view, diff-view, log-view, pager-view, stage-view:: line-number, text
386 blame-view:: author, date, file-name, id, line-number, text
387 grep-view:: file-name, line-number, text
388 main-view:: author, date, commit-title, id, line-number
389 refs-view:: author, date, commit-title, id, line-number, ref
390 stash-view:: author, date, commit-title, id, line-number
391 status-view:: file-name, line-number, status
392 tree-view:: author, date, id, file-name, file-size, line-number, mode
394 Supported column types and their respective column options:
396 author::
398         - 'display' (mixed) [full|abbreviated|email|email-user|<bool>]: How to
399           display author names. If set to "abbreviated" author initials will be
400           shown.
401         - 'width' (int): Width of the column. When set to a value between 1 and
402           10, the author name will be abbreviated to the author's initials.
403           When set to zero, the width is automatically sized to fit the content.
405 commit-title::
406         - 'graph' (mixed) [no|v2|v1]: Whether to show the revision graph in the
407           main view on start-up. "v1" refers to the old graph rendering, which
408           is less accurate but faster and thus recommended in large
409           repositories.  See also the 'line-graphics' options.
410         - 'refs' (bool): Whether to show references (branches, tags, and
411           remotes) in the main view. Can be toggled.
412         - 'overflow' (bool or int): Whether to highlight text in commit titles
413           exceeding a given width. When set to a boolean, it enables or disables
414           the highlighting using the default width of 50 character. When set to
415           an int, the assigned value is used as the maximum character width.
417 date::
418         - 'display' (mixed) [relative|short|default|local|<bool>]: How to
419           display dates. If set to "relative" a relative date will be used, e.g.
420           "2 minutes ago". If set to "short" no time information is shown.  If
421           set to "local", localtime(3) is used.
422         - 'width' (int): Width of the column. When set to zero, the width is
423           automatically sized to fit the content.
425 file-name::
426         - 'display' (mixed) [auto|always|<bool>]: When to display file names.
427           If set to "auto" file names are shown only when needed, e.g. when
428           running: tig blame -C <file>.
429         - 'width' (int): Width of the column. When set to zero, the width is
430           automatically sized to fit the content.
432 file-size::
433         - 'display' (mixed) [default|units|<bool>]: How to display file sizes.
434           When set to "units", sizes are shown using binary prefixes, e.g. 12524
435           bytes is shown as "12.2K".
436         - 'width' (int): Width of the filename column. When set to zero, the
437           width is automatically sized to fit the content.
439 id::
440         - 'display' (bool): Whether to show commit IDs in the main view.
441         - 'width' (int) : Width of the commit ID. When unset Tig will use the
442           value of 'core.abbrev' if found. See git-config(1) on how to set
443           'core.abbrev'. When set to zero the width is automatically sized to
444           fit the content of reflog (e.g.  `ref/stash@{4}`) IDs and otherwise
445           default to 7.
447 line-number::
448         - 'display' (bool): Whether to show line numbers.
449         - 'interval' (int): Interval between line numbers.
450         - 'width' (int): Width of the column. When set to zero, the width is
451           automatically sized to fit the content.
453 mode::
454         - 'display' (bool): Whether to show file modes.
455         - 'width' (int): Width of the column. When set to zero, the width is
456           automatically sized to fit the content.
458 ref::
459         - 'display' (bool): Whether to show the reference name.
460         - 'width' (int): Width of the column. When set to zero, the width is
461           automatically sized to fit the content.
463 status::
464         - 'display' (mixed) [no|short|long|<bool>]: How to display the status
465           label.
466         - 'width' (int): Width of the column. When set to zero, the width is
467           automatically sized to fit the content.
469 text::
470         - 'commit-title-overflow' (bool or int): Whether to highlight commit
471           titles exceeding a given width in the diff view. When set to a
472           boolean, it enables or disables the highlighting using the default
473           width of 50 character. When set to an int, the assigned value is used
474           as the maximum character width.
476 All column options can be toggled. For 'display' options, use the
477 option name as the prefix followed by a dash and the column name. E.g.
478 `:toggle author-display` will toggle the 'display' option in the 'author'
479 column. For all other options use the column name followed by a dash and
480 then the option name as the suffix. E.g. `:toggle commit-title-graph`
481 will toggle the 'graph' option in the 'commit-title' column. Alternatively,
482 use the option menu to manipulate options.
484 Bind command
485 ------------
487 Using bind commands, keys can be mapped to an action when pressed in a given
488 key map. The syntax is:
490 [verse]
491 *bind* 'keymap' 'key' 'action'
493 Examples:
494 // TEST: tigrc
495 --------------------------------------------------------------------------
496 # Add keybinding to quickly jump to the next diff chunk in the stage view
497 bind stage <Enter> :/^@@
499 # Disable the default mapping for running git-gc
500 bind generic G none
502 # User-defined external command to amend the last commit
503 bind status + !git commit --amend
505 # User-defined internal command that reloads ~/.tigrc
506 bind generic S :source ~/.tigrc
508 # UTF8-encoded characters can be used as key values.
509 bind generic Ã¸ @sh -c "printf '%s' %(commit) | pbcopy"
510 --------------------------------------------------------------------------
512 Or in the Git configuration files:
513 // TEST: gitconfig
514 --------------------------------------------------------------------------
515 [tig "bind"]
516         # 'unbind' the default quit key binding
517         main = Q none
518         # Cherry-pick current commit onto current branch
519         generic = C !git cherry-pick %(commit)
520 --------------------------------------------------------------------------
522 Keys are mapped by first searching the keybindings for the current view, then
523 the keybindings for the *generic* keymap, and last the default keybindings.
524 Thus, the view keybindings override the generic keybindings which override the
525 built-in keybindings.
529 Keymaps::
531 Valid keymaps are: *main*, *diff*, *log*, *help*, *pager*, *status*, *stage*,
532 *tree*, *blob*, *blame*, *refs*, *stash*, *grep* and *generic*. Use *generic*
533 to set key mapping in all keymaps. Use *search* to define keys for navigating
534 search results during search.
536 Key values::
538 Key values should never be quoted. Use either an ASCII or UTF8-encoded character
539 or one of the following symbolic key names. Symbolic key names are case
540 insensitive and starts with "<" and ends with ">". Use *<Hash>* to bind to the
541 `#` key, since the hash mark is used as a comment character. Use *<LessThan>* to
542 bind to the `<` key.
544 *<Enter>*, *<Space>*, *<Backspace>*, *<Tab>*, *<Escape>* or *<Esc>*, *<Left>*,
545 *<Right>*, *<Up>*, *<Down>*, *<Insert>* or *<Ins>*, *<Delete>* or *<Del>*,
546 *<Hash>*, *<LessThan>* or *<LT>*, *<Home>*, *<End>*, *<PageUp>* or *<PgUp>*,
547 *<PageDown>* or *<PgDown>*, *<F1>*, *<F2>*, *<F3>*, *<F4>*, *<F5>*, *<F6>*,
548 *<F7>*, *<F8>*, *<F9>*, *<F10>*, *<F11>*, *<F12>*.
550 To define key mappings with the `Ctrl` key, use `<Ctrl-key>`. In addition, key
551 combos consisting of an initial `Escape` key followed by a normal key value can
552 be bound using `<Esc>key`.
554 Examples:
555 // TEST: tigrc
556 --------------------------------------------------------------------------
557 bind main R             refresh
558 bind main <Down>        next
559 bind main <Ctrl-f>      scroll-page-down
560 bind main <Esc>o        options
561 --------------------------------------------------------------------------
563 Note that due to the way ncurses encodes `Ctrl` key mappings, `Ctrl-m` and
564 `Ctrl-i` cannot be bound as they conflict with 'Enter' and 'Tab' respectively.
565 Furthermore, ncurses does not allow to distinguish between `Ctrl-f` and
566 `Ctrl-F`. Finally, `Ctrl-z` is automatically used for process control and will
567 suspend Tig and open a subshell (use `fg` to reenter Tig).
569 Actions::
571 Actions are either specified as user-defined commands (external or internal) or
572 using action names as described in the following sections.
576 External user-defined command
577 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
579 These actions start with one or more of the following option flags followed by
580 the command that should be executed.
582 [frame="none",grid="none",cols="25<m,75<"]
583 |=============================================================================
584 |!                      |Run the command in the foreground with output shown.
585 |@                      |Run the command in the background with no output.
586 |?                      |Prompt the user before executing the command.
587 |<                      |Exit Tig after executing the command.
588 |=============================================================================
590 Unless otherwise specified, commands are run in the foreground with their
591 console output shown (as if '!' was specified). When multiple command options
592 are specified their behavior are combined, e.g. "?<git commit" will prompt the
593 user whether to execute the command and will exit Tig after completion.
595 Browsing state variables
596 ^^^^^^^^^^^^^^^^^^^^^^^^
598 User-defined commands can optionally refer to Tig's internal state using the
599 following variable names, which are substituted before commands are run:
601 [frame="none",grid="none",cols="25<m,75<"]
602 |=============================================================================
603 |%(head)                |The currently viewed 'head' ID. Defaults to HEAD
604 |%(commit)              |The currently selected commit ID.
605 |%(blob)                |The currently selected blob ID.
606 |%(branch)              |The currently selected branch name.
607 |%(remote)              |The currently selected remote name. For remote
608                          branches %(branch) will contain the branch name.
609 |%(tag)                 |The currently selected tag name.
610 |%(stash)               |The currently selected stash name.
611 |%(directory)           |The current directory path in the tree view or
612                          "." if undefined.
613 |%(file)                |The currently selected file.
614 |%(lineno)              |The currently selected line number. Defaults to 0.
615 |%(ref)                 |The reference given to blame or HEAD if undefined.
616 |%(revargs)             |The revision arguments passed on the command line.
617 |%(fileargs)            |The file arguments passed on the command line.
618 |%(cmdlineargs)         |All other options passed on the command line.
619 |%(diffargs)            |Options from 'diff-options' or 'TIG_DIFF_OPTS' used
620                          used by the diff view.
621 |%(blameargs)           |Options from 'blame-options' used by the blame view.
622 |%(logargs)             |Options from 'log-options' used by the log view.
623 |%(mainargs)            |Options from 'main-options' used by the main view.
624 |%(prompt)              |Prompt for the argument value. Optionally specify a
625                          custom prompt using `"%(prompt Enter branch name: )"`
626 |%(repo:head)           |The name of the checked out branch, e.g. `master`
627 |%(repo:head-id)        |The commit ID of the checked out branch.
628 |%(repo:remote)         |The remote associated with the checked out branch,
629                          e.g. `origin/master`.
630 |%(repo:cdup)           |The path to change directory to the repository root,
631                          e.g. `../`
632 |%(repo:prefix)         |The path prefix of the current work directory,
633                          e.g `subdir/`.
634 |%(repo:git-dir)        |The path to the Git directory, e.g. `/src/repo/.git`.
635 |%(repo:is-inside-work-tree)
636                         |Whether Tig is running inside a work tree,
637                          either `true` or `false`.
638 |=============================================================================
640 Examples:
641 // TEST: tigrc
642 --------------------------------------------------------------------------
643 # Save save the current commit as a patch file when the user selects a
644 # commit in the main view and presses 'S'.
645 bind main S !git format-patch -1 %(commit)
647 # Create and checkout a new branch; specify custom prompt
648 bind main B ?git checkout -b "%(prompt Enter new branch name: )"
649 --------------------------------------------------------------------------
651 Advanced shell-like commands
652 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
654 If your command requires use of dynamic features, such as subshells,
655 expansion of environment variables and process control, this can be achieved by
656 using a shell command:
658 .Configure a binding to copy the current commit ID to the clipboard.
659 // TEST: tigrc
660 --------------------------------------------------------------------------
661 bind generic I @sh -c "echo -n %(commit) | xclip -selection c"
662 --------------------------------------------------------------------------
664 Or by using a combination of Git aliases and Tig external commands. The
665 following example entries can be put in either the .gitconfig or .git/config
666 file:
668 .Git configuration which binds Tig keys to Git command aliases.
669 // TEST: gitconfig
670 --------------------------------------------------------------------------
671 [alias]
672         gitk-bg = !"gitk HEAD --not $(git rev-parse --remotes) &"
673         publish = !"for i in origin public; do git push $i; done"
674 [tig "bind"]
675         # @-prefix means that the console output will not be shown.
676         generic = V !@git gitk-bg
677         generic = > !git publish
678 --------------------------------------------------------------------------
680 Internal user-defined commands
681 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
683 Actions beginning with a ':' will be run and interpreted as internal commands
684 and act similar to commands run via Tig's prompt. Valid internal commands are
685 configuration file options (as described in this document) and pager view
686 commands. Examples:
688 // TEST: tigrc
689 --------------------------------------------------------------------------
690 # Reload ~/.tigrc when 'S' is pressed
691 bind generic S :source .tigrc
693 # Change diff view to show all commit changes regardless of file limitations
694 bind diff F :set diff-options = --full-diff
696 # Show the output of git-reflog(1) in the pager view
697 bind generic W :!git reflog
699 # Search for previous diff (c)hunk and next diff header
700 bind stage 2 :?^@@
701 bind stage D :/^diff --(git|cc)
703 bind main I :toggle id                          # Show/hide the ID column
704 bind diff D :toggle diff-options --minimal      # Use minimal diff algorithm
705 bind diff [ :toggle diff-context -3             # Decrease context (-U arg)
706 bind diff ] :toggle diff-context +3             # Increase context
707 bind generic V :toggle split-view-height -10%   # Decrease split height
708 --------------------------------------------------------------------------
710 Similar to external commands, pager view commands can contain variable names
711 that will be substituted before the command is run.
713 Action names
714 ~~~~~~~~~~~~
716 Valid action names are described below. Note, all action names are
717 case-insensitive, and you may use '-', '_', and '.' interchangeably, e.g.
718 "view-main", "View.Main", and "VIEW_MAIN" are the same.
720 ifndef::DOC_GEN_ACTIONS[]
721 View switching
722 ^^^^^^^^^^^^^^
724 [frame="none",grid="none",cols="25<m,75<"]
725 |=============================================================================
726 |view-main               |Show main view
727 |view-diff               |Show diff view
728 |view-log                |Show log view
729 |view-tree               |Show tree view
730 |view-blob               |Show blob view
731 |view-blame              |Show blame view
732 |view-refs               |Show refs view
733 |view-status             |Show status view
734 |view-stage              |Show stage view
735 |view-stash              |Show stash view
736 |view-grep               |Show grep view
737 |view-pager              |Show pager view
738 |view-help               |Show help view
739 |=============================================================================
741 View manipulation
742 ^^^^^^^^^^^^^^^^^
744 [frame="none",grid="none",cols="25<m,75<"]
745 |=============================================================================
746 |enter                   |Enter and open selected line
747 |back                    |Go back to the previous view state
748 |next                    |Move to next
749 |previous                |Move to previous
750 |parent                  |Move to parent
751 |view-next               |Move focus to the next view
752 |refresh                 |Reload and refresh view
753 |maximize                |Maximize the current view
754 |view-close              |Close the current view
755 |quit                    |Close all views and quit
756 |=============================================================================
758 View specific actions
759 ^^^^^^^^^^^^^^^^^^^^^
761 [frame="none",grid="none",cols="25<m,75<"]
762 |=============================================================================
763 |status-update           |Stage/unstage chunk or file changes
764 |status-revert           |Revert chunk or file changes
765 |status-merge            |Merge file using external tool
766 |stage-update-line       |Stage/unstage single line
767 |stage-split-chunk       |Split current diff chunk
768 |=============================================================================
770 Cursor navigation
771 ^^^^^^^^^^^^^^^^^
773 [frame="none",grid="none",cols="25<m,75<"]
774 |=============================================================================
775 |move-up                 |Move cursor one line up
776 |move-down               |Move cursor one line down
777 |move-page-down          |Move cursor one page down
778 |move-page-up            |Move cursor half a page up
779 |move-half-page-down     |Move cursor half a page down
780 |move-half-page-up       |Move cursor one page up
781 |move-first-line         |Move cursor to first line
782 |move-last-line          |Move cursor to last line
783 |=============================================================================
785 Scrolling
786 ^^^^^^^^^
788 [frame="none",grid="none",cols="25<m,75<"]
789 |=============================================================================
790 |scroll-line-up          |Scroll one line up
791 |scroll-line-down        |Scroll one line down
792 |scroll-page-up          |Scroll one page up
793 |scroll-page-down        |Scroll one page down
794 |scroll-first-col        |Scroll to the first line columns
795 |scroll-left             |Scroll two columns left
796 |scroll-right            |Scroll two columns right
797 |=============================================================================
799 Searching
800 ^^^^^^^^^
802 [frame="none",grid="none",cols="25<m,75<"]
803 |=============================================================================
804 |search                  |Search the view
805 |search-back             |Search backwards in the view
806 |find-next               |Find next search match
807 |find-prev               |Find previous search match
808 |=============================================================================
810 Misc
811 ^^^^
813 [frame="none",grid="none",cols="25<m,75<"]
814 |=============================================================================
815 |edit                    |Open in editor
816 |prompt                  |Open the prompt
817 |options                 |Open the options menu
818 |screen-redraw           |Redraw the screen
819 |stop-loading            |Stop all loading views
820 |show-version            |Show version information
821 |none                    |Do nothing
822 |=============================================================================
823 endif::DOC_GEN_ACTIONS[]
825 Color command
826 -------------
828 Color commands control highlighting and the user interface styles. If your
829 terminal supports color, these commands can be used to assign foreground and
830 background combinations to certain areas. Optionally, an attribute can be
831 given as the last parameter. The syntax is:
833 [verse]
834 *color* 'area' 'fgcolor' 'bgcolor' '[attributes]'
836 Examples:
837 // TEST: tigrc
838 ------------------------------------------------------------------------------
839 # Override the default terminal colors to white on black.
840 color default           white   black
841 # Diff colors
842 color diff-header       yellow  default
843 color diff-index        blue    default
844 color diff-chunk        magenta default
845 color "Reported-by:"    green   default
846 # View specific color
847 color tree.date         black   cyan    bold
848 --------------------------------------------------------------------------
850 Or in the Git configuration files:
851 // TEST: gitconfig
852 --------------------------------------------------------------------------
853 [tig "color"]
854         # A strange looking cursor line
855         cursor          = red   default underline
856         # UI colors
857         title-blur      = white blue
858         title-focus     = white blue    bold
859 # View specific color
860 [tig "color.tree"]
861         date            = cyan  default bold
862 ------------------------------------------------------------------------------
864 Area names::
866         Can be either a built-in area name or a custom quoted string. The
867         latter allows custom color rules to be added for lines matching a
868         quoted string.
869         Valid built-in area names are described below. Note, all names are
870         case-insensitive, and you may use '-', and '_' interchangeably,
871         e.g. "Diff-Header" and "DIFF_HEADER" are the same.
872         View specific colors can be defined by prefixing the view name to
873         the area name, e.g. "stage.diff-chunk" and "diff.diff-chunk".
875 Color names::
877         Valid colors include: *white*, *black*, *green*, *magenta*, *blue*,
878         *cyan*, *yellow*, *red*, *default*. Use *default* to refer to the
879         default terminal colors, for example, to keep the background
880         transparent when you are using a terminal with a transparent
881         background.
883 Colors can also be specified using the keywords *color0*, *color1*, ...,
884 *colorN-1* (where *N* is the number of colors supported by your terminal).
885 This is useful when you remap the colors for your display or want to enable
886 colors supported by 88-color and 256-color terminals. Note that the 'color'
887 prefix is optional. If you prefer, you can specify colors directly by their
888 numbers *0*, *1*, ..., *N-1* instead, just like in the configuration file of
889 Git.
891 Attribute names::
893         Valid attributes include: *normal*, *blink*, *bold*, *dim*, *reverse*,
894         *standout*, and *underline*. Note, not all attributes may be supported
895         by the terminal.
897 UI colors
898 ~~~~~~~~~
900 The colors and attributes to be used for the text that is not highlighted or
901 that specify the use of the default terminal colors can be controlled by
902 setting the *default* color option.
904 .General
905 [frame="none",grid="none",cols="25<m,75<"]
906 |=============================================================================
907 |default                |Override default terminal colors (see above).
908 |cursor                 |The cursor line.
909 |status                 |The status window showing info messages.
910 |title-focus            |The title window for the current view.
911 |title-blur             |The title window of any backgrounded view.
912 |delimiter              |Delimiter shown for truncated lines.
913 |header                 |The view header lines. Use 'status.header' to color
914                          the staged, unstaged, and untracked sections in the
915                          status view. Use 'help.header' to color the keymap
916                          sections in the help view.
917 |line-number            |Line numbers.
918 |id                     |The commit ID.
919 |date                   |The author date.
920 |author                 |The commit author.
921 |mode                   |The file mode holding the permissions and type.
922 |overflow               |Title text overflow.
923 |directory              |The directory name.
924 |file                   |The file name.
925 |file-size              |File size.
926 |=============================================================================
928 .Main view colors
929 [frame="none",grid="none",cols="25<m,75<"]
930 |=============================================================================
931 |graph-commit           |The commit dot in the revision graph.
932 |palette-[0-13]         |14 different colors, used for distinguishing branches
933                          or commits. By default, the palette uses the ASCII
934                          colors, where the second half of them have the bold
935                          attribute enabled to give a brighter color.
936                          Example: palette-0 = red
937 |main-commit            |The commit comment.
938 |main-head              |Label of the current branch.
939 |main-remote            |Label of a remote.
940 |main-tracked           |Label of the remote tracked by the current branch.
941 |main-tag               |Label of a signed tag.
942 |main-local-tag         |Label of a local tag.
943 |main-ref               |Label of any other reference.
944 |main-replace           |Label of replaced reference.
945 |=============================================================================
947 .Status view
948 [frame="none",grid="none",cols="25<m,75<"]
949 |=============================================================================
950 |stat-none              |Empty status label.
951 |stat-staged            |Status flag of staged files.
952 |stat-unstaged          |Status flag of unstaged files.
953 |stat-untracked         |Status flag of untracked files.
954 |=============================================================================
956 .Help view
957 [frame="none",grid="none",cols="25<m,75<"]
958 |=============================================================================
959 |help-group             |Help group name.
960 |help-action            |Help action name.
961 |=============================================================================
963 Highlighting
964 ~~~~~~~~~~~~
968 Diff markup::
970 Options concerning diff start, chunks and lines added and deleted.
972 *diff-header*, *diff-chunk*, *diff-add*, *diff-add2*, *diff-del*,
973 *diff-del2*
975 Enhanced Git diff markup::
977 Extra diff information emitted by the Git diff machinery, such as mode
978 changes, rename detection, and similarity.
980 *diff-oldmode*, *diff-newmode*, *diff-copy-from*, *diff-copy-to*,
981 *diff-similarity*, *diff-index*
983 Pretty print commit headers::
985 Commit diffs and the revision logs are usually formatted using pretty printed
986 headers , unless `--pretty=raw` was given. This includes lines, such as merge
987 info, commit ID, and author and committer date.
989 *pp-refs*, *pp-reflog*, *pp-reflogmsg*, *pp-merge*
991 Raw commit header::
993 Usually shown when `--pretty=raw` is given, however 'commit' is pretty much
994 omnipresent.
996 *commit*, *parent*, *tree*, *author*, *committer*
998 Commit message::
1000 `Signed-off-by`, `Acked-by`, `Reviewed-by` and `Tested-by` lines are colorized.
1001 Characters in the commit title exceeding a predefined width can be highlighted.
1004 Tree markup::
1006 Colors for information of the tree view.
1008 *tree-dir*, *tree-file*
1012 Source command
1013 -------------
1015 Source commands make it possible to read additional configuration files.
1016 Sourced files are included in-place, meaning when a 'source' command is
1017 encountered the file will be immediately read. Any commands later in the
1018 current configuration file will take precedence. The syntax is:
1020 [verse]
1021 *source* 'path'
1023 Examples:
1024 // TEST: tigrc
1025 --------------------------------------------------------------------------
1026 source ~/.tig/colorscheme.tigrc
1027 source ~/.tig/keybindings.tigrc
1028 --------------------------------------------------------------------------
1030 COPYRIGHT
1031 ---------
1032 Copyright (c) 2006-2014 Jonas Fonseca <jonas.fonseca@gmail.com>
1034 This program is free software; you can redistribute it and/or modify
1035 it under the terms of the GNU General Public License as published by
1036 the Free Software Foundation; either version 2 of the License, or
1037 (at your option) any later version.
1039 SEE ALSO
1040 --------
1041 ifndef::backend-docbook[]
1042 link:tig.1.{docext}[tig(1)],
1043 link:manual.{docext}[the Tig manual],
1044 endif::backend-docbook[]
1045 ifdef::backend-docbook[]
1046 manpage:tig[1],
1047 manpage:tigmanual[7],
1048 endif::backend-docbook[]
1049 git(7), git-config(1)