Skip to content

Commit 2d3ab40

Browse files
authored
feat: add lazygit config with custom commands (#5)
1 parent 7fda1f1 commit 2d3ab40

File tree

4 files changed

+155
-3
lines changed

4 files changed

+155
-3
lines changed

.yamlfmt

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ formatter:
55
indent: 2
66
include_document_start: true
77
retain_line_breaks: true
8-
max_line_length: 150
8+
max_line_length: 140
99
pad_line_comments: 1
1010
# -*-mode:yaml-*- vim:ft=yaml:

.yamllint

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ rules:
2828
level: error
2929
line-length:
3030
max: 150
31-
allow-non-breakable-words: true
31+
allow-non-breakable-words: false
3232
allow-non-breakable-inline-mappings: true
3333
octal-values: enable
3434
truthy:

dot_gitconfig.tmpl

+71-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# -*-mode:gitconfig-*- vim:ft=gitconfig
1+
# -*-mode:gitconfig-*- vim:ft=dosini
22
# -*-mode:ini-*- vim:ft=gitconfig
33

44
# ~/.gitconfig
@@ -10,10 +10,80 @@
1010
# {{- /* This file supports Go's text/template language. */}}
1111

1212
{{ $gh := lookPath "gh" -}}
13+
{{ $delta := lookPath "delta" -}}
1314

1415
[init]
1516
defaultBranch = main
1617

18+
{{ if $delta -}}
19+
[core]
20+
pager = delta
21+
22+
[interactive]
23+
diffFilter = delta --color-only
24+
25+
[delta "gruvmax-fang"]
26+
# author: https://github.com/maxfangx
27+
# General appearance
28+
dark = true
29+
syntax-theme = gruvbox-dark
30+
# File
31+
file-style = "#FFFFFF" bold
32+
file-added-label = [+]
33+
file-copied-label = [==]
34+
file-modified-label = [*]
35+
file-removed-label = [-]
36+
file-renamed-label = [->]
37+
file-decoration-style = "#434C5E" ul
38+
file-decoration-style = "#84786A" ul
39+
# No hunk headers
40+
hunk-header-style = omit
41+
# Line numbers
42+
line-numbers = true
43+
line-numbers-left-style = "#84786A"
44+
line-numbers-right-style = "#84786A"
45+
line-numbers-minus-style = "#A02A11"
46+
line-numbers-plus-style = "#479B36"
47+
line-numbers-zero-style = "#84786A"
48+
line-numbers-left-format = " {nm:>3} │"
49+
line-numbers-right-format = " {np:>3} │"
50+
# Diff contents
51+
inline-hint-style = syntax
52+
minus-style = syntax "#330011"
53+
minus-emph-style = syntax "#80002a"
54+
minus-non-emph-style = syntax auto
55+
plus-style = syntax "#001a00"
56+
plus-emph-style = syntax "#003300"
57+
plus-non-emph-style = syntax auto
58+
whitespace-error-style = "#FB4934" reverse
59+
# Commit hash
60+
commit-decoration-style = normal box
61+
commit-style = "#ffffff" bold
62+
# Blame
63+
blame-code-style = syntax
64+
blame-format = "{author:>18} ({commit:>8}) {timestamp:<13} "
65+
; blame-palette = "#000000" "#1d2021" "#282828" "#3c3836"
66+
# Merge conflicts
67+
merge-conflict-begin-symbol =
68+
merge-conflict-end-symbol =
69+
merge-conflict-ours-diff-header-style = "#FABD2F" bold
70+
merge-conflict-theirs-diff-header-style = "#FABD2F" bold overline
71+
merge-conflict-ours-diff-header-decoration-style = ''
72+
merge-conflict-theirs-diff-header-decoration-style = ''
73+
74+
[delta]
75+
navigate = true
76+
dark = true
77+
side-by-side = true
78+
features = gruvmax-fang
79+
80+
[merge]
81+
conflictstyle = diff3
82+
83+
[diff]
84+
colorMoved = default
85+
{{- end }}
86+
1787
[gpg]
1888
format = ssh
1989

private_dot_config/lazygit/config.yml

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
gui:
3+
scrollHeight: 2
4+
mainPanelSplitMode: "flexible"
5+
enlargedSideViewLocation: "left"
6+
language: "en"
7+
nerdFontsVersion: "3"
8+
9+
git:
10+
paging:
11+
colorArg: "always"
12+
pager: "delta --dark --paging=never"
13+
commit:
14+
signoff: false
15+
autoWrapCommitMessage: true
16+
autoWrapWidth: 72
17+
18+
customCommands:
19+
- key: "v"
20+
context: "localBranches"
21+
loadingText: "Checking out GitHub Pull Request..."
22+
command: "gh pr checkout {{.Form.PullRequestNumber}}"
23+
prompts:
24+
- type: "menuFromCommand"
25+
title: "Which PR do you want to check out?"
26+
key: "PullRequestNumber"
27+
command: >-
28+
gh pr list --json number,title,headRefName,updatedAt --template '{{`{{range .}}{{printf "#%v: %s - %s (%s)" .number .title .headRefName
29+
(timeago .updatedAt)}}{{end}}`}}'
30+
filter: '#(?P<number>[0-9]+): (?P<title>.+) - (?P<ref_name>[^ ]+).*'
31+
valueFormat: '{{.number}}'
32+
labelFormat: >-
33+
{{"#" | black | bold}}{{.number | white | bold}} {{.title | yellow | bold}}{{" [" | black | bold}}{{.ref_name | green}}{{"]" | black
34+
| bold}}
35+
- key: "n"
36+
context: "localBranches"
37+
description: "Create new conventional commits branch"
38+
loadingText: "Creating branch"
39+
command: |
40+
git checkout -b {{(printf "%s/%s" .Form.BranchType .Form.BranchName) | quote}}
41+
prompts:
42+
- type: "menu"
43+
title: "Type of change"
44+
key: "BranchType"
45+
options:
46+
- name: "build"
47+
description: "build system/external deps"
48+
value: "build"
49+
- name: "chore"
50+
description: "trivial updates and maintenance"
51+
value: "chore"
52+
- name: "ci"
53+
description: "ci/cd configuration changes"
54+
value: "ci"
55+
- name: "docs"
56+
description: "documentation-only changes"
57+
value: "docs"
58+
- name: "feat"
59+
description: "new feature"
60+
value: "feat"
61+
- name: "fix"
62+
description: "bug fix"
63+
value: "fix"
64+
- name: "perf"
65+
description: "performance improvement"
66+
value: "perf"
67+
- name: "refactor"
68+
description: "neither fixes a bug nor adds a feature"
69+
value: "refactor"
70+
- name: "style"
71+
description: "formatting and comments"
72+
value: "style"
73+
- name: "test"
74+
description: "add or update tests"
75+
value: "test"
76+
- type: "input"
77+
title: "Branch name [a-z0-9_-]+"
78+
key: "BranchName"
79+
- type: "confirm"
80+
title: "Create branch?"
81+
body: >-
82+
Do you want to create branch {{(printf "%s/%s" .Form.BranchType .Form.BranchName)}} from local branch {{.SelectedLocalBranch.Name}}?

0 commit comments

Comments
 (0)