Skip to content

Commit

Permalink
Merge branch 'jesseduffield:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmckendry authored May 2, 2024
2 parents 4cf30d4 + 618fe53 commit 35a6c48
Show file tree
Hide file tree
Showing 662 changed files with 26,585 additions and 24,327 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
root = true

[*.go]
indent_style = tab
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.20.x
go-version: 1.21.x
- name: Run goreleaser
uses: goreleaser/goreleaser-action@v4
with:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Continuous Integration

env:
GO_VERSION: 1.20
GO_VERSION: 1.21

on:
push:
Expand Down Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.20.x
go-version: 1.21.x
- name: Test code
# we're passing -short so that we skip the integration tests, which will be run in parallel below
run: |
Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.20.x
go-version: 1.21.x
- name: Print git version
run: git --version
- name: Test code
Expand All @@ -115,7 +115,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.20.x
go-version: 1.21.x
- name: Build linux binary
run: |
GOOS=linux go build
Expand All @@ -142,7 +142,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.20.x
go-version: 1.21.x
- name: Check Vendor Directory
# ensure our vendor directory matches up with our go modules
run: |
Expand All @@ -168,7 +168,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.20.x
go-version: 1.21.x
- name: Lint
uses: golangci/[email protected]
with:
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/sponsors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
uses: JamesIves/[email protected]
with:
token: ${{ secrets.SPONSORS_TOKEN }}
file: 'README.md'
file: "README.md"
if: ${{ github.repository == 'jesseduffield/lazygit' }}

- name: Commit and push if changed
run: |-
git diff
git config --global user.email "[email protected]"
git config --global user.name "README-bot"
git add README.md
git commit -m "Updated README.md" || exit 0
git push
- name: Create Pull Request 🚀
uses: peter-evans/create-pull-request@v6
with:
commit-message: "README.md: Update Sponsors"
title: "README.md: Update Sponsors"
author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
labels: "ignore-for-release"
delete-branch: true
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
# Hidden
.*

# TODO
TODO.*

# Notes
*.notes

Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ linters-settings:
max-func-lines: 0

run:
go: '1.20'
go: '1.21'
timeout: 10m
6 changes: 0 additions & 6 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
],
"hideSystemGoroutines": true,
"console": "integratedTerminal",
"presentation": {
"hidden": true
}
},
{
"name": "Tail Lazygit logs",
Expand All @@ -28,9 +25,6 @@
"--use-config-file=${workspaceFolder}/.vscode/debugger_config.yml"
],
"console": "integratedTerminal",
"presentation": {
"hidden": true
}
},
{
"name": "Attach to a running Lazygit",
Expand Down
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ before making a change.

[This video](https://www.youtube.com/watch?v=kNavnhzZHtk) walks through the process of adding a small feature to lazygit. If you have no idea where to start, watching that video is a good first step.

## Codebase guide

[This doc](./docs/dev/Codebase_Guide.md) explains:
* what the different packages in the codebase are for
* where important files live
* important concepts in the code
* how the event loop works
* other useful information

## All code changes happen through Pull Requests

Pull requests are the best way to propose changes to the codebase. We actively
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# docker build -t lazygit .
# docker run -it lazygit:latest /bin/sh

FROM golang:1.20 as build
FROM golang:1.21 as build
WORKDIR /go/src/github.com/jesseduffield/lazygit/
COPY go.mod go.sum ./
RUN go mod download
Expand Down
34 changes: 31 additions & 3 deletions README.md

Large diffs are not rendered by default.

62 changes: 47 additions & 15 deletions docs/Config.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Default path for the config file:

- Linux: `~/.config/lazygit/config.yml`
- MacOS: `~/Library/Application\ Support/lazygit/config.yml`
- Windows: `%APPDATA%\lazygit\config.yml`
- Windows: `%LOCALAPPDATA%\lazygit\config.yml` (default location, but it will also be found in `%APPDATA%\lazygit\config.yml`

For old installations (slightly embarrassing: I didn't realise at the time that you didn't need to supply a vendor name to the path so I just used my name):

Expand All @@ -19,7 +19,7 @@ If you want to change the config directory:
JSON schema is available for `config.yml` so that IntelliSense in Visual Studio Code (completion and error checking) is automatically enabled when the [YAML Red Hat][yaml] extension is installed. However, note that automatic schema detection only works if your config file is in one of the standard paths mentioned above. If you override the path to the file, you can still make IntelliSense work by adding

```yaml
# yaml-language-server: $schema=https://json.schemastore.org/lazygit.json
# yaml-language-server: $schema=https://raw.githubusercontent.com/jesseduffield/lazygit/master/schema/config.json
```

to the top of your config file or via [Visual Studio Code settings.json config][settings].
Expand All @@ -40,6 +40,7 @@ gui:
sidePanelWidth: 0.3333 # number from 0 to 1
expandFocusedSidePanel: false
mainPanelSplitMode: 'flexible' # one of 'horizontal' | 'flexible' | 'vertical'
enlargedSideViewLocation: 'left' # one of 'left' | 'top'
language: 'auto' # one of 'auto' | 'en' | 'zh-CN' | 'zh-TW' | 'pl' | 'nl' | 'ja' | 'ko' | 'ru'
timeFormat: '02 Jan 06' # https://pkg.go.dev/time#Time.Format
shortTimeFormat: '3:04PM'
Expand All @@ -56,8 +57,6 @@ gui:
- blue
selectedLineBgColor:
- blue # set to `default` to have no background colour
selectedRangeBgColor:
- blue
cherryPickedCommitBgColor:
- cyan
cherryPickedCommitFgColor:
Expand All @@ -80,18 +79,27 @@ gui:
showCommandLog: true
showIcons: false # deprecated: use nerdFontsVersion instead
nerdFontsVersion: "" # nerd fonts version to use ("2" or "3"); empty means don't show nerd font icons
showFileIcons: true # for hiding file icons in the file views
commitHashLength: 8 # length of commit hash in commits view. 0 shows '*' if NF icons aren't enabled
commandLogSize: 8
splitDiff: 'auto' # one of 'auto' | 'always'
skipRewordInEditorWarning: false # for skipping the confirmation before launching the reword editor
border: 'rounded' # one of 'single' | 'double' | 'rounded' | 'hidden'
animateExplosion: true # shows an explosion animation when nuking the working tree
portraitMode: 'auto' # one of 'auto' | 'never' | 'always'
filterMode: 'substring' # one of 'substring' | 'fuzzy'; see 'Filtering' section below
spinner:
frames: ['|', '/', '-', '\\']
rate: 50 # spinner rate in milliseconds
statusPanelView: 'dashboard' # one of 'dashboard' | 'allBranchesLog'
git:
paging:
colorArg: always
useConfig: false
commit:
signOff: false
autoWrapCommitMessage: true # automatic WYSIWYG wrapping of the commit message as you type
autoWrapWidth: 72 # if autoWrapCommitMessage is true, the width to wrap to
merging:
# only applicable to unix users
manualCommit: false
Expand All @@ -101,10 +109,14 @@ git:
# one of date-order, author-date-order, topo-order or default.
# topo-order makes it easier to read the git log graph, but commits may not
# appear chronologically. See https://git-scm.com/docs/git-log#_commit_ordering
#
# Deprecated: Configure this with `Log menu -> Commit sort order` (<c-l> in the commits window by default).
order: 'topo-order'
# one of always, never, when-maximised
# this determines whether the git graph is rendered in the commits panel
showGraph: 'when-maximised'
#
# Deprecated: Configure this with `Log menu -> Show git graph` (<c-l> in the commits window by default).
showGraph: 'always'
# displays the whole git graph by default in the commits panel (equivalent to passing the `--all` argument to `git log`)
showWholeGraph: false
skipHookPrefix: WIP
Expand All @@ -119,6 +131,7 @@ git:
overrideGpg: false # prevents lazygit from spawning a separate process when using GPG
disableForcePushing: false
parseEmoji: false
truncateCopiedCommitHashesTo: 12 # When copying commit hashes to the clipboard, truncate them to this length. Set to 40 to disable truncation.
os:
copyToClipboardCmd: '' # See 'Custom Command for Copying to Clipboard' section
editPreset: '' # see 'Configuring File Editing' section
Expand Down Expand Up @@ -200,6 +213,9 @@ keybinding:
toggleWhitespaceInDiffView: '<c-w>'
increaseContextInDiffView: '}'
decreaseContextInDiffView: '{'
toggleRangeSelect: 'v'
rangeSelectUp: '<s-up>'
rangeSelectDown: '<s-down>'
status:
checkForUpdate: 'u'
recentRepos: '<enter>'
Expand All @@ -208,6 +224,7 @@ keybinding:
commitChangesWithoutHook: 'w' # commit changes without pre-commit hook
amendLastCommit: 'A'
commitChangesWithEditor: 'C'
findBaseCommitForFixup: '<c-f>'
confirmDiscard: 'x'
ignoreFile: 'i'
refreshFiles: 'r'
Expand Down Expand Up @@ -244,11 +261,11 @@ keybinding:
moveDownCommit: '<c-j>' # move commit down one
moveUpCommit: '<c-k>' # move commit up one
amendToCommit: 'A'
amendAttributeMenu: 'a'
pickCommit: 'p' # pick commit (when mid-rebase)
revertCommit: 't'
cherryPickCopy: 'c'
cherryPickCopyRange: 'C'
pasteCommits: 'v'
cherryPickCopy: 'C'
pasteCommits: 'V'
tagCommit: 'T'
checkoutCommit: '<space>'
resetCherryPick: '<c-R>'
Expand All @@ -261,14 +278,18 @@ keybinding:
commitFiles:
checkoutCommitFile: 'c'
main:
toggleDragSelect: 'v'
toggleDragSelect-alt: 'V'
toggleSelectHunk: 'a'
pickBothHunks: 'b'
submodules:
init: 'i'
update: 'u'
bulkMenu: 'b'
commitMessage:
commitMenu: '<c-o>'
amendAttribute:
addCoAuthor: 'c'
resetAuthor: 'a'
setAuthor: 'A'
```
## Platform Defaults
Expand Down Expand Up @@ -360,6 +381,12 @@ That's the behavior when `gui.scrollOffBehavior` is set to "margin" (the default

This setting applies both to all list views (e.g. commits and branches etc), and to the staging view.

## Filtering

We have two ways to filter things, substring matching (the default) and fuzzy searching. With substring matching, the text you enter gets searched for verbatim (usually case-insensitive, except when your filter string contains uppercase letters, in which case we search case-sensitively). You can search for multiple non-contiguous substrings by separating them with spaces; for example, "int test" will match "integration-testing". All substrings have to match, but not necessarily in the given order.

Fuzzy searching is smarter in that it allows every letter of the filter string to match anywhere in the text (only in order though), assigning a weight to the quality of the match and sorting by that order. This has the advantage that it allows typing "clt" to match "commit_loader_test" (letters at the beginning of subwords get more weight); but it has the disadvantage that it tends to return lots of irrelevant results, especially with short filter strings.

## Color Attributes

For color attributes you can choose an array of attributes (with max one color attribute)
Expand Down Expand Up @@ -387,15 +414,13 @@ The available attributes are:

## Highlighting the selected line

If you don't like the default behaviour of highlighting the selected line with a blue background, you can use the `selectedLineBgColor` and `selectedRangeBgColor` keys to customise the behaviour. If you just want to embolden the selected line (this was the original default), you can do the following:
If you don't like the default behaviour of highlighting the selected line with a blue background, you can use the `selectedLineBgColor` key to customise the behaviour. If you just want to embolden the selected line (this was the original default), you can do the following:

```yaml
gui:
theme:
selectedLineBgColor:
- default
selectedRangeBgColor:
- default
```

You can also use the reverse attribute like so:
Expand All @@ -405,8 +430,6 @@ gui:
theme:
selectedLineBgColor:
- reverse
selectedRangeBgColor:
- reverse
```

## Custom Author Color
Expand Down Expand Up @@ -526,6 +549,15 @@ Example:
- Branch name: feature/AB-123
- Commit message: [AB-123] Adding feature

```yaml
git:
commitPrefix:
pattern: "^\\w+\\/(\\w+-\\w+).*"
replace: '[$1] '
```

If you want repository-specific prefixes, you can map them with `commitPrefixes`. If you have both `commitPrefixes` defined and an entry in `commitPrefixes` for the current repo, the `commitPrefixes` entry is given higher precedence. Repository folder names must be an exact match.

```yaml
git:
commitPrefixes:
Expand Down
4 changes: 2 additions & 2 deletions docs/Custom_Command_Keybindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ You can add custom command keybindings in your config.yml (accessible by pressin
customCommands:
- key: '<c-r>'
context: 'commits'
command: 'hub browse -- "commit/{{.SelectedLocalCommit.Sha}}"'
command: 'hub browse -- "commit/{{.SelectedLocalCommit.Hash}}"'
- key: 'a'
context: 'files'
command: "git {{if .SelectedFile.HasUnstagedChanges}} add {{else}} reset {{end}} {{.SelectedFile.Name | quote}}"
Expand Down Expand Up @@ -305,7 +305,7 @@ SelectedWorktree
CheckedOutBranch
```

To see what fields are available on e.g. the `SelectedFile`, see [here](https://github.com/jesseduffield/lazygit/blob/master/pkg/commands/models/file.go) (all the modelling lives in the same directory). Note that the custom commands feature does not guarantee backwards compatibility (until we hit Lazygit version 1.0 of course) which means a field you're accessing on an object may no longer be available from one release to the next. Typically however, all you'll need is `{{.SelectedFile.Name}}`, `{{.SelectedLocalCommit.Sha}}` and `{{.SelectedLocalBranch.Name}}`. In the future we will likely introduce a tighter interface that exposes a limited set of fields for each model.
To see what fields are available on e.g. the `SelectedFile`, see [here](https://github.com/jesseduffield/lazygit/blob/master/pkg/commands/models/file.go) (all the modelling lives in the same directory). Note that the custom commands feature does not guarantee backwards compatibility (until we hit Lazygit version 1.0 of course) which means a field you're accessing on an object may no longer be available from one release to the next. Typically however, all you'll need is `{{.SelectedFile.Name}}`, `{{.SelectedLocalCommit.Hash}}` and `{{.SelectedLocalBranch.Name}}`. In the future we will likely introduce a tighter interface that exposes a limited set of fields for each model.

## Keybinding collisions

Expand Down
Loading

0 comments on commit 35a6c48

Please sign in to comment.