Fix the help tests
[tig.git] / doc / tigrc.5.adoc
blob68bdb9ac1410a8a42125232a584c3851acc7f256
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 View settings
333 ~~~~~~~~~~~~~
335 The view settings define the order and options for the different columns of a
336 view. Each view setting expects a space separated list of column specifications.
337 Column specifications starts with the column type, and can optionally be
338 followed by a colon (`:`) and a list of column options. E.g. the following
339 column specification defines an 'author' column displaying the author email and
340 with a maximum width of 20 characters: `author:email,width=20`.
342 The first option value in a column specification is always the 'display' option.
343 When no 'display' value is given, 'yes' is assumed. For 'display' options
344 expecting an enumerated value this will automatically resolve to the default
345 enum value. For example, `file-name` will automatically have its 'display'
346 setting resolve to 'auto'.
348 Specifications can also be given for a single column, for example to override
349 the defaults in the system tigrc file. To override a single column, use the
350 column name as a suffix after the view setting name, e.g. `main-view-date` will
351 allow to set the date in the main view.
353 Examples:
354 // TEST: tigrc
355 --------------------------------------------------------------------------
356 # Enable both ID and line numbers in the blame view
357 set blame-view = date:default author:full file-name:auto id:yes,color \
358                  line-number:yes,interval=5 text
360 # Change grep view to be similar to `git grep` format
361 set grep-view = file-name:yes line-number:yes,interval=1 text
363 # Show file sizes as units
364 set tree-view = line-number:no,interval=5 mode author:full \
365                 file-size:units date:default id:no file-name
367 # Show line numbers for every 10th line in the pager view
368 set pager-view = line-number:yes,interval=10 text
370 # Shorthands to change view settings for a previously defined column
371 set main-view-date = custom
372 set main-view-date-format = "%Y-%m-%d %H:%M"
373 set blame-view-line-number = no
374 # Use Git's default commit order, even when the commit graph is enabled.
375 set commit-order = default
376 --------------------------------------------------------------------------
378 The following list shows which the available view settings and what column types
379 they support:
381 blob-view, diff-view, log-view, pager-view, stage-view:: line-number, text
382 blame-view:: author, date, file-name, id, line-number, text
383 grep-view:: file-name, line-number, text
384 main-view:: author, date, commit-title, id, line-number
385 refs-view:: author, date, commit-title, id, line-number, ref
386 stash-view:: author, date, commit-title, id, line-number
387 status-view:: file-name, line-number, status
388 tree-view:: author, date, id, file-name, file-size, line-number, mode
390 Supported column types and their respective column options:
392 author::
394         - 'display' (mixed) [full|abbreviated|email|email-user|<bool>]: How to
395           display author names. If set to "abbreviated" author initials will be
396           shown.
397         - 'width' (int): Width of the column. When set to a value between 1 and
398           10, the author name will be abbreviated to the author's initials.
399           When set to zero, the width is automatically sized to fit the content.
401 commit-title::
402         - 'graph' (mixed) [no|v2|v1]: Whether to show the revision graph in the
403           main view on start-up. "v1" refers to the old graph rendering, which
404           is less accurate but faster and thus recommended in large
405           repositories.  See also the 'line-graphics' options.
406         - 'refs' (bool): Whether to show references (branches, tags, and
407           remotes) in the main view. Can be toggled.
408         - 'overflow' (bool or int): Whether to highlight text in commit titles
409           exceeding a given width. When set to a boolean, it enables or disables
410           the highlighting using the default width of 50 character. When set to
411           an int, the assigned value is used as the maximum character width.
413 date::
414         - 'display' (mixed) [relative|relative-compact|custom|default|<bool>]:
415           How to display dates. If set to "relative" or "relative-compact" a
416           relative date will be used, e.g. "2 minutes ago" or "2m". If set to
417           "custom", the strftime(3) string format specified in the "format"
418           option is used.
419         - 'local' (bool): If true, use localtime(3) to convert to local
420           timezone. Note that relative dates always use local offsets.
421         - 'format' (string): format string to pass to strftime(3) when 'custom'
422           display mode has been selected.
423         - 'width' (int): Width of the column. When set to zero, the width is
424           automatically sized to fit the content.
426 file-name::
427         - 'display' (mixed) [auto|always|<bool>]: When to display file names.
428           If set to "auto" file names are shown only when needed, e.g. when
429           running: tig blame -C <file>.
430         - 'width' (int): Width of the column. When set to zero, the width is
431           automatically sized to fit the content.
433 file-size::
434         - 'display' (mixed) [default|units|<bool>]: How to display file sizes.
435           When set to "units", sizes are shown using binary prefixes, e.g. 12524
436           bytes is shown as "12.2K".
437         - 'width' (int): Width of the filename column. When set to zero, the
438           width is automatically sized to fit the content.
440 id::
441         - 'display' (bool): Whether to show commit IDs in the main view.
442         - 'width' (int) : Width of the commit ID. When unset Tig will use the
443           value of 'core.abbrev' if found. See git-config(1) on how to set
444           'core.abbrev'. When set to zero the width is automatically sized to
445           fit the content of reflog (e.g.  `ref/stash@{4}`) IDs and otherwise
446           default to 7.
448 line-number::
449         - 'display' (bool): Whether to show line numbers.
450         - 'interval' (int): Interval between line numbers.
451         - 'width' (int): Width of the column. When set to zero, the width is
452           automatically sized to fit the content.
454 mode::
455         - 'display' (bool): Whether to show file modes.
456         - 'width' (int): Width of the column. When set to zero, the width is
457           automatically sized to fit the content.
459 ref::
460         - 'display' (bool): Whether to show the reference name.
461         - 'width' (int): Width of the column. When set to zero, the width is
462           automatically sized to fit the content.
464 status::
465         - 'display' (mixed) [no|short|long|<bool>]: How to display the status
466           label.
467         - 'width' (int): Width of the column. When set to zero, the width is
468           automatically sized to fit the content.
470 text::
471         - 'commit-title-overflow' (bool or int): Whether to highlight commit
472           titles exceeding a given width in the diff view. When set to a
473           boolean, it enables or disables the highlighting using the default
474           width of 50 character. When set to an int, the assigned value is used
475           as the maximum character width.
477 All column options can be toggled. For 'display' options, use the
478 option name as the prefix followed by a dash and the column name. E.g.
479 `:toggle author-display` will toggle the 'display' option in the 'author'
480 column. For all other options use the column name followed by a dash and
481 then the option name as the suffix. E.g. `:toggle commit-title-graph`
482 will toggle the 'graph' option in the 'commit-title' column. Alternatively,
483 use the option menu to manipulate options.
485 Bind command
486 ------------
488 Using bind commands, keys can be mapped to an action when pressed in a given
489 key map. The syntax is:
491 [verse]
492 *bind* 'keymap' 'key' 'action'
494 Examples:
495 // TEST: tigrc
496 --------------------------------------------------------------------------
497 # Add keybinding to quickly jump to the next diff chunk in the stage view
498 bind stage <Enter> :/^@@
500 # Disable the default mapping for running git-gc
501 bind generic G none
503 # User-defined external command to amend the last commit
504 bind status + !git commit --amend
506 # User-defined internal command that reloads ~/.tigrc
507 bind generic S :source ~/.tigrc
509 # UTF8-encoded characters can be used as key values.
510 bind generic Ã¸ @sh -c "printf '%s' %(commit) | pbcopy"
511 --------------------------------------------------------------------------
513 Or in the Git configuration files:
514 // TEST: gitconfig
515 --------------------------------------------------------------------------
516 [tig "bind"]
517         # 'unbind' the default quit key binding
518         main = Q none
519         # Cherry-pick current commit onto current branch
520         generic = C !git cherry-pick %(commit)
521 --------------------------------------------------------------------------
523 Keys are mapped by first searching the keybindings for the current view, then
524 the keybindings for the *generic* keymap, and last the default keybindings.
525 Thus, the view keybindings override the generic keybindings which override the
526 built-in keybindings.
530 Keymaps::
532 Valid keymaps are: *main*, *diff*, *log*, *help*, *pager*, *status*, *stage*,
533 *tree*, *blob*, *blame*, *refs*, *stash*, *grep* and *generic*. Use *generic*
534 to set key mapping in all keymaps. Use *search* to define keys for navigating
535 search results during search.
537 Key values::
539 Key values should never be quoted. Use either an ASCII or UTF8-encoded character
540 or one of the following symbolic key names. Symbolic key names are case
541 insensitive and starts with "<" and ends with ">". Use *<Hash>* to bind to the
542 `#` key, since the hash mark is used as a comment character. Use *<LessThan>* to
543 bind to the `<` key.
545 *<Enter>*, *<Space>*, *<Backspace>*, *<Tab>*, *<Escape>* or *<Esc>*, *<Left>*,
546 *<Right>*, *<Up>*, *<Down>*, *<Insert>* or *<Ins>*, *<Delete>* or *<Del>*,
547 *<Hash>*, *<LessThan>* or *<LT>*, *<Home>*, *<End>*, *<PageUp>* or *<PgUp>*,
548 *<PageDown>* or *<PgDown>*, *<F1>*, *<F2>*, *<F3>*, *<F4>*, *<F5>*, *<F6>*,
549 *<F7>*, *<F8>*, *<F9>*, *<F10>*, *<F11>*, *<F12>*.
551 To define key mappings with the `Ctrl` key, use `<Ctrl-key>`. In addition, key
552 combos consisting of an initial `Escape` key followed by a normal key value can
553 be bound using `<Esc>key`.
555 Examples:
556 // TEST: tigrc
557 --------------------------------------------------------------------------
558 bind main R             refresh
559 bind main <Down>        next
560 bind main <Ctrl-f>      scroll-page-down
561 bind main <Esc>o        options
562 --------------------------------------------------------------------------
564 Note that due to the way ncurses encodes `Ctrl` key mappings, `Ctrl-m` and
565 `Ctrl-i` cannot be bound as they conflict with 'Enter' and 'Tab' respectively.
566 Furthermore, ncurses does not allow to distinguish between `Ctrl-f` and
567 `Ctrl-F`. Finally, `Ctrl-z` is automatically used for process control and will
568 suspend Tig and open a subshell (use `fg` to reenter Tig).
570 Actions::
572 Actions are either specified as user-defined commands (external or internal) or
573 using action names as described in the following sections.
577 External user-defined command
578 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
580 These actions start with one or more of the following option flags followed by
581 the command that should be executed.
583 [frame="none",grid="none",cols="25<m,75<"]
584 |=============================================================================
585 |!                      |Run the command in the foreground with output shown.
586 |@                      |Run the command in the background with no output.
587 |?                      |Prompt the user before executing the command.
588 |<                      |Exit Tig after executing the command.
589 |=============================================================================
591 Unless otherwise specified, commands are run in the foreground with their
592 console output shown (as if '!' was specified). When multiple command options
593 are specified their behavior are combined, e.g. "?<git commit" will prompt the
594 user whether to execute the command and will exit Tig after completion.
596 Browsing state variables
597 ^^^^^^^^^^^^^^^^^^^^^^^^
599 User-defined commands can optionally refer to Tig's internal state using the
600 following variable names, which are substituted before commands are run:
602 [frame="none",grid="none",cols="25<m,75<"]
603 |=============================================================================
604 |%(head)                |The currently viewed 'head' ID. Defaults to HEAD
605 |%(commit)              |The currently selected commit ID.
606 |%(blob)                |The currently selected blob ID.
607 |%(branch)              |The currently selected branch name.
608 |%(remote)              |The currently selected remote name. For remote
609                          branches %(branch) will contain the branch name.
610 |%(tag)                 |The currently selected tag name.
611 |%(stash)               |The currently selected stash name.
612 |%(directory)           |The current directory path in the tree view or
613                          "." if undefined.
614 |%(file)                |The currently selected file.
615 |%(lineno)              |The currently selected line number. Defaults to 0.
616 |%(ref)                 |The reference given to blame or HEAD if undefined.
617 |%(revargs)             |The revision arguments passed on the command line.
618 |%(fileargs)            |The file arguments passed on the command line.
619 |%(cmdlineargs)         |All other options passed on the command line.
620 |%(diffargs)            |Options from 'diff-options' or 'TIG_DIFF_OPTS' used
621                          used by the diff view.
622 |%(blameargs)           |Options from 'blame-options' used by the blame view.
623 |%(logargs)             |Options from 'log-options' used by the log view.
624 |%(mainargs)            |Options from 'main-options' used by the main view.
625 |%(prompt)              |Prompt for the argument value. Optionally specify a
626                          custom prompt using `"%(prompt Enter branch name: )"`
627 |%(text)                |The text of the currently selected line.
628 |%(repo:head)           |The name of the checked out branch, e.g. `master`
629 |%(repo:head-id)        |The commit ID of the checked out branch.
630 |%(repo:remote)         |The remote associated with the checked out branch,
631                          e.g. `origin/master`.
632 |%(repo:cdup)           |The path to change directory to the repository root,
633                          e.g. `../`
634 |%(repo:prefix)         |The path prefix of the current work directory,
635                          e.g `subdir/`.
636 |%(repo:git-dir)        |The path to the Git directory, e.g. `/src/repo/.git`.
637 |%(repo:is-inside-work-tree)
638                         |Whether Tig is running inside a work tree,
639                          either `true` or `false`.
640 |=============================================================================
642 Examples:
643 // TEST: tigrc
644 --------------------------------------------------------------------------
645 # Save save the current commit as a patch file when the user selects a
646 # commit in the main view and presses 'S'.
647 bind main S !git format-patch -1 %(commit)
649 # Create and checkout a new branch; specify custom prompt
650 bind main B ?git checkout -b "%(prompt Enter new branch name: )"
651 --------------------------------------------------------------------------
653 Advanced shell-like commands
654 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
656 If your command requires use of dynamic features, such as subshells,
657 expansion of environment variables and process control, this can be achieved by
658 using a shell command:
660 .Configure a binding to copy the current commit ID to the clipboard.
661 // TEST: tigrc
662 --------------------------------------------------------------------------
663 bind generic I @sh -c "echo -n %(commit) | xclip -selection c"
664 --------------------------------------------------------------------------
666 Or by using a combination of Git aliases and Tig external commands. The
667 following example entries can be put in either the .gitconfig or .git/config
668 file:
670 .Git configuration which binds Tig keys to Git command aliases.
671 // TEST: gitconfig
672 --------------------------------------------------------------------------
673 [alias]
674         gitk-bg = !"gitk HEAD --not $(git rev-parse --remotes) &"
675         publish = !"for i in origin public; do git push $i; done"
676 [tig "bind"]
677         # @-prefix means that the console output will not be shown.
678         generic = V !@git gitk-bg
679         generic = > !git publish
680 --------------------------------------------------------------------------
682 Internal user-defined commands
683 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
685 Actions beginning with a ':' will be run and interpreted as internal commands
686 and act similar to commands run via Tig's prompt. Valid internal commands are
687 configuration file options (as described in this document) and pager view
688 commands. Examples:
690 // TEST: tigrc
691 --------------------------------------------------------------------------
692 # Reload ~/.tigrc when 'S' is pressed
693 bind generic S :source .tigrc
695 # Change diff view to show all commit changes regardless of file limitations
696 bind diff F :set diff-options = --full-diff
698 # Show the output of git-reflog(1) in the pager view
699 bind generic W :!git reflog
701 # Search for previous diff (c)hunk and next diff header
702 bind stage 2 :?^@@
703 bind stage D :/^diff --(git|cc)
705 bind main I :toggle id                          # Show/hide the ID column
706 bind diff D :toggle diff-options --minimal      # Use minimal diff algorithm
707 bind diff [ :toggle diff-context -3             # Decrease context (-U arg)
708 bind diff ] :toggle diff-context +3             # Increase context
709 bind generic V :toggle split-view-height -10%   # Decrease split height
710 --------------------------------------------------------------------------
712 Similar to external commands, pager view commands can contain variable names
713 that will be substituted before the command is run.
715 Action names
716 ~~~~~~~~~~~~
718 Valid action names are described below. Note, all action names are
719 case-insensitive, and you may use '-', '_', and '.' interchangeably, e.g.
720 "view-main", "View.Main", and "VIEW_MAIN" are the same.
722 ifndef::DOC_GEN_ACTIONS[]
723 View switching
724 ^^^^^^^^^^^^^^
726 [frame="none",grid="none",cols="25<m,75<"]
727 |=============================================================================
728 |view-main               |Show main view
729 |view-diff               |Show diff view
730 |view-log                |Show log view
731 |view-tree               |Show tree view
732 |view-blob               |Show blob view
733 |view-blame              |Show blame view
734 |view-refs               |Show refs view
735 |view-status             |Show status view
736 |view-stage              |Show stage view
737 |view-stash              |Show stash view
738 |view-grep               |Show grep view
739 |view-pager              |Show pager view
740 |view-help               |Show help view
741 |=============================================================================
743 View manipulation
744 ^^^^^^^^^^^^^^^^^
746 [frame="none",grid="none",cols="25<m,75<"]
747 |=============================================================================
748 |enter                   |Enter and open selected line
749 |back                    |Go back to the previous view state
750 |next                    |Move to next
751 |previous                |Move to previous
752 |parent                  |Move to parent
753 |view-next               |Move focus to the next view
754 |refresh                 |Reload and refresh view
755 |maximize                |Maximize the current view
756 |view-close              |Close the current view
757 |quit                    |Close all views and quit
758 |=============================================================================
760 View specific actions
761 ^^^^^^^^^^^^^^^^^^^^^
763 [frame="none",grid="none",cols="25<m,75<"]
764 |=============================================================================
765 |status-update           |Stage/unstage chunk or file changes
766 |status-revert           |Revert chunk or file changes
767 |status-merge            |Merge file using external tool
768 |stage-update-line       |Stage/unstage single line
769 |stage-split-chunk       |Split current diff chunk
770 |=============================================================================
772 Cursor navigation
773 ^^^^^^^^^^^^^^^^^
775 [frame="none",grid="none",cols="25<m,75<"]
776 |=============================================================================
777 |move-up                 |Move cursor one line up
778 |move-down               |Move cursor one line down
779 |move-page-down          |Move cursor one page down
780 |move-page-up            |Move cursor half a page up
781 |move-half-page-down     |Move cursor half a page down
782 |move-half-page-up       |Move cursor one page up
783 |move-first-line         |Move cursor to first line
784 |move-last-line          |Move cursor to last line
785 |=============================================================================
787 Scrolling
788 ^^^^^^^^^
790 [frame="none",grid="none",cols="25<m,75<"]
791 |=============================================================================
792 |scroll-line-up          |Scroll one line up
793 |scroll-line-down        |Scroll one line down
794 |scroll-page-up          |Scroll one page up
795 |scroll-page-down        |Scroll one page down
796 |scroll-first-col        |Scroll to the first line columns
797 |scroll-left             |Scroll two columns left
798 |scroll-right            |Scroll two columns right
799 |=============================================================================
801 Searching
802 ^^^^^^^^^
804 [frame="none",grid="none",cols="25<m,75<"]
805 |=============================================================================
806 |search                  |Search the view
807 |search-back             |Search backwards in the view
808 |find-next               |Find next search match
809 |find-prev               |Find previous search match
810 |=============================================================================
812 Misc
813 ^^^^
815 [frame="none",grid="none",cols="25<m,75<"]
816 |=============================================================================
817 |edit                    |Open in editor
818 |prompt                  |Open the prompt
819 |options                 |Open the options menu
820 |screen-redraw           |Redraw the screen
821 |stop-loading            |Stop all loading views
822 |show-version            |Show version information
823 |none                    |Do nothing
824 |=============================================================================
825 endif::DOC_GEN_ACTIONS[]
827 Color command
828 -------------
830 Color commands control highlighting and the user interface styles. If your
831 terminal supports color, these commands can be used to assign foreground and
832 background combinations to certain areas. Optionally, an attribute can be
833 given as the last parameter. The syntax is:
835 [verse]
836 *color* 'area' 'fgcolor' 'bgcolor' '[attributes]'
838 Examples:
839 // TEST: tigrc
840 ------------------------------------------------------------------------------
841 # Override the default terminal colors to white on black.
842 color default           white   black
843 # Diff colors
844 color diff-header       yellow  default
845 color diff-index        blue    default
846 color diff-chunk        magenta default
847 color "Reported-by:"    green   default
848 # View specific color
849 color tree.date         black   cyan    bold
850 --------------------------------------------------------------------------
852 Or in the Git configuration files:
853 // TEST: gitconfig
854 --------------------------------------------------------------------------
855 [tig "color"]
856         # A strange looking cursor line
857         cursor          = red   default underline
858         # UI colors
859         title-blur      = white blue
860         title-focus     = white blue    bold
861 # View specific color
862 [tig "color.tree"]
863         date            = cyan  default bold
864 ------------------------------------------------------------------------------
866 Area names::
868         Can be either a built-in area name or a custom quoted string. The
869         latter allows custom color rules to be added for lines matching a
870         quoted string.
871         Valid built-in area names are described below. Note, all names are
872         case-insensitive, and you may use '-', and '_' interchangeably,
873         e.g. "Diff-Header" and "DIFF_HEADER" are the same.
874         View specific colors can be defined by prefixing the view name to
875         the area name, e.g. "stage.diff-chunk" and "diff.diff-chunk".
877 Color names::
879         Valid colors include: *white*, *black*, *green*, *magenta*, *blue*,
880         *cyan*, *yellow*, *red*, *default*. Use *default* to refer to the
881         default terminal colors, for example, to keep the background
882         transparent when you are using a terminal with a transparent
883         background.
885 Colors can also be specified using the keywords *color0*, *color1*, ...,
886 *colorN-1* (where *N* is the number of colors supported by your terminal).
887 This is useful when you remap the colors for your display or want to enable
888 colors supported by 88-color and 256-color terminals. Note that the 'color'
889 prefix is optional. If you prefer, you can specify colors directly by their
890 numbers *0*, *1*, ..., *N-1* instead, just like in the configuration file of
891 Git.
893 Attribute names::
895         Valid attributes include: *normal*, *blink*, *bold*, *dim*, *reverse*,
896         *standout*, and *underline*. Note, not all attributes may be supported
897         by the terminal.
899 UI colors
900 ~~~~~~~~~
902 The colors and attributes to be used for the text that is not highlighted or
903 that specify the use of the default terminal colors can be controlled by
904 setting the *default* color option.
906 .General
907 [frame="none",grid="none",cols="25<m,75<"]
908 |=============================================================================
909 |default                |Override default terminal colors (see above).
910 |cursor                 |The cursor line.
911 |status                 |The status window showing info messages.
912 |title-focus            |The title window for the current view.
913 |title-blur             |The title window of any backgrounded view.
914 |search-result          |Highlighted search result.
915 |delimiter              |Delimiter shown for truncated lines.
916 |header                 |The view header lines. Use 'status.header' to color
917                          the staged, unstaged, and untracked sections in the
918                          status view. Use 'help.header' to color the keymap
919                          sections in the help view.
920 |line-number            |Line numbers.
921 |id                     |The commit ID.
922 |date                   |The author date.
923 |author                 |The commit author.
924 |mode                   |The file mode holding the permissions and type.
925 |overflow               |Title text overflow.
926 |directory              |The directory name.
927 |file                   |The file name.
928 |file-size              |File size.
929 |=============================================================================
931 .Main view colors
932 [frame="none",grid="none",cols="25<m,75<"]
933 |=============================================================================
934 |graph-commit           |The commit dot in the revision graph.
935 |palette-[0-13]         |14 different colors, used for distinguishing branches
936                          or commits. By default, the palette uses the ASCII
937                          colors, where the second half of them have the bold
938                          attribute enabled to give a brighter color.
939                          Example: palette-0 = red
940 |main-commit            |The commit comment.
941 |main-head              |Label of the current branch.
942 |main-remote            |Label of a remote.
943 |main-tracked           |Label of the remote tracked by the current branch.
944 |main-tag               |Label of a signed tag.
945 |main-local-tag         |Label of a local tag.
946 |main-ref               |Label of any other reference.
947 |main-replace           |Label of replaced reference.
948 |=============================================================================
950 .Status view
951 [frame="none",grid="none",cols="25<m,75<"]
952 |=============================================================================
953 |stat-none              |Empty status label.
954 |stat-staged            |Status flag of staged files.
955 |stat-unstaged          |Status flag of unstaged files.
956 |stat-untracked         |Status flag of untracked files.
957 |=============================================================================
959 .Help view
960 [frame="none",grid="none",cols="25<m,75<"]
961 |=============================================================================
962 |help-group             |Help group name.
963 |help-action            |Help action name.
964 |=============================================================================
966 Highlighting
967 ~~~~~~~~~~~~
971 Diff markup::
973 Options concerning diff start, chunks and lines added and deleted.
975 *diff-header*, *diff-chunk*, *diff-add*, *diff-add2*, *diff-del*,
976 *diff-del2*
978 Enhanced Git diff markup::
980 Extra diff information emitted by the Git diff machinery, such as mode
981 changes, rename detection, and similarity.
983 *diff-oldmode*, *diff-newmode*, *diff-copy-from*, *diff-copy-to*,
984 *diff-similarity*, *diff-index*
986 Pretty print commit headers::
988 Commit diffs and the revision logs are usually formatted using pretty printed
989 headers , unless `--pretty=raw` was given. This includes lines, such as merge
990 info, commit ID, and author and committer date.
992 *pp-refs*, *pp-reflog*, *pp-reflogmsg*, *pp-merge*
994 Raw commit header::
996 Usually shown when `--pretty=raw` is given, however 'commit' is pretty much
997 omnipresent.
999 *commit*, *parent*, *tree*, *author*, *committer*
1001 Commit message::
1003 `Signed-off-by`, `Acked-by`, `Reviewed-by` and `Tested-by` lines are colorized.
1004 Characters in the commit title exceeding a predefined width can be highlighted.
1007 Tree markup::
1009 Colors for information of the tree view.
1011 *tree-dir*, *tree-file*
1015 Source command
1016 -------------
1018 Source commands make it possible to read additional configuration files.
1019 Sourced files are included in-place, meaning when a 'source' command is
1020 encountered the file will be immediately read. Any commands later in the
1021 current configuration file will take precedence. The syntax is:
1023 [verse]
1024 *source* 'path'
1026 Examples:
1027 // TEST: tigrc
1028 --------------------------------------------------------------------------
1029 source ~/.tig/colorscheme.tigrc
1030 source ~/.tig/keybindings.tigrc
1031 --------------------------------------------------------------------------
1033 COPYRIGHT
1034 ---------
1035 Copyright (c) 2006-2014 Jonas Fonseca <jonas.fonseca@gmail.com>
1037 This program is free software; you can redistribute it and/or modify
1038 it under the terms of the GNU General Public License as published by
1039 the Free Software Foundation; either version 2 of the License, or
1040 (at your option) any later version.
1042 SEE ALSO
1043 --------
1044 ifndef::backend-docbook[]
1045 link:tig.1.{docext}[tig(1)],
1046 link:manual.{docext}[the Tig manual],
1047 endif::backend-docbook[]
1048 ifdef::backend-docbook[]
1049 manpage:tig[1],
1050 manpage:tigmanual[7],
1051 endif::backend-docbook[]
1052 git(7), git-config(1)