-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathlazygit.config.yml
More file actions
116 lines (114 loc) · 4.92 KB
/
lazygit.config.yml
File metadata and controls
116 lines (114 loc) · 4.92 KB
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
gui:
nerdFontsVersion: '3'
border: single
theme:
activeBorderColor:
- '#89b4fa'
- bold
inactiveBorderColor:
- '#a6adc8'
optionsTextColor:
- '#89b4fa'
selectedLineBgColor:
- '#313244'
selectedRangeBgColor:
- '#313244'
cherryPickedCommitBgColor:
- '#45475a'
cherryPickedCommitFgColor:
- '#89b4fa'
unstagedChangesColor:
- '#f38ba8'
defaultFgColor:
- '#cdd6f4'
searchingActiveBorderColor:
- '#f9e2af'
customCommands:
- key: <c-s>
description: Pick AI commit
context: global
prompts:
- type: menuFromCommand
title: Select AI Commit Message
key: CommitMsg
command: |
bash -c "
# Check for staged changes
diff=\$(git diff --cached | head -n 10)
if [ -z \"\$diff\" ]; then
echo \"No changes in staging. Add changes first.\"
exit 1
fi
COMMITS_TO_SUGGEST=10 # Required quantity per final example
aichat --role commiter \"
Here is an example of previous commit messages in this repository:
\$(git log | head -n 10)
Here is the diff:
\$(git diff --cached)
\""
command: "# Create a temporary file for the commit message\ncommit_msg_file=$(mktemp)\n\n# Clean the suggestions and save them to the file\ncommit_suggestions=$(echo \"{{.Form.CommitMsg}}\" | \\\n sed 's/```[a-zA-Z]*//g' | \\\n sed 's/```//g' | \\\n sed 's/^[ \\t]*//g' | \\\n sed 's/[ \\t]*$//g')\n\n# Write the suggestions to the temporary file\necho \"$commit_suggestions\" > \"$commit_msg_file\"\n\n# Saves the initial modification timestamp of the file\ninitial_timestamp=$(stat -c %Y \"$commit_msg_file\" 2>/dev/null || stat -f %m \"$commit_msg_file\")\n\n# Opens the commit message editor and captures the exit code\n${EDITOR:-vim} \"$commit_msg_file\"\neditor_exit=$?\n\n# Gets the new modification timestamp\nnew_timestamp=$(stat -c %Y \"$commit_msg_file\" 2>/dev/null || stat -f %m \"$commit_msg_file\")\n\n# Checks if the editor exited normally and if the file was saved\nif [ $editor_exit -ne 0 ]; then\n echo \"Editor exited abnormally, commit aborted.\"\nelif [ \"$initial_timestamp\" != \"$new_timestamp\" ]; then\n # The file was saved (timestamp has changed)\n selected_msg=$(grep -v \"^#\" \"$commit_msg_file\" | grep -v \"^$\" | head -n 1)\n \n if [ -n \"$selected_msg\" ]; then\n echo \"Creating commit with message: $selected_msg\"\n git commit -m \"$selected_msg\"\n else\n echo \"No commit message selected, commit aborted.\"\n fi\nelse\n echo \"File was not saved, commit aborted.\"\nfi\n\n# Clean temp files\nrm -f \"$commit_msg_file\"\n"
output: terminal
loadingText: "Generating conventional commit suggestions with AI"
- key: "<c-v>"
context: "global"
description: "Create new conventional commit"
prompts:
- type: "menu"
key: "Type"
title: "Type of change"
options:
- name: "build"
description: "Changes that affect the build system or external dependencies"
value: "build"
- name: "feat"
description: "A new feature"
value: "feat"
- name: "fix"
description: "A bug fix"
value: "fix"
- name: "chore"
description: "Other changes that don't modify src or test files"
value: "chore"
- name: "ci"
description: "Changes to CI configuration files and scripts"
value: "ci"
- name: "docs"
description: "Documentation only changes"
value: "docs"
- name: "perf"
description: "A code change that improves performance"
value: "perf"
- name: "refactor"
description: "A code change that neither fixes a bug nor adds a feature"
value: "refactor"
- name: "revert"
description: "Reverts a previous commit"
value: "revert"
- name: "style"
description: "Changes that do not affect the meaning of the code"
value: "style"
- name: "test"
description: "Adding missing tests or correcting existing tests"
value: "test"
- type: "input"
title: "Scope"
key: "Scope"
initialValue: ""
- type: "menu"
key: "Breaking"
title: "Breaking change"
options:
- name: "no"
value: ""
- name: "yes"
value: "!"
- type: "input"
title: "message"
key: "Message"
initialValue: ""
- type: "confirm"
key: "Confirm"
title: "Commit"
body: "Are you sure you want to commit?"
command: "git commit --message '{{.Form.Type}}{{ if .Form.Scope }}({{ .Form.Scope }}){{ end }}{{.Form.Breaking}}: {{.Form.Message}}'"
loadingText: "Creating conventional commit..."