main
1disableStartupPopups: true
2notARepository: skip
3
4os:
5 edit: "lazyvim -- {{filename}}"
6 editAtLine: "lazyvim +{{line}} {{filename}}"
7 editAtLineAndWait: "lazyvim +{{line}} {{filename}}"
8 openDirInEditor: "lazyvim -- {{dir}}"
9 editInTerminal: true
10
11git:
12 overrideGpg: true
13 autoFetch: true
14 autoRefresh: true
15 fetchAll: true
16 autoForwardBranches: onlyMainBranches
17 autoStageResolvedConflicts: true
18 mainBranches:
19 - main
20 - master
21 pagers:
22 - colorArg: always
23 pager: delta --paging=never --dark --line-numbers --hyperlinks --hyperlinks-file-link-format="lazygit-edit://{path}:{line}"
24 commit:
25 signOff: true
26 parseEmoji: true
27 skipHookPrefix: WIP
28 branchLogCmd: "git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium --oneline {{branchName}} --"
29
30gui:
31 showRootItemInFileTree: false
32 showRandomTip: false
33 showDivergenceFromBaseBranch: onlyArrow
34 nerdFontsVersion: "3"
35 filterMode: fuzzy
36
37keybinding:
38 universal:
39 select: "s"
40
41customCommands:
42 # Sync: fetch all + rebase (from upstream if exists, else origin) + push
43 - key: ";"
44 description: "Sync Pull/Push"
45 context: "global"
46 command: "git fetch --all && REBASE_REMOTE=$(git remote | grep -q upstream && echo upstream || echo origin) && git rebase $REBASE_REMOTE/{{.CheckedOutBranch.Name}} && git push origin {{.CheckedOutBranch.Name}}"
47 loadingText: "Syncing...."
48 output: popup
49
50 # AI-generated commit message
51 - key: "\\"
52 description: "AI Commit current changes"
53 context: "global"
54 command: "git diff --cached >/dev/null && aicommit -sn -mgemini:gemini-2.0-flash-lite-preview || echo 'Fail'"
55 loadingText: "generating commit message...."
56 output: popup
57
58 # Prune local branches whose upstream is gone
59 - key: "G"
60 context: "localBranches"
61 description: "Prune local branches no longer on remote (Gone)"
62 loadingText: "Pruning gone branches..."
63 command: |
64 git fetch -p && for branch in $(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | awk '$2 == "[gone]" {sub("refs/heads/", "", $1); print $1}'); do git branch -D $branch; done
65
66 # Fetch upstream and rebase current branch (for forks)
67 - key: "U"
68 context: "localBranches"
69 description: "Fetch upstream & rebase on branch"
70 loadingText: "Fetching upstream & rebasing..."
71 prompts:
72 - type: "input"
73 title: "Upstream branch to rebase on"
74 key: "UpstreamBranch"
75 initialValue: "main"
76 command: "git fetch upstream && git rebase upstream/{{.Form.UpstreamBranch}}"
77
78 # Push to a specific remote with explicit refspec
79 - key: "<c-o>"
80 context: "localBranches"
81 description: "Push to a specific remote"
82 loadingText: "Pushing..."
83 prompts:
84 - type: "input"
85 title: "Remote to push to"
86 key: "Remote"
87 initialValue: "origin"
88 command: "git push {{.Form.Remote}} {{.CheckedOutBranch.Name}}:{{.CheckedOutBranch.Name}}"
89
90 # Prune stale remote tracking references
91 - key: "<c-p>"
92 context: "remotes"
93 description: "Prune stale remote tracking refs"
94 loadingText: "Pruning..."
95 command: "git remote prune {{.SelectedRemote.Name}}"
96
97 # Conventional commit with type/scope/message prompts
98 - key: "<c-c>"
99 context: "files"
100 description: "Conventional commit"
101 prompts:
102 - type: "menu"
103 key: "Type"
104 title: "Type of change"
105 options:
106 - name: "feat"
107 description: "A new feature"
108 value: "feat"
109 - name: "fix"
110 description: "A bug fix"
111 value: "fix"
112 - name: "chore"
113 description: "Other changes that don't modify src or test files"
114 value: "chore"
115 - name: "ci"
116 description: "CI related changes"
117 value: "ci"
118 - name: "docs"
119 description: "Documentation only changes"
120 value: "docs"
121 - name: "refactor"
122 description: "A code change that neither fixes a bug nor adds a feature"
123 value: "refactor"
124 - name: "test"
125 description: "Adding or correcting tests"
126 value: "test"
127 - name: "build"
128 description: "Changes that affect the build system or deps"
129 value: "build"
130 - type: "input"
131 title: "Scope (optional)"
132 key: "Scope"
133 - type: "input"
134 title: "Message"
135 key: "Message"
136 command: "git commit -s -m '{{.Form.Type}}{{if .Form.Scope}}({{.Form.Scope}}){{end}}: {{.Form.Message}}'"
137
138 # Open or create PR in browser
139 - key: "O"
140 context: "global"
141 description: "Open/Create PR in browser"
142 command: "gh pr view --web 2>/dev/null || gh pr create --web"
143 output: terminal
144
145 # Open repo on GitHub
146 - key: "H"
147 context: "status"
148 description: "Open repo on GitHub"
149 command: "gh repo view --web"
150 output: terminal
151
152 # Copy commit hash to clipboard
153 - key: "Y"
154 context: "commits"
155 description: "Copy commit hash to clipboard"
156 command: "printf '%s' '{{.SelectedLocalCommit.Hash}}' | wl-copy"