delta-gitu 0.1.2

An experimental fork of gitu (a git client inspired by Magit), published as a library for delta to embed
Documentation
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
# This file contains Gitu's default configuration.
# It is possible to override settings with an equivalent file at:
# `~/.config/gitu/config.toml`

[general]
always_show_help.enabled = false
confirm_quit.enabled = false
# Sets initially collapsed sections in the editor. e.g.:
# collapsed_sections = ["untracked", "recent_commits", "branch_status"]
collapsed_sections = []
refresh_on_file_change.enabled = true
stash_list_limit = 10
recent_commits_limit = 10
log_author_width = 15
mouse_support = false
mouse_scroll_lines = 3

# The most input Gitu will read, whether piped to it as a pager or produced by
# a command it puts again. Input is read in one pass before the first frame, so
# without a limit an accidental `git log -p` over a whole history shows nothing
# until all of it has been read and rendered; 2 MB takes a second or two. What
# is past the limit is dropped rather than deferred, and the view says so: this
# is a limit on eager reading, not incremental rendering.
max_input_bytes = 2_000_000

# The branch section is git's wording: 'On branch {name}' over a line placing
# the branch relative to its upstream. Off, it is the branch name alone.
verbose_branch_status = true

# Files to drop from a paged view (`gitu --pager`), as if the patch never had
# them. The wildcards are git's: `*.pb.go` matches at any depth, and naming a
# directory hides its subtree. `_` says which files to show while reading, and
# `:` shows the pathspecs these became. e.g.:
#   hide = ["*.pb.go", "*_test.go", "vendor"]
hide = []

# Stop the cursor on a diff's unchanged lines too. Nothing can be staged there,
# so they are skipped by default; reading a patch line by line wants them.
visit_context_lines = false

# Render diffs with an external command (e.g. delta) instead of Gitu's
# built-in syntax/diff highlighting. The command receives a unified diff on
# stdin and emits ANSI-colored output.
#
# Gitu advertises the OSC-1717 diff-line-metadata protocol to the command (via
# the OSC1717 env var). If the renderer speaks it, the diff may be
# rendered freely — dropping +/- markers, side-by-side, gutters — and Gitu maps
# each rendered row back to its patch line for staging. If it doesn't, the
# command must preserve line structure (`--color-only`), which Gitu maps 1:1.
#
# A `{width}` token in the command is replaced with the number of columns Gitu
# will render into (and COLUMNS is exported), so a reflowing renderer fills the
# viewport rather than defaulting too narrow over the pipe.
#
# The default is structure-preserving so it works either way; a renderer that
# speaks OSC-1717 can be run freely, e.g.:
#   diff_renderer.command = ["delta", "--side-by-side", "--width", "{width}"]
diff_renderer.enabled = false
diff_renderer.command = ["delta", "--color-only", "--true-color", "always"]

# Renderer features that `renderer_features` offers, to turn on and off while
# viewing a diff. They are passed to the renderer as DELTA_FEATURES=+<names>,
# which delta adds to the features your own git config already sets: your
# configuration stays the base and this is only an overlay on it, held for the
# session and never written to disk.
#
# Any feature you have defined in git config as `[delta "name"]` can be named
# here alongside delta's built-in ones. A feature is free to restructure the
# diff however it likes: Gitu maps each rendered row back to its patch line from
# the metadata the renderer emits, not from how the row looks.
diff_renderer.features = ["side-by-side", "line-numbers", "hyperlinks"]

# Render the log view with a command of your own instead of Gitu's built-in
# one-line-per-commit list. The command is run in the repository and its
# ANSI-colored output becomes the log view; Gitu appends the log menu's
# arguments (`-n`, `--grep`) and the rev being logged.
#
# A commit may take as many rows as the format prints (blank separators, a stat,
# a graph): Gitu keeps them one unit — one commit per cursor stop, folded and
# operated on together — by identifying them from a marker the format emits.
# The `{commit}` token, which must appear in the format, is substituted with git
# format directives emitting that marker (an OSC-1717 commit record); if it is
# missing, Gitu falls back to the built-in log.
#
# A `{width}` token is substituted as for `diff_renderer`, so the output can be
# piped through a renderer that reflows, e.g.:
#   log_renderer.command = ["sh", "-c", "git log --stat --color=always --format='{commit}%h %s' \"$@\" | delta --width {width}", "gitu"]
log_renderer.enabled = false
log_renderer.command = [
  "git", "log", "--color=always", "--date=relative",
  "--format={commit}%n%n▸ %h %C(blue)%an %C(blue)%ar%C(auto)%d%C(reset)%n%n    %C(green)%s%C(auto)",
]

# When to prompt for discard confirmation. Options:
# "line"  - always prompt even for individual lines (default),
# "hunk"  - prompt for files and hunks,
# "file"  - only prompt when discarding whole files,
# "never" - never prompt when discarding.
confirm_discard = "line"

[style]
# fg / bg can be either of:
# - a hex value: "#707070"
# - an ansi color name: "light blue"
# - an ansi color index: "255"
# - "reset" will set the terminal's default foreground / background color.

# 'mods' can be any combination of (multiple values separated by '|'):
# "BOLD|DIM|ITALIC|UNDERLINED|SLOW_BLINK|RAPID_BLINK|REVERSED|HIDDEN|CROSSED_OUT"

# Example style config values:
# section_header = { fg = "#808080" }
# section_header = { bg = "light green", mods = "UNDERLINED|ITALIC" }

separator = { mods = "DIM" }

info_msg = { fg = "green", mods = "BOLD" }
error_msg = { fg = "red", mods = "BOLD" }
command = { fg = "blue", mods = "BOLD" }

menu.heading = { fg = "blue", mods = "BOLD" }
menu.key = { fg = "magenta" }
menu.active_arg = { fg = "light red", mods = "BOLD" }
menu.inactive_arg = {}

prompt = { fg = "cyan", mods = "DIM" }

section_header = { fg = "yellow" }
file_header = { fg = "magenta" }
hunk_header = { fg = "blue" }

diff_highlight.tag_old = { fg = "red", mods = "BOLD" }
diff_highlight.tag_new = { fg = "green", mods = "BOLD" }
diff_highlight.unchanged_old = { mods = "DIM" }
diff_highlight.unchanged_new = { mods = "DIM" }
diff_highlight.changed_old = { fg = "red" }
diff_highlight.changed_new = { fg = "green" }

syntax_highlight.enabled = true
syntax_highlight.attribute = { fg = "yellow" }
syntax_highlight.comment = { fg = "gray" }
syntax_highlight.constant_builtin = {}
syntax_highlight.constant = {}
syntax_highlight.constructor = {}
syntax_highlight.embedded = {}
syntax_highlight.function_builtin = { fg = "cyan" }
syntax_highlight.function = { fg = "blue" }
syntax_highlight.keyword = { fg = "magenta" }
syntax_highlight.number = {}
syntax_highlight.module = { fg = "cyan" }
syntax_highlight.property = {}
syntax_highlight.operator = {}
syntax_highlight.punctuation_bracket = {}
syntax_highlight.punctuation_delimiter = {}
syntax_highlight.string_special = { fg = "yellow" }
syntax_highlight.string = { fg = "yellow" }
syntax_highlight.tag = {}
syntax_highlight.type = { fg = "yellow" }
syntax_highlight.type_builtin = { fg = "yellow" }
syntax_highlight.variable_builtin = {}
syntax_highlight.variable_parameter = {}

picker.prompt = { fg = "cyan" }
picker.info = { mods = "DIM" }
picker.selection_line = { mods = "BOLD" }
picker.matched = { fg = "yellow", mods = "BOLD" }

search_match = { mods = "REVERSED" }

cursor = { symbol = "▌", fg = "blue" }
selection_bar = { symbol = "▌", fg = "blue", mods = "DIM" }
selection_line = { mods = "BOLD" }
# You may want to set `selection_area.bg` to a nice background color.
# Looks horrible with regular terminal colors, so is therefore not set.
selection_area = {}

hash = { fg = "yellow" }

# What the interactive rebase will do with each commit, where that isn't just
# picking it.
rebase_todo.reword = { fg = "blue", mods = "BOLD" }
rebase_todo.edit = { fg = "magenta", mods = "BOLD" }
rebase_todo.squash = { fg = "cyan", mods = "BOLD" }
rebase_todo.fixup = { fg = "yellow", mods = "BOLD" }
rebase_todo.drop = { fg = "red", mods = "BOLD" }

branch = { fg = "green" }
remote = { fg = "red" }
tag = { fg = "yellow" }
author = { fg = "magenta" }
age = { mods = "DIM" }

blame.line_num = { mods = "DIM" }
blame.code_line = { mods = "DIM" }

[bindings]
root.quit = ["q", "esc"]
root.refresh = ["g+r"]
# Go to the status screen, leaving the screen gitu was started on underneath.
root.status = ["g+s"]
root.toggle_section = ["tab"]
root.toggle_all_sections = ["backtab"]
root.diff_context = ["U"]
# Edit the git command the view is the output of, and ask it again.
root.edit_git_command = [":"]
# Drop the file under the cursor from the view, or say which files to show at
# all: `src !*_test.go` limits the view to src and hides its tests.
root.hide_file = ["-"]
root.file_patterns = ["_"]
root.move_up = ["k", "up"]
root.move_down = ["j", "down"]
root.move_up_line = ["ctrl+k", "ctrl+up"]
root.move_down_line = ["ctrl+j", "ctrl+down"]
# Reach the selection over a run of diff lines, to stage / unstage / discard /
# reverse them together. It stays within one hunk, which is as far as a single
# patch reaches. Any other movement drops the selection.
root.extend_selection_up = ["shift+up"]
root.extend_selection_down = ["shift+down"]
root.move_prev_section = ["alt+k", "alt+up"]
root.move_next_section = ["alt+j", "alt+down"]
root.move_parent_section = ["alt+h", "alt+left"]
root.half_page_up = ["ctrl+u"]
root.half_page_down = ["ctrl+d"]
root.full_page_up = ["pageup", "backspace"]
root.full_page_down = ["pagedown", "space"]
root.move_top = ["g+g"]
root.move_bottom = ["G"]
root.scroll_view_up = ["ctrl+y"]
root.scroll_view_down = ["ctrl+e"]
root.search = ["/"]
root.search_backward = []
root.search_next = ["n"]
root.search_previous = ["N"]
root.show_refs = ["Y"]
root.show = ["enter", "right"]
root.discard = ["K"]
root.stage = ["s"]
root.unstage = ["u"]
root.apply = ["a"]
root.reverse = ["v"]
root.copy_hash = ["y"]
root.blame = ["B"]
# Turn a renderer feature (side-by-side, line numbers, ...) on or off in place.
root.renderer_features = ["|"]

picker.next = ["down", "ctrl+n", "tab"]
picker.previous = ["up", "ctrl+p", "backtab"]
picker.done = ["enter"]
picker.cancel = ["esc", "ctrl+c"]

root.help_menu = ["h", "?"]
help_menu.quit = ["q", "h", "?", "esc"]

root.branch_menu = ["b"]
branch_menu.checkout = ["b"]
branch_menu.checkout_new_branch = ["c"]
branch_menu.spinoff = ["s"]
branch_menu.rename = ["m"]
branch_menu.delete = ["K"]
branch_menu.quit = ["q", "esc"]

root.commit_menu = ["c"]
commit_menu.--all = ["-a"]
commit_menu.--allow-empty = ["-e"]
commit_menu.--verbose = ["-v"]
commit_menu.--no-verify = ["-n"]
commit_menu.--reset-author = ["-R"]
commit_menu.--signoff = ["-s"]
commit_menu.commit = ["c"]
commit_menu.commit_amend = ["a"]
commit_menu.commit_extend = ["e"]
commit_menu.commit_fixup = ["f"]
commit_menu.commit_instant_fixup = ["F"]
commit_menu.quit = ["q", "esc"]

# The log view opened to choose a commit (by `commit_menu.commit_fixup` and
# `commit_menu.commit_instant_fixup`). Navigation is as in the log view.
commit_picker.select_commit = ["enter"]
commit_picker.move_up = ["k", "up"]
commit_picker.move_down = ["j", "down"]
commit_picker.move_prev_section = ["alt+k", "alt+up"]
commit_picker.move_next_section = ["alt+j", "alt+down"]
commit_picker.move_top = ["g+g"]
commit_picker.move_bottom = ["G"]
commit_picker.half_page_up = ["ctrl+u"]
commit_picker.half_page_down = ["ctrl+d"]
commit_picker.scroll_view_up = ["ctrl+y"]
commit_picker.scroll_view_down = ["ctrl+e"]
commit_picker.toggle_section = ["tab"]
commit_picker.toggle_menu = ["h", "?"]
commit_picker.quit = ["q", "esc"]

root.fetch_menu = ["f"]
fetch_menu.--prune = ["-p"]
fetch_menu.--tags = ["-t"]
fetch_menu.fetch_all = ["a"]
fetch_menu.quit = ["q", "esc"]
fetch_menu.fetch_elsewhere = ["e"]
fetch_menu.fetch_push_remote = ["p"]
fetch_menu.fetch_upstream = ["u"]

root.log_menu = ["l"]
log_menu.log_current = ["l"]
log_menu.log_other = ["o"]
log_menu.quit = ["q", "esc"]
log_menu.-n = ["-n"]
log_menu.--grep = ["-F"]

root.merge_menu = ["m"]
merge_menu.--ff-only = ["-f"]
merge_menu.--no-ff = ["-n"]
merge_menu.merge_abort = ["a"]
merge_menu.merge_continue = ["c"]
merge_menu.merge = ["m"]
merge_menu.quit = ["q", "<esc>"]

root.pull_menu = ["F"]
pull_menu.--rebase = ["-r"]
pull_menu.pull_from_push_remote = ["p"]
pull_menu.pull_from_upstream = ["u"]
pull_menu.pull_from_elsewhere = ["e"]
pull_menu.quit = ["q", "esc"]

root.push_menu = ["P"]
push_menu.--force-with-lease = ["-f"]
push_menu.--force = ["-F"]
push_menu.--no-verify = ["-h"]
push_menu.--dry-run = ["-n"]
push_menu.push_to_push_remote = ["p"]
push_menu.push_to_upstream = ["u"]
push_menu.push_to_elsewhere = ["e"]
push_menu.quit = ["q", "esc"]

root.rebase_menu = ["r"]
rebase_menu.--keep-empty = ["-k"]
rebase_menu.--preserve-merges = ["-p"]
rebase_menu.--committer-date-is-author-date = ["-d"]
rebase_menu.--autosquash = ["-a"]
rebase_menu.--autostash = ["-A"]
rebase_menu.--interactive = ["-i"]
rebase_menu.--no-verify = ["-h"]
rebase_menu.rebase_interactive = ["i"]
rebase_menu.rebase_abort = ["a"]
rebase_menu.rebase_continue = ["c"]
rebase_menu.rebase_elsewhere = ["e"]
rebase_menu.rebase_autosquash = ["f"]
rebase_menu.quit = ["q", "esc"]

# The interactive rebase todo screen (opened by `rebase_menu.rebase_interactive`).
# It has its own keymap: single keys re-mark the selected commit and alt+up /
# alt+down reorder it. Nothing runs until `rebase_todo_start`.
rebase_todo.rebase_todo_pick = ["p"]
rebase_todo.rebase_todo_reword = ["r"]
rebase_todo.rebase_todo_edit = ["e"]
rebase_todo.rebase_todo_squash = ["s"]
rebase_todo.rebase_todo_fixup = ["f"]
rebase_todo.rebase_todo_drop = ["d"]
rebase_todo.rebase_todo_move_up = ["alt+k", "alt+up"]
rebase_todo.rebase_todo_move_down = ["alt+j", "alt+down"]
rebase_todo.rebase_todo_start = ["enter"]
# Only when git is waiting on gitu as its sequence editor: leaving (`quit`)
# lets git carry on with the list it wrote, this stops the rebase instead.
rebase_todo.rebase_todo_abort = ["Q"]
rebase_todo.move_up = ["k", "up"]
rebase_todo.move_down = ["j", "down"]
rebase_todo.move_top = ["g+g"]
rebase_todo.move_bottom = ["G"]
rebase_todo.half_page_up = ["ctrl+u"]
rebase_todo.half_page_down = ["ctrl+d"]
rebase_todo.scroll_view_up = ["ctrl+y"]
rebase_todo.scroll_view_down = ["ctrl+e"]
rebase_todo.toggle_section = ["tab"]
rebase_todo.toggle_menu = ["h", "?"]
rebase_todo.quit = ["q", "esc"]

root.remote_menu=["M"]
remote_menu.add_remote=["a"]
remote_menu.remove_remote=["K"]
remote_menu.rename_remote=["r"]
remote_menu.quit = ["q", "esc"]

root.reset_menu = ["X"]
reset_menu.reset_soft = ["s"]
reset_menu.reset_mixed = ["m"]
reset_menu.reset_hard = ["h"]
reset_menu.quit = ["q", "esc"]

root.revert_menu = ["V"]
revert_menu.--edit = ["-e"]
revert_menu.--no-edit = ["-E"]
revert_menu.--signoff = ["-s"]
revert_menu.revert_abort = ["a"]
revert_menu.revert_continue = ["c"]
revert_menu.revert_commit = ["V"]
revert_menu.quit = ["q", "esc"]

root.cherry_pick_menu = ["A"]
cherry_pick_menu.--no-commit = ["-n"]
cherry_pick_menu.--signoff = ["-s"]
cherry_pick_menu.--edit = ["-e"]
cherry_pick_menu.cherry_pick_abort = ["a"]
cherry_pick_menu.cherry_pick_continue = ["c"]
cherry_pick_menu.cherry_pick = ["A"]
cherry_pick_menu.quit = ["q", "esc"]

root.stash_menu = ["z"]
stash_menu.--all = ["-a"]
stash_menu.--include-untracked = ["-u"]
stash_menu.stash = ["z"]
stash_menu.stash_index = ["i"]
stash_menu.stash_worktree = ["w"]
stash_menu.stash_keep_index = ["x"]
stash_menu.stash_pop = ["p"]
stash_menu.stash_apply = ["a"]
stash_menu.stash_drop = ["k"]
stash_menu.quit = ["q", "esc"]