diff options
author | typebrook <typebrook@gmail.com> | 2019-03-27 09:39:07 +0800 |
---|---|---|
committer | typebrook <typebrook@gmail.com> | 2019-03-27 09:39:07 +0800 |
commit | 875767033d54b4e52d4009843a0cf4f9e176bbae (patch) | |
tree | 3a573434120af08d6550029852cb1c616c84cf93 /tigrc | |
parent | d0a5817fcede7663924bc775d8968a6db3ef8743 (diff) |
update
Diffstat (limited to 'tigrc')
-rw-r--r-- | tigrc | 42 |
1 files changed, 41 insertions, 1 deletions
@@ -2,21 +2,27 @@ | |||
2 | # https://qiita.com/sfus/items/063797a1dd8fdc7d032f | 2 | # https://qiita.com/sfus/items/063797a1dd8fdc7d032f |
3 | # https://github.com/jonas/tig/wiki/Bindings | 3 | # https://github.com/jonas/tig/wiki/Bindings |
4 | 4 | ||
5 | #==================== | ||
5 | # geineric | 6 | # geineric |
7 | #==================== | ||
6 | bind generic g none | 8 | bind generic g none |
7 | bind generic gg move-first-line | 9 | bind generic gg move-first-line |
8 | bind generic G move-last-line | 10 | bind generic G move-last-line |
9 | 11 | ||
12 | # toggle/copy commit id | ||
10 | bind generic x :toggle id | 13 | bind generic x :toggle id |
11 | bind generic 9 !@sh -c "echo -n %(commit) | head -c7 | xclip -selection c" | 14 | bind generic 9 !@sh -c "echo -n %(commit) | head -c7 | xclip -selection c" |
12 | 15 | ||
13 | bind generic E view-grep | 16 | bind generic gr view-grep |
14 | 17 | ||
18 | # toggle case sensitive for search | ||
15 | bind generic w :toggle ignore-case | 19 | bind generic w :toggle ignore-case |
16 | 20 | ||
21 | # edit tigrc | ||
17 | bind generic 3 >sh -c "vim ~/.tigrc" | 22 | bind generic 3 >sh -c "vim ~/.tigrc" |
18 | bind generic 4 :source ~/.tigrc | 23 | bind generic 4 :source ~/.tigrc |
19 | 24 | ||
25 | # see reflog, reset refernece | ||
20 | bind generic L >sh -c "git reflog --pretty=raw | tig --pretty=raw" | 26 | bind generic L >sh -c "git reflog --pretty=raw | tig --pretty=raw" |
21 | bind generic ; ?git reset --hard HEAD@{"%(prompt Enter HEAD@{} number: )"} | 27 | bind generic ; ?git reset --hard HEAD@{"%(prompt Enter HEAD@{} number: )"} |
22 | 28 | ||
@@ -24,10 +30,13 @@ set ignore-case = true | |||
24 | set line-graphics = utf-8 | 30 | set line-graphics = utf-8 |
25 | set refresh-mode = after-command | 31 | set refresh-mode = after-command |
26 | 32 | ||
33 | # highlight diff without +/- | ||
27 | set diff-show-signs = false | 34 | set diff-show-signs = false |
28 | set diff_column_highlight = ALL | 35 | set diff_column_highlight = ALL |
29 | 36 | ||
37 | #==================== | ||
30 | # main view | 38 | # main view |
39 | #==================== | ||
31 | set main-view = \ | 40 | set main-view = \ |
32 | date:default \ | 41 | date:default \ |
33 | author:abbreviated \ | 42 | author:abbreviated \ |
@@ -36,6 +45,7 @@ set main-view = \ | |||
36 | 45 | ||
37 | bind main ` :toggle commit-title-graph | 46 | bind main ` :toggle commit-title-graph |
38 | 47 | ||
48 | # branch | ||
39 | bind main b none | 49 | bind main b none |
40 | bind main bn @git branch "%(prompt Enter branch name: )" %(commit) | 50 | bind main bn @git branch "%(prompt Enter branch name: )" %(commit) |
41 | bind main bd @git branch -d "%(prompt Delete branch: )" | 51 | bind main bd @git branch -d "%(prompt Delete branch: )" |
@@ -47,16 +57,21 @@ bind main c @sh -c "git branch --points-at=%(commit) | \ | |||
47 | head -1 | \ | 57 | head -1 | \ |
48 | xargs git checkout" | 58 | xargs git checkout" |
49 | 59 | ||
60 | # merge | ||
50 | bind main m ?git merge %(commit) | 61 | bind main m ?git merge %(commit) |
51 | bind main M ?git merge %(branch) --no-ff | 62 | bind main M ?git merge %(branch) --no-ff |
63 | |||
64 | # push | ||
52 | bind main p ?git push | 65 | bind main p ?git push |
53 | bind main P ?git push %(remote) %(branch):%(branch) | 66 | bind main P ?git push %(remote) %(branch):%(branch) |
54 | 67 | ||
68 | # reset/rebase/revert | ||
55 | bind main u ?git reset %(commit) --soft | 69 | bind main u ?git reset %(commit) --soft |
56 | bind main gu ?git reset %(commit) --hard | 70 | bind main gu ?git reset %(commit) --hard |
57 | bind main <Ctrl-r> !?git rebase -i %(commit) | 71 | bind main <Ctrl-r> !?git rebase -i %(commit) |
58 | bind main ! ?git revert %(commit) | 72 | bind main ! ?git revert %(commit) |
59 | 73 | ||
74 | # tag | ||
60 | bind main Tn @git tag "%(prompt Enter tag name: )" %(commit) | 75 | bind main Tn @git tag "%(prompt Enter tag name: )" %(commit) |
61 | bind main TN !git tag "%(prompt Enter tag name: )" %(commit) -a | 76 | bind main TN !git tag "%(prompt Enter tag name: )" %(commit) -a |
62 | bind main Ts >tig show %(tag) | 77 | bind main Ts >tig show %(tag) |
@@ -64,18 +79,26 @@ bind main Td @git tag -d "%(prompt Delete tag: )" | |||
64 | bind main Tp ?git push --tags | 79 | bind main Tp ?git push --tags |
65 | bind main gdt @git tag -d %(tag) | 80 | bind main gdt @git tag -d %(tag) |
66 | 81 | ||
82 | # android | ||
67 | bind main B !sh scripts/bump_version.sh | 83 | bind main B !sh scripts/bump_version.sh |
68 | bind main V @git log -S "%(prompt Enter search word: )" | 84 | bind main V @git log -S "%(prompt Enter search word: )" |
69 | 85 | ||
86 | # make patches | ||
70 | bind main S !git format-patch -1 %(commit) | 87 | bind main S !git format-patch -1 %(commit) |
88 | bind main <Ctrl-s> !git format-patch %(commit) | ||
71 | 89 | ||
90 | # show diff based on revision | ||
72 | bind main . >sh -c "git diff %(commit) | tig" | 91 | bind main . >sh -c "git diff %(commit) | tig" |
73 | bind main > >sh -c "git diff %(commit) --no-prefix -U1000 | tig" | 92 | bind main > >sh -c "git diff %(commit) --no-prefix -U1000 | tig" |
74 | 93 | ||
94 | #==================== | ||
75 | # blame view | 95 | # blame view |
96 | #==================== | ||
76 | set blame-view = author:abbreviated date:default id:yes,color line-number:yes text | 97 | set blame-view = author:abbreviated date:default id:yes,color line-number:yes text |
77 | 98 | ||
99 | #==================== | ||
78 | # status view | 100 | # status view |
101 | #==================== | ||
79 | bind status j :/^[MADRU?] | 102 | bind status j :/^[MADRU?] |
80 | bind status k :?^[MADRU?] | 103 | bind status k :?^[MADRU?] |
81 | 104 | ||
@@ -93,25 +116,36 @@ bind status D ?rm %(file) | |||
93 | bind status <F4> !sh -c "git difftool -y \"$(git rev-parse --show-toplevel)/%(file)\"" | 116 | bind status <F4> !sh -c "git difftool -y \"$(git rev-parse --show-toplevel)/%(file)\"" |
94 | bind status Tu @git update-index --assume-unchanged %(file) | 117 | bind status Tu @git update-index --assume-unchanged %(file) |
95 | 118 | ||
119 | # apply patch file | ||
120 | bind status <Ctrl-o> ?git am %(file) | ||
121 | |||
122 | #==================== | ||
96 | # stash view | 123 | # stash view |
124 | #==================== | ||
97 | bind stash a ?git stash apply %(stash) | 125 | bind stash a ?git stash apply %(stash) |
98 | bind stash n @sh -c "git stash drop %(stash) | \ | 126 | bind stash n @sh -c "git stash drop %(stash) | \ |
99 | awk '{print $3}' | \ | 127 | awk '{print $3}' | \ |
100 | tr -d '()' | \ | 128 | tr -d '()' | \ |
101 | xargs git stash store -m '%(prompt Enter stash name: )'" | 129 | xargs git stash store -m '%(prompt Enter stash name: )'" |
102 | 130 | ||
131 | #==================== | ||
103 | # stage view | 132 | # stage view |
133 | #==================== | ||
104 | bind stage n :/^@@ | 134 | bind stage n :/^@@ |
105 | bind stage p :?^@@ | 135 | bind stage p :?^@@ |
106 | bind stage <Esc>n :/^diff --(git|cc) | 136 | bind stage <Esc>n :/^diff --(git|cc) |
107 | bind stage <Esc>p :?^diff --(git|cc) | 137 | bind stage <Esc>p :?^diff --(git|cc) |
108 | 138 | ||
139 | #==================== | ||
109 | # tree view | 140 | # tree view |
141 | #==================== | ||
110 | bind tree d ?rm %(file) | 142 | bind tree d ?rm %(file) |
111 | bind tree 3 !@sh -c "echo -n %(file) | xclip -selection c" | 143 | bind tree 3 !@sh -c "echo -n %(file) | xclip -selection c" |
112 | bind tree 9 !@sh -c "echo -n %(blob) | head -c7 | xclip -selection c" | 144 | bind tree 9 !@sh -c "echo -n %(blob) | head -c7 | xclip -selection c" |
113 | 145 | ||
146 | #==================== | ||
114 | # refs view | 147 | # refs view |
148 | #==================== | ||
115 | bind refs C none | 149 | bind refs C none |
116 | bind refs c @git checkout %(branch) | 150 | bind refs c @git checkout %(branch) |
117 | 151 | ||
@@ -121,16 +155,22 @@ bind refs bD ?git branch -D %(branch) | |||
121 | bind refs . >sh -c "git diff %(branch) | tig" | 155 | bind refs . >sh -c "git diff %(branch) | tig" |
122 | bind refs > >sh -c "git diff %(branch) --prefix -U1000 | tig" | 156 | bind refs > >sh -c "git diff %(branch) --prefix -U1000 | tig" |
123 | 157 | ||
158 | #==================== | ||
124 | # log view | 159 | # log view |
160 | #==================== | ||
125 | bind log n :/^commit | 161 | bind log n :/^commit |
126 | bind log p :?^commit | 162 | bind log p :?^commit |
127 | 163 | ||
164 | #==================== | ||
128 | # diff view | 165 | # diff view |
166 | #==================== | ||
129 | bind diff n :/^@@ | 167 | bind diff n :/^@@ |
130 | bind diff p :?^@@ | 168 | bind diff p :?^@@ |
131 | bind diff <Esc>n :/^diff --(git|cc) | 169 | bind diff <Esc>n :/^diff --(git|cc) |
132 | bind diff <Esc>p :?^diff --(git|cc) | 170 | bind diff <Esc>p :?^diff --(git|cc) |
133 | 171 | ||
172 | #==================== | ||
134 | # color | 173 | # color |
174 | #==================== | ||
135 | color diff-header black yellow | 175 | color diff-header black yellow |
136 | color diff-chunk white magenta | 176 | color diff-chunk white magenta |