--- /dev/null
+##
+# bash completion support for tig
+#
+# Copyright (C) 2007-2010 Jonas fonseca
+# Copyright (C) 2006,2007 Shawn Pearce
+#
+# Based git's git-completion.sh: http://repo.or.cz/w/git/fastimport.git
+#
+# The contained completion routines provide support for completing:
+#
+# *) local and remote branch names
+# *) local and remote tag names
+# *) tig 'subcommands'
+# *) tree paths within 'ref:path/to/file' expressions
+#
+# To use these routines:
+#
+# 1) Copy this file to somewhere (e.g. ~/.tig-completion.sh).
+# 2) Added the following line to your .bashrc:
+# source ~/.tig-completion.sh
+#
+# 3) You may want to make sure the git executable is available
+# in your PATH before this script is sourced, as some caching
+# is performed while the script loads. If git isn't found
+# at source time then all lookups will be done on demand,
+# which may be slightly slower.
+#
+
+__tigdir ()
+{
+ if [ -z "$1" ]; then
+ if [ -n "$__git_dir" ]; then
+ echo "$__git_dir"
+ elif [ -d .git ]; then
+ echo .git
+ else
+ git rev-parse --git-dir 2>/dev/null
+ fi
+ elif [ -d "$1/.git" ]; then
+ echo "$1/.git"
+ else
+ echo "$1"
+ fi
+}
+
+_tigcomp ()
+{
+ local all c s=$'\n' IFS=' '$'\t'$'\n'
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ if [ $# -gt 2 ]; then
+ cur="$3"
+ fi
+ for c in $1; do
+ case "$c$4" in
+ --*=*) all="$all$c$4$s" ;;
+ *.) all="$all$c$4$s" ;;
+ *) all="$all$c$4 $s" ;;
+ esac
+ done
+ IFS=$s
+ COMPREPLY=($(compgen -P "$2" -W "$all" -- "$cur"))
+ return
+}
+
+__tig_refs ()
+{
+ local cmd i is_hash=y dir="$(__tigdir "$1")"
+ if [ -d "$dir" ]; then
+ for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do
+ if [ -e "$dir/$i" ]; then echo $i; fi
+ done
+ for i in $(git --git-dir="$dir" \
+ for-each-ref --format='%(refname)' \
+ refs/tags refs/heads refs/remotes); do
+ case "$i" in
+ refs/tags/*) echo "${i#refs/tags/}" ;;
+ refs/heads/*) echo "${i#refs/heads/}" ;;
+ refs/remotes/*) echo "${i#refs/remotes/}" ;;
+ *) echo "$i" ;;
+ esac
+ done
+ return
+ fi
+ for i in $(git-ls-remote "$dir" 2>/dev/null); do
+ case "$is_hash,$i" in
+ y,*) is_hash=n ;;
+ n,*^{}) is_hash=y ;;
+ n,refs/tags/*) is_hash=y; echo "${i#refs/tags/}" ;;
+ n,refs/heads/*) is_hash=y; echo "${i#refs/heads/}" ;;
+ n,refs/remotes/*) is_hash=y; echo "${i#refs/remotes/}" ;;
+ n,*) is_hash=y; echo "$i" ;;
+ esac
+ done
+}
+
+__tig_complete_file ()
+{
+ local pfx ls ref cur="${COMP_WORDS[COMP_CWORD]}"
+ case "$cur" in
+ ?*:*)
+ ref="${cur%%:*}"
+ cur="${cur#*:}"
+ case "$cur" in
+ ?*/*)
+ pfx="${cur%/*}"
+ cur="${cur##*/}"
+ ls="$ref:$pfx"
+ pfx="$pfx/"
+ ;;
+ *)
+ ls="$ref"
+ ;;
+ esac
+ COMPREPLY=($(compgen -P "$pfx" \
+ -W "$(git --git-dir="$(__tigdir)" ls-tree "$ls" \
+ | sed '/^100... blob /s,^.* ,,
+ /^040000 tree /{
+ s,^.* ,,
+ s,$,/,
+ }
+ s/^.* //')" \
+ -- "$cur"))
+ ;;
+ *)
+ _tigcomp "$(__tig_refs)"
+ ;;
+ esac
+}
+
+__tig_complete_revlist ()
+{
+ local pfx cur="${COMP_WORDS[COMP_CWORD]}"
+ case "$cur" in
+ *...*)
+ pfx="${cur%...*}..."
+ cur="${cur#*...}"
+ _tigcomp "$(__tig_refs)" "$pfx" "$cur"
+ ;;
+ *..*)
+ pfx="${cur%..*}.."
+ cur="${cur#*..}"
+ _tigcomp "$(__tig_refs)" "$pfx" "$cur"
+ ;;
+ *.)
+ _tigcomp "$cur."
+ ;;
+ *)
+ _tigcomp "$(__tig_refs)"
+ ;;
+ esac
+}
+
+_tig_options ()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ case "$cur" in
+ --pretty=*)
+ _tigcomp "
+ oneline short medium full fuller email raw
+ " "" "${cur##--pretty=}"
+ return
+ ;;
+ --*)
+ _tigcomp "
+ --max-count= --max-age= --since= --after=
+ --min-age= --before= --until=
+ --root --not --topo-order --date-order
+ --no-merges
+ --abbrev-commit --abbrev=
+ --relative-date
+ --author= --committer= --grep=
+ --all-match
+ --pretty= --name-status --name-only
+ --not --all
+ --help --version
+ "
+ return
+ ;;
+ -*)
+ _tigcomp "-v -h"
+ return
+ ;;
+ esac
+ __tig_complete_revlist
+}
+
+_tig_blame ()
+{
+ local reply="" ref=HEAD cur="${COMP_WORDS[COMP_CWORD]}"
+
+ if test "$COMP_CWORD" -lt 3; then
+ reply="$(__tig_refs)"
+ else
+ ref="${COMP_WORDS[2]}"
+ fi
+
+ reply="$reply $(git --git-dir="$(__tigdir)" ls-tree "$ref" \
+ | sed '/^100... blob /s,^.* ,,
+ /^040000 tree /{
+ s,^.* ,,
+ s,$,/,
+ }
+ s/^.* //')"
+ _tigcomp "$reply"
+}
+
+_tig_show ()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ case "$cur" in
+ --pretty=*)
+ _tigcomp "
+ oneline short medium full fuller email raw
+ " "" "${cur##--pretty=}"
+ return
+ ;;
+ --*)
+ _tigcomp "--pretty="
+ return
+ ;;
+ esac
+ __tig_complete_file
+}
+
+_tig ()
+{
+ local i c=1 command __tig_dir
+
+ while [ $c -lt $COMP_CWORD ]; do
+ i="${COMP_WORDS[c]}"
+ case "$i" in
+ --) command="log"; break;;
+ -*) ;;
+ *) command="$i"; break ;;
+ esac
+ c=$((++c))
+ done
+
+ if [ $c -eq $COMP_CWORD -a -z "$command" ]; then
+ case "${COMP_WORDS[COMP_CWORD]}" in
+ --*=*) COMPREPLY=() ;;
+ -*) _tig_options ;;
+ *) _tigcomp "blame status show log stash grep $(__tig_refs)" ;;
+ esac
+ return
+ fi
+
+ case "$command" in
+ blame) _tig_blame ;;
+ show) _tig_show ;;
+ status) ;;
+ *) _tigcomp "
+ $(__tig_complete_file)
+ $(__tig_refs)
+ " ;;
+ esac
+}
+
+# Detect if current shell is ZSH, and if so, load this file in bash
+# compatibility mode.
+if [ -n "$ZSH_VERSION" ]; then
+ autoload bashcompinit
+ bashcompinit
+fi
+
+complete -o default -o nospace -F _tig tig
+
+# The following are necessary only for Cygwin, and only are needed
+# when the user has tab-completed the executable name and consequently
+# included the '.exe' suffix.
+if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then
+complete -o default -o nospace -F _tig tig.exe
+fi
--- /dev/null
+# Tig default configuration
+#
+# Please see 'man tigrc' for a complete reference.
+
+# Settings
+# --------
+# Most of these settings can be toggleable, either via the toggle-*
+# actions or via the option menu (bound to `o` by default).
+
+# View settings
+#
+# Supported column types and their options:
+#
+# author
+# - display (enum) [no|full|abbreviated|email|email-user]
+# : Show author information?
+# commit-title
+# - display (bool) : Show the commit title?
+# - graph (bool) : Show the commit revision graph? (main view only)
+# - refs (bool) : Show branches, tags and remotes? (main view only)
+# - overflow (boolint) : Highlight overflows? Default to 50 when enabled.
+#
+# date
+# - display (enum) [no|default|local|relative|short]
+# : Show dates?
+# file-name
+# - display (enum) [no|always|auto] : Show file names?
+#
+# file-size
+# - display (enum) [no|default|units] : Show file sizes?
+#
+# id
+# - display (bool) : Show commit/tree ID?
+#
+# line-number
+# - display (bool) : Show line numbers?
+# - interval (int) : Interval between line numbers
+#
+# mode
+# - display (bool) : Show file modes?
+#
+# status
+# - display (enum) [no|short|long] : Show status label?
+#
+# text
+# - display (bool) : Show text?
+# - commit-title-overflow (boolint) : Highlight overflow in log and diff view?
+#
+# All columns also support a width option to configure the max width of
+# the column. Use zero (the default value) to auto-size the column based
+# on the content.
+
+set blame-view = date:default author:full file-name:auto id:yes,color line-number:no,interval=5 text
+set grep-view = file-name:no line-number:yes,interval=1 text
+set main-view = line-number:no,interval=5 id:no date:default author:full commit-title:yes,graph,refs,overflow=no
+set refs-view = date:default author:full ref commit-title
+set stash-view = line-number:no,interval=5 id:no date:default author:full commit-title
+set status-view = line-number:no,interval=5 status:short file-name
+set tree-view = line-number:no,interval=5 mode author:full file-size date:default id:no file-name
+
+# Pager based views
+set pager-view = line-number:no,interval=5 text
+set stage-view = line-number:no,interval=5 text
+set log-view = line-number:no,interval=5 text
+set blob-view = line-number:no,interval=5 text
+set diff-view = line-number:no,interval=5 text:yes,commit-title-overflow=no
+
+# UI display settings
+set show-changes = yes # Show changes commits in the main view?
+set wrap-lines = no # Wrap long lines in pager views?
+set tab-size = 8 # Number of spaces to use when expanding tabs
+set line-graphics = default # Enum: ascii, default, utf-8
+
+# Format reference names based on type.
+# - head : The current HEAD.
+# - tag : A signed tag.
+# - local-tag : An unsigned tag.
+# - remote : A remote.
+# - tracked-remote : The remote tracked by current HEAD.
+# - replace : A replaced reference.
+# - branch : Any other reference.
+# If no format is defined for `local-tag` then the one for `tag` is used.
+# Similarly, `remote` is used if no `tracked-remote` format exists.
+# Prefix with `hide:` to not show that reference type, e.g. `hide:remote`.
+# Expects a space separated list of format strings.
+set reference-format = [branch] <tag> {remote} ~replace~
+
+# Settings controlling how content is read from Git
+set commit-order = default # Enum: default, topo, date, reverse (main)
+set status-untracked-dirs = yes # Show files in untracked directories? (status)
+set ignore-space = no # Enum: no, all, some, at-eol (diff)
+set show-notes = yes # When non-bool passed as `--show-notes=...` (diff)
+#set diff-context = 3 # Number of lines to show around diff changes (diff)
+#set diff-options = -C # User-defined options for `tig show` (diff)
+#set blame-options = -C -C -C # User-defined options for `tig blame` (blame)
+
+# Misc
+set refresh-mode = auto # Enum: manual, auto, after-command, periodic
+set refresh-interval = 10 # Interval in seconds between refreshes
+set ignore-case = no # Ignore case when searching?
+set focus-child = yes # Move focus to child view when opened?
+set horizontal-scroll = 50% # Number of columns to scroll as % of width
+set split-view-height = 67% # Number of lines for bottom view as % of height
+set vertical-split = auto # Enum: horizontal, vertical, auto; Use auto to
+ # switch to horizontal split when width allows it
+set editor-line-number = yes # Automatically pass line number to editor? Used
+ # for opening file at specific line e.g. from a diff
+set mouse = no # Enable mouse support?
+set mouse-scroll = 3 # Number of lines to scroll via the mouse
+
+# User-defined commands
+# ---------------------
+# These commands allow to run shell commands directly from within Tig.
+# Unless otherwise specified, commands are run in the foreground with
+# their console output shown (as if '!' was specified). When multiple
+# command options are specified their behavior are combined, e.g. "?<git
+# commit" will prompt the user whether to execute the command and will
+# exit Tig after completion.
+#
+# ! Run the command in the foreground with output shown.
+# @ Run the command in the background with no output.
+# ? Prompt the user before executing the command.
+# < Exit Tig after executing the command.
+#
+# User-defined commands can optionally refer to Tig's internal state
+# using the following variable names, which are substituted before
+# commands are run:
+#
+# %(head) The current ref ID. Defaults to HEAD
+# %(commit) The current commit ID.
+# %(blob) The current blob ID.
+# %(branch) The current branch name.
+# %(remote) The current remote name.
+# %(tag) The current tag name.
+# %(stash) The current stash name.
+# %(directory) The current directory path in the tree view;
+# empty for the root directory.
+# %(file) The currently selected file.
+# %(ref) The reference given to blame or HEAD if undefined.
+# %(revargs) The revision arguments passed on the command line.
+# %(fileargs) The file arguments passed on the command line.
+# %(cmdlineargs) All other options passed on the command line.
+# %(diffargs) The diff options from `diff-options` or `TIG_DIFF_OPTS`
+# %(prompt) Prompt for the argument value.
+
+bind main C ?git cherry-pick %(commit)
+bind status C !git commit
+bind stash P ?git stash pop %(stash)
+bind stash ! ?git stash drop %(stash)
+bind refs C ?git checkout %(branch)
+bind refs ! ?git branch -D %(branch)
+
+# Normal commands
+# ---------------
+
+# View switching
+bind generic m view-main
+bind generic d view-diff
+bind generic l view-log
+bind generic t view-tree
+bind generic f view-blob
+bind generic b view-blame
+bind generic r view-refs
+bind generic p view-pager
+bind generic h view-help
+bind generic s view-status
+bind generic S view-status # Compat binding to avoid going crazy!
+bind generic c view-stage
+bind generic y view-stash
+bind generic g view-grep
+
+# View manipulation
+bind generic <Enter> enter # Enter and open selected entry
+bind generic <Lt> back # Go back to the previous view state
+bind generic <Down> next # Move to next
+bind generic <C-N> next
+bind generic <Up> previous # Move to previous
+bind generic <C-P> previous
+bind generic , parent # Move to parent
+bind generic <Tab> view-next # Move focus to the next view
+bind generic R refresh # Reload and refresh view
+bind generic <F5> refresh
+bind generic O maximize # Maximize the current view
+bind generic q view-close # Close the current view
+bind generic Q quit # Close all views and quit
+
+# View specific
+bind status u status-update # Stage/unstage changes in file
+bind status ! status-revert # Revert changes in file
+bind status M status-merge # Open git-mergetool(1)
+#bind status ??? :toggle status # Show short or long status labels
+bind stage u status-update # Stage/unstage current diff (c)hunk
+bind stage 1 stage-update-line # Stage/unstage current line
+bind stage ! status-revert # Revert current diff (c)hunk
+bind stage \ stage-split-chunk # Split current diff (c)hunk
+bind stage @ :/^@@ # Jump to next (c)hunk
+bind stage [ :toggle diff-context -1 # Decrease the diff context
+bind stage ] :toggle diff-context +1 # Increase the diff context
+bind diff @ :/^@@ # Jump to next (c)hunk
+bind diff [ :toggle diff-context -1
+bind diff ] :toggle diff-context +1
+bind main G :toggle commit-title-graph # Toggle revision graph visualization
+bind main F :toggle commit-title-refs # Toggle reference display (tags/branches)
+
+# Cursor navigation
+bind generic k move-up
+bind generic j move-down
+bind generic <PgDown> move-page-down
+bind generic <C-D> move-page-down
+bind generic <Space> move-page-down
+bind generic <PgUp> move-page-up
+bind generic <C-U> move-page-up
+bind generic - move-page-up
+bind generic <Home> move-first-line
+bind generic <End> move-last-line
+
+# Scrolling
+bind generic | scroll-first-col
+bind generic <Left> scroll-left
+bind generic <Right> scroll-right
+bind generic <Ins> scroll-line-up
+bind generic <C-Y> scroll-line-up
+bind generic <Del> scroll-line-down
+bind generic <C-E> scroll-line-down
+bind generic <SBack> scroll-page-up
+bind generic <SFwd> scroll-page-down
+
+# Searching
+bind generic / search
+bind generic ? search-back
+bind generic n find-next
+bind generic N find-prev
+
+# Option manipulation
+bind generic o options # Open the options menu
+# Bindings for toggling settings
+bind generic I :toggle sort-order # Toggle ascending/descending sort order
+bind generic i :toggle sort-field # Toggle field to sort by
+bind generic <Hash> :toggle line-number # Toggle line numbers
+bind generic D :toggle date # Toggle date display
+bind generic A :toggle author # Toggle author display
+bind generic ~ :toggle line-graphics # Toggle (line) graphics mode
+bind generic F :toggle file-name # Toggle file name display
+# bind generic ??? :toogle show-changes # Toggle local changes display in the main view
+bind generic W :toggle ignore-space # Toggle ignoring whitespace in diffs
+# bind generic ? :toggle commit-order # Toggle commit ordering
+bind generic X :toggle id # Toggle commit ID display
+bind generic $ :toggle commit-title-overflow
+ # Toggle highlighting of commit title overflow
+# bind generic ??? :toggle file-size # Toggle file size format
+# bind generic ??? :toggle status # Toggle status display
+# bind generic ??? :toggle status-untracked-dirs
+ # Toggle display of file in untracked directories
+# bind generic ??? :toggle vertical-split # Toggle vertical split
+bind generic % :toggle file-filter
+
+# Misc
+bind generic e edit # Open in editor
+bind generic : prompt # Open the prompt
+bind generic <C-L> screen-redraw # Redraw the screen
+bind generic z stop-loading # Stop all loading views
+bind generic v show-version # Show Tig version
+
+# Colors
+# ------
+
+# The colors in the UI can be customized. In addition to the colors used
+# for the UI you can also define new colors to use in the pager, blob,
+# diff, and stage views by placing the text to match for in quotes.
+#
+# Prefix the name of a view to set a color only for that view, e.g.
+#
+# color grep.file blue default
+#
+# As an example, this setting will to color Signed-off-by lines with a
+# yellow foreground color and use the default background color.
+#
+# color " Signed-off-by" yellow default
+#
+# Note the four leading spaces in the string to match. This is because
+# Git automatically indents commit messages by four spaces.
+
+color "diff --" yellow default
+color "@@" magenta default
+color "+" green default
+color " +" green default
+color "-" red default
+color " -" red default
+color "index " blue default
+color "old file mode " yellow default
+color "new file mode " yellow default
+color "deleted file mode " yellow default
+color "copy from " yellow default
+color "copy to " yellow default
+color "rename from " yellow default
+color "rename to " yellow default
+color "similarity " yellow default
+color "dissimilarity " yellow default
+color "diff-tree " blue default
+color "Author: " cyan default
+color "Commit: " magenta default
+color "Tagger: " magenta default
+color "Merge: " blue default
+color "Date: " yellow default
+color "AuthorDate: " yellow default
+color "CommitDate: " yellow default
+color "TaggerDate: " yellow default
+color "Refs: " red default
+color "Reflog: " red default
+color "Reflog message: " yellow default
+color "stash@{" magenta default
+color "commit " green default
+color "parent " blue default
+color "tree " blue default
+color "author " green default
+color "committer " magenta default
+color " Signed-off-by" yellow default
+color " Acked-by" yellow default
+color " Tested-by" yellow default
+color " Reviewed-by" yellow default
+color default default default normal
+color cursor white green bold
+color status green default
+color delimiter magenta default
+color date blue default
+color mode cyan default
+color id magenta default
+color overflow red default
+color header yellow default
+color section cyan default
+color directory yellow default
+color file default default
+color grep.file blue default
+color file-size default default
+color line-number cyan default
+color title-blur white blue
+color title-focus white blue bold
+color main-commit default default
+color main-tag magenta default bold
+color main-local-tag magenta default
+color main-remote yellow default
+color main-replace cyan default
+color main-tracked yellow default bold
+color main-ref cyan default
+color main-head cyan default bold
+color stat-none default default
+color stat-staged magenta default
+color stat-unstaged magenta default
+color stat-untracked magenta default
+color help-group blue default
+color help-action yellow default
+color diff-stat blue default
+color palette-0 magenta default
+color palette-1 yellow default
+color palette-2 cyan default
+color palette-3 green default
+color palette-4 default default
+color palette-5 white default
+color palette-6 red default
+color graph-commit blue default
+
+# Mappings for colors read from git configuration.
+# Set to "no" to disable.
+set git-colors = \
+ branch.current=main-head \
+ branch.local=main-ref \
+ branch.plain=main-ref \
+ branch.remote=main-remote \
+ \
+ diff.meta=diff-header \
+ diff.meta=diff-index \
+ diff.meta=diff-oldmode \
+ diff.meta=diff-newmode \
+ diff.frag=diff-chunk \
+ diff.old=diff-del \
+ diff.new=diff-add \
+ \
+ grep.filename=grep.file \
+ grep.linenumber=grep.line-number \
+ grep.separator=grep.delimiter \
+ \
+ status.branch=status.header \
+ status.added=stat-staged \
+ status.updated=stat-staged \
+ status.changed=stat-unstaged \
+ status.untracked=stat-untracked