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