# ref: # https://qiita.com/sfus/items/063797a1dd8fdc7d032f # https://github.com/jonas/tig/wiki/Bindings #==================== # geineric #==================== bind generic g none bind generic gg move-first-line bind generic G move-last-line bind generic scroll-left bind generic none bind generic scroll-right # toggle/copy commit id bind generic xx +sh -c "echo -n %(commit) | head -c7 | xclip -sel c && echo Commit Clipped!" bind generic xc +sh -c "echo -n %(commit) | xclip -sel c && echo Full Commit Clipped!" bind generic xb +sh -c "echo -n %(branch) | xclip -sel c && echo Branch Clipped!" bind generic xf +sh -c "echo -n %(file) | xclip -sel c && echo File Clipped" bind generic gr view-grep # toggle case sensitive for search bind generic w :toggle ignore-case # override refresh bind generic R none bind generic refresh # see reflog, reset refernece bind generic L >sh -c "git reflog --pretty=raw | tig --pretty=raw" bind generic ; ?git reset --hard HEAD@{"%(prompt Enter HEAD@{} number: )"} # highlight diff without +/- set diff-show-signs = false set diff_column_highlight = ALL # misc settings set ignore-case = true set line-graphics = utf-8 set refresh-mode = auto #==================== # main view #==================== set main-view = \ date:relative \ author:abbreviated \ id \ commit-title:graph=v2,refs=true # override graph toggling bind main G none bind main G move-last-line bind main ` :toggle commit-title-graph bind main gh :goto HEAD bind main o :goto %(commit)^2 # branch bind main b none bind main bn @git branch "%(prompt Enter branch name: )" %(commit) bind main bd @git branch -d "%(prompt Delete branch: )" bind main btd @git branch -d %(branch) bind main bD ?>git branch -D "%(prompt Delete branch anyway: )" bind main btD ?>git branch -D %(branch) bind main bv +sh -c "git branch -vv | grep %(branch)" bind main c @sh -c "git branch --points-at=%(commit) | \ sed -n '/^*/ {n;p}' | \ (cat -; echo %(commit)) | \ head -1 | \ xargs git checkout" # commit bind main a ?>git commit --amend bind main 3 >git commit --allow-empty -m "%(prompt Empty commit, enter message: )" # merge bind main m ?git merge %(commit) bind main M ?git merge %(branch) --no-ff # push bind main p none bind main pp ?git push bind main pP ?git push -u %(remote) %(branch):%(branch) bind main pr ?git push -u '%(prompt Which remote? )' %(branch):%(branch) bind main pd ?git push %(remote) :%(branch) # reset/rebase/revert bind main u ?git reset %(commit) bind main U ?sh -c "git reset %(commit) && git stash push -m 'deprecated from reset'" bind main xu ?git reset %(commit) --hard bind main R !?git rebase -i %(commit) bind main ! ?git revert %(commit) # tag bind main Tn @git tag "%(prompt Enter tag name: )" %(commit) bind main TN !git tag "%(prompt Enter tag name: )" %(commit) -a bind main Ts >tig show %(tag) bind main Td @git tag -d "%(prompt Delete tag: )" bind main Tp ?git push --tags bind main gdt @git tag -d %(tag) # android bind main B !sh scripts/bump_version.sh bind main V @git log -S "%(prompt Enter search word: )" # make patches bind main S ?>git format-patch -1 %(commit) bind main ?>git format-patch %(commit) # show diff based on revision bind main . >sh -c "git diff %(commit) | tig" bind main > >sh -c "git diff %(commit) --no-prefix -U1000 | tig" # note bind generic gn !git notes edit %(commit) #==================== # blame view #==================== bind blame m >tig %(file) bind blame xx +sh -c "echo -n %(blob) | head -c7 | xclip -sel c && Blob Clipped" bind blame xb +sh -c "echo -n %(blob) | xclip -sel c && Full Blob Clipped" set blame-view = author:abbreviated date:relative id:yes,color line-number:yes text #==================== # blob view #==================== bind blob m >tig %(file) #==================== # status view #==================== bind status j :/^[MADRU?] bind status k :?^[MADRU?] # stash bind status s ?>git stash bind status S @git stash push -m "%(prompt Enter stash name: )" bind status gs !git stashstaged bind status U !git checkout --patch -- %(file) # quick commit bind status c @git commit -m "%(prompt Enter commit message: )" bind status a ?>git commit --amend bind status p ?>sh -c "git commit -m 'update' && git push" bind status D ?>rm %(file) # solve conflict bind status Ra @git rebase --abort bind status Rc @git rebase --continue bind status !sh -c "git difftool -y \"$(git rev-parse --show-toplevel)/%(file)\"" bind status Tu @git update-index --assume-unchanged %(file) # apply patch file bind status ?git am %(file) #==================== # stash view #==================== bind stash a ?git stash apply %(stash) bind stash d ?>git stash drop %(stash) # rename a stash bind stash n @sh -c "git stash drop %(stash) | \ awk '{print $3}' | \ tr -d '()' | \ xargs git stash store -m '%(prompt Enter stash name: )'" #==================== # stage view #==================== bind stage :/^@@ bind stage :?^@@ bind stage n :/^diff --(git|cc) bind stage p :?^diff --(git|cc) #==================== # tree view #==================== set tree-view = author:abbreviated date:relative mode file-size:units id:no file-name bind tree t +git cat-file -p %(commit) bind tree d ?rm %(file) bind tree m >tig %(file) bind tree xx +sh -c "echo -n %(blob) | head -c7 | xclip -sel c && echo Blob Clipped" bind tree xb +sh -c "echo -n %(blob) | xclip -sel c && echo Full Blob Clipped" bind tree xt +sh -c "git cat-file -p %(commit) | head -1 | cut -f 2 -d ' ' | xclip -sel c && echo Tree Clipped" bind tree xc +sh -c "echo -n %(commit) | head -c7 | xclip -sel c && echo Commit Clipped" #==================== # refs view #==================== bind refs C none bind refs c @git checkout %(branch) bind refs b none bind refs bd @git branch -d %(branch) bind refs bD ?git branch -D %(branch) bind refs pd ?git push %(remote) :%(branch) bind refs r none bind refs rbu ?git branch -rd %(remote)/%(branch) bind refs U ?git fetch --all bind refs F ?git fetch %(remote) bind refs ?git fetch %(remote) %(branch) bind refs . >sh -c "git diff %(branch) | tig" bind refs > >sh -c "git diff %(branch) --prefix -U1000 | tig" #==================== # log view #==================== bind log n :/^commit bind log p :?^commit #==================== # diff view #==================== bind diff n :/^diff --(git|cc) bind diff p :?^diff --(git|cc) #==================== # help view #==================== # edit tigrc bind help e >sh -c "vim ~/.tigrc" bind help :source ~/.tigrc #==================== # color #==================== color diff-chunk white magenta