Skip to content

Instantly share code, notes, and snippets.

@vitalybe
Created June 27, 2017 05:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vitalybe/a104a864c665908ef710c0bc260ee112 to your computer and use it in GitHub Desktop.
Save vitalybe/a104a864c665908ef710c0bc260ee112 to your computer and use it in GitHub Desktop.
My .tigrc
#########
# GENERIC
#########
# git - generic
bind generic g ?sh -c "git %(prompt git )"
######
# MAIN
######
# compare commit in log view with its parent per http://stackoverflow.com/questions/436362/shorthand-for-diff-of-git-commit-with-its-parent
bind main <F4> !git difftool -d %(commit)^!
# first key press creates compare-base, second key compares base to selected commit
bind main <F5> @git tig-compare-commits %(commit)
# create new branch
bind main <Ctrl-b> @git branch "%(prompt Enter new branch name: )" %(commit)
# copy commit hash
bind main C @sh -c "printf %(commit) | tr -d '\n' | pbcopy" # Mac
########
# STATUS
########
# compare selected file in status view. need to use revpase since %(file) is always relative to root but current directory might be nested in root already
bind status <F4> !sh -c "git difftool -y \"$(git rev-parse --show-toplevel)/%(file)\""
# add selected file to .gitignore
bind status <Ctrl-r> !sh -c "echo %(file) >> .gitignore && vi .gitignore"
# git --amend
bind status A !git commit --amend
# delete a
bind status D ?sh -c "rm \"$(git rev-parse --show-toplevel)/%(file)\""
# preview commit
bind status P !git commit-preview
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment