-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tigrc
174 lines (142 loc) · 5.46 KB
/
.tigrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
########################
# set
########################
# main view: show commit id (left side)
set main-view = line-number:true date:local=yes author:display=abbreviated id:yes commit-title:graph=yes,refs=yes
set blame-view = date:local=yes author:display=abbreviated id:yes,color line-number:yes,interval=1 text
set line-graphics = utf-8
set mouse = false
# set wrap-lines = yes
# NOTE: default
# set vertical-split = auto
# NOTE; |
# set vertical-split = yes
# NOTE: -
# set vertical-split = no
set split-view-height = 80%
set split-view-width = 90%
# [tigでmerge diffを表示する \- Qiita]( https://qiita.com/YasuOza/items/7be136f03867d20b8332 )
set diff-options = -m --first-parent
# * tigのdiffの色情報はtigの内部で付加している模様
# * `set diff-highlight = tmp_highlighter`として,`tmp_highlighter`ファイルを作成し,`PATH=.:$PATH tig`として,出力結果を調査した結果
# * 背景反転のみは有効(おそらく,`diff-highlight`をhighlighterとして想定しているため)
# * `$'\e[7m' hello $'\e[7m'`
# String (or bool): Path to diff-highlight script, defaults to `diff-highlight`.
set diff-highlight = true
# NOTE: 以下を有効にすると`u`でstage-updateするときにviewが閉じてしまう可能性があるので,注意
# set refresh-mode = auto
# set refresh-mode = periodic
# set refresh-interval = 1
########################
# color
########################
color cursor white 104 bold
########################
# bind
########################
bind generic <Ctrl-f> scroll-page-down
# WARN: tmux key map butting
bind generic <Ctrl-b> scroll-page-up
bind generic <Right> scroll-page-down
bind generic <Left> scroll-page-up
bind stage <Right> scroll-right
bind stage <Left> scroll-left
# line
# NOTE: 期待する行が得られない
bind generic L !>bash -c 'echo %(text)'
# dump info
bind generic I !>bash -c 'echo :file; echo %(file):%(lineno); echo :commit id; echo %(commit); echo :branch; echo %(branch); echo :stash id; echo %(stash); echo :text; echo %(text)'
bind generic T !>git notes edit %(commit)
# NOTE: ?: confirm
# NOTE: ["Press Enter to continue" after a commit message · Issue \#463 · jonas/tig]( https://github.com/jonas/tig/issues/463 )
# NOTE: >: prevent 'Press Enter to continue' for interactive command
bind generic A ?>git commit --amend --allow-empty
# NOTE: Force git amend
bind generic Z ?>git commit --amend --allow-empty --no-verify
# remove file for untracked file
# NOTE: @: prevent message 'Press Enter to continue'
bind status D ?@rm -f %(file)
# NOTE: default is !git commit
bind status C !>git commit
# NOTE: 'F'orce commit
bind status F !>git commit --no-verify
bind status i Enter
# stash
# NOTE: default: bind stash ! ?git stash drop %(stash)
bind stash ! ?>git stash drop %(stash)
bind stash D ?>git stash drop %(stash)
# NOTE: default stash has confirmation prompt
bind stash A ?>git stash apply %(stash)
# NOTE: Force apply
bind stash F ?>git-stash-apply-force %(stash)
bind generic R refresh
# NOTE: rebase
bind main B !git rebase -i %(commit)
bind log B !git rebase -i %(commit)
bind diff B !git rebase -i %(commit)
# [Tig で Git を自由自在に操作するための \.tigrc 設定例 \- Qiita]( https://qiita.com/sfus/items/063797a1dd8fdc7d032f )
# 最上/最下部移動
# g をファイル先頭に移動に変更、 view-grep を再割当て
bind generic g move-first-line
bind generic E view-grep
# G でファイル末尾に移動 (default: :toggle commit-title-graph)
bind generic G move-last-line
bind main G move-last-line
# Alt-g で :toggle commit-title-graph
bind main <Esc>g :toggle commit-title-graph
# 段落移動
# n / p を上下移動に割り当て (default: find-next / view-pager)
bind generic n move-down
bind generic p move-up
# n / p で単位ごとの移動
bind diff n :/^@@
bind diff p :?^@@
bind diff <Esc>n :/^diff --(git|cc)
bind diff <Esc>p :?^diff --(git|cc)
bind stage n :/^@@
bind stage p :?^@@
bind stage N :?^@@
bind stage P :/^@@
bind stage <Esc>n :/^diff --(git|cc)
bind stage <Esc>p :?^diff --(git|cc)
# NOTE: easy for switching status view
bind stage C view-close
bind stage A view-close
bind pager n :/^@@
bind pager p :?^@@
bind pager <Esc>n :/^diff --(git|cc)
bind pager <Esc>p :?^diff --(git|cc)
bind log n :/^commit
bind log p :?^commit
bind status n next
bind status p previous
bind status N previous
bind status P next
# NOTE: goto unstaged file
bind status c :5
bind status s :5
bind status 0 :2
bind status 1 :5
bind status <Ctrl-a> :2
bind status <Ctrl-e> move-last-line
# FYI: [Support "less" pager keyboard shortcuts · Issue \#138 · jonas/tig]( https://github.com/jonas/tig/issues/138 )
# bind generic <Shift-Space> move-up
# 元の n / p を別に割り当て
bind generic V view-pager
bind generic <Ctrl-s> find-next # 要 stty stop undef
bind generic <Ctrl-r> find-prev
# NOTE: change split-view position
bind generic | :set vertical-split = yes
bind generic - :set vertical-split = no
bind blame B back
bind generic <Delete> back
bind generic <Backspace> back
bind generic * find-next
bind generic <Hash> find-prev
bind generic P parent
# NOTE: same keymapping to J,K
bind status <Ctrl-j> next
bind status <Ctrl-k> previous
bind stage <Ctrl-j> next
bind stage <Ctrl-k> previous
bind generic d !>git difftool --tool=vimdiff --no-prompt --trust-exit-code %(commit) -- %(file)