Skip to content

Commit 8026fc2

Browse files
authored
Provide user config defaults for UI-changeable settings (#4717)
As discussed in #4602, we make a general change to how we treat UI settings that can be changed from within lazygit; previously, the rule was to persist them in State.yml so that they automatically remember the last value that was set in the UI; now, we no longer do this, and instead provide user configs for setting defaults which we fall back to on every start. See #4602 for an in-depth discussion about the pros and cons of either approach, and why we chose this one. As part of this, we change the default for the sort order of branches to date (aka committerdate), both for local and for remote branches (was recency and alphabetical before, respectively). See the discussion starting [here](#2147 (comment)) for some reasons. Fixes #4602.
2 parents 5a5ffb3 + df48667 commit 8026fc2

File tree

83 files changed

+448
-255
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+448
-255
lines changed

docs/Config.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,15 @@ git:
366366
allBranchesLogCmds:
367367
- git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium
368368

369+
# If true, git diffs are rendered with the `--ignore-all-space` flag, which ignores whitespace changes. Can be toggled from within Lazygit with `<c-w>`.
370+
ignoreWhitespaceInDiffView: false
371+
372+
# The number of lines of context to show around each diff hunk. Can be changed from within Lazygit with the `{` and `}` keys.
373+
diffContextSize: 3
374+
375+
# The threshold for considering a file to be renamed, in percent. Can be changed from within Lazygit with the `(` and `)` keys.
376+
renameSimilarityThreshold: 50
377+
369378
# If true, do not spawn a separate process when using GPG
370379
overrideGpg: false
371380

@@ -387,9 +396,32 @@ git:
387396

388397
# Config for showing the log in the commits view
389398
log:
399+
# One of: 'date-order' | 'author-date-order' | 'topo-order' | 'default'
400+
# 'topo-order' makes it easier to read the git log graph, but commits may not
401+
# appear chronologically. See https://git-scm.com/docs/
402+
#
403+
# Can be changed from within Lazygit with `Log menu -> Commit sort order` (`<c-l>` in the commits window by default).
404+
order: topo-order
405+
406+
# This determines whether the git graph is rendered in the commits panel
407+
# One of 'always' | 'never' | 'when-maximised'
408+
#
409+
# Can be toggled from within lazygit with `Log menu -> Show git graph` (`<c-l>` in the commits window by default).
410+
showGraph: always
411+
390412
# displays the whole git graph by default in the commits view (equivalent to passing the `--all` argument to `git log`)
391413
showWholeGraph: false
392414

415+
# How branches are sorted in the local branches view.
416+
# One of: 'date' (default) | 'recency' | 'alphabetical'
417+
# Can be changed from within Lazygit with the Sort Order menu (`s`) in the branches panel.
418+
localBranchSortOrder: date
419+
420+
# How branches are sorted in the remote branches view.
421+
# One of: 'date' (default) | 'alphabetical'
422+
# Can be changed from within Lazygit with the Sort Order menu (`s`) in the remote branches panel.
423+
remoteBranchSortOrder: date
424+
393425
# When copying commit hashes to the clipboard, truncate them to this
394426
# length. Set to 40 to disable truncation.
395427
truncateCopiedCommitHashesTo: 12

docs/keybindings/Keybindings_en.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
1414
| `` @ `` | View command log options | View options for the command log e.g. show/hide the command log and focus the command log. |
1515
| `` P `` | Push | Push the current branch to its upstream branch. If no upstream is configured, you will be prompted to configure an upstream branch. |
1616
| `` p `` | Pull | Pull changes from the remote for the current branch. If no upstream is configured, you will be prompted to configure an upstream branch. |
17-
| `` ) `` | Increase rename similarity threshold | Increase the similarity threshold for a deletion and addition pair to be treated as a rename. |
18-
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
19-
| `` } `` | Increase diff context size | Increase the amount of the context shown around changes in the diff view. |
20-
| `` { `` | Decrease diff context size | Decrease the amount of the context shown around changes in the diff view. |
17+
| `` ) `` | Increase rename similarity threshold | Increase the similarity threshold for a deletion and addition pair to be treated as a rename.<br><br>The default can be changed in the config file with the key 'git.renameSimilarityThreshold'. |
18+
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename.<br><br>The default can be changed in the config file with the key 'git.renameSimilarityThreshold'. |
19+
| `` } `` | Increase diff context size | Increase the amount of the context shown around changes in the diff view.<br><br>The default can be changed in the config file with the key 'git.diffContextSize'. |
20+
| `` { `` | Decrease diff context size | Decrease the amount of the context shown around changes in the diff view.<br><br>The default can be changed in the config file with the key 'git.diffContextSize'. |
2121
| `` : `` | Execute shell command | Bring up a prompt where you can enter a shell command to execute. |
2222
| `` <c-p> `` | View custom patch options | |
2323
| `` m `` | View merge/rebase options | View options to abort/continue/skip the current merge/rebase. |
@@ -30,7 +30,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
3030
| `` <c-e> `` | View diffing options | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. |
3131
| `` q `` | Quit | |
3232
| `` <esc> `` | Cancel | |
33-
| `` <c-w> `` | Toggle whitespace | Toggle whether or not whitespace changes are shown in the diff view. |
33+
| `` <c-w> `` | Toggle whitespace | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
3434
| `` z `` | Undo | The reflog will be used to determine what git command to run to undo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |
3535
| `` <c-z> `` | Redo | The reflog will be used to determine what git command to run to redo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |
3636

@@ -65,7 +65,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
6565
| `` <space> `` | Toggle file included in patch | Toggle whether the file is included in the custom patch. See https://github.com/jesseduffield/lazygit#rebase-magic-custom-patches. |
6666
| `` a `` | Toggle all files | Add/remove all commit's files to custom patch. See https://github.com/jesseduffield/lazygit#rebase-magic-custom-patches. |
6767
| `` <enter> `` | Enter file / Toggle directory collapsed | If a file is selected, enter the file so that you can add/remove individual lines to the custom patch. If a directory is selected, toggle the directory. |
68-
| `` ` `` | Toggle file tree view | Toggle file view between flat and tree layout. Flat layout shows all file paths in a single list, tree layout groups files by directory. |
68+
| `` ` `` | Toggle file tree view | Toggle file view between flat and tree layout. Flat layout shows all file paths in a single list, tree layout groups files by directory.<br><br>The default can be changed in the config file with the key 'gui.showFileTree'. |
6969
| `` - `` | Collapse all files | Collapse all directories in the files tree |
7070
| `` = `` | Expand all files | Expand all directories in the file tree |
7171
| `` 0 `` | Focus main view | |
@@ -149,7 +149,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
149149
| `` d `` | Discard | View options for discarding changes to the selected file. |
150150
| `` g `` | View upstream reset options | |
151151
| `` D `` | Reset | View reset options for working tree (e.g. nuking the working tree). |
152-
| `` ` `` | Toggle file tree view | Toggle file view between flat and tree layout. Flat layout shows all file paths in a single list, tree layout groups files by directory. |
152+
| `` ` `` | Toggle file tree view | Toggle file view between flat and tree layout. Flat layout shows all file paths in a single list, tree layout groups files by directory.<br><br>The default can be changed in the config file with the key 'gui.showFileTree'. |
153153
| `` <c-t> `` | Open external diff tool (git difftool) | |
154154
| `` M `` | Open external merge tool | Run `git mergetool`. |
155155
| `` f `` | Fetch | Fetch changes from remote. |

docs/keybindings/Keybindings_ko.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
1414
| `` @ `` | 명령어 로그 메뉴 열기 | View options for the command log e.g. show/hide the command log and focus the command log. |
1515
| `` P `` | 푸시 | Push the current branch to its upstream branch. If no upstream is configured, you will be prompted to configure an upstream branch. |
1616
| `` p `` | 업데이트 | Pull changes from the remote for the current branch. If no upstream is configured, you will be prompted to configure an upstream branch. |
17-
| `` ) `` | Increase rename similarity threshold | Increase the similarity threshold for a deletion and addition pair to be treated as a rename. |
18-
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
19-
| `` } `` | Diff 보기의 변경 사항 주위에 표시되는 컨텍스트의 크기를 늘리기 | Increase the amount of the context shown around changes in the diff view. |
20-
| `` { `` | Diff 보기의 변경 사항 주위에 표시되는 컨텍스트 크기 줄이기 | Decrease the amount of the context shown around changes in the diff view. |
17+
| `` ) `` | Increase rename similarity threshold | Increase the similarity threshold for a deletion and addition pair to be treated as a rename.<br><br>The default can be changed in the config file with the key 'git.renameSimilarityThreshold'. |
18+
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename.<br><br>The default can be changed in the config file with the key 'git.renameSimilarityThreshold'. |
19+
| `` } `` | Diff 보기의 변경 사항 주위에 표시되는 컨텍스트의 크기를 늘리기 | Increase the amount of the context shown around changes in the diff view.<br><br>The default can be changed in the config file with the key 'git.diffContextSize'. |
20+
| `` { `` | Diff 보기의 변경 사항 주위에 표시되는 컨텍스트 크기 줄이기 | Decrease the amount of the context shown around changes in the diff view.<br><br>The default can be changed in the config file with the key 'git.diffContextSize'. |
2121
| `` : `` | Execute shell command | Bring up a prompt where you can enter a shell command to execute. |
2222
| `` <c-p> `` | 커스텀 Patch 옵션 보기 | |
2323
| `` m `` | View merge/rebase options | View options to abort/continue/skip the current merge/rebase. |
@@ -30,7 +30,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
3030
| `` <c-e> `` | Diff 메뉴 열기 | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. |
3131
| `` q `` | 종료 | |
3232
| `` <esc> `` | 취소 | |
33-
| `` <c-w> `` | 공백문자를 Diff 뷰에서 표시 여부 전환 | Toggle whether or not whitespace changes are shown in the diff view. |
33+
| `` <c-w> `` | 공백문자를 Diff 뷰에서 표시 여부 전환 | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
3434
| `` z `` | 되돌리기 (reflog) (실험적) | The reflog will be used to determine what git command to run to undo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |
3535
| `` <c-z> `` | 다시 실행 (reflog) (실험적) | The reflog will be used to determine what git command to run to redo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |
3636

@@ -331,7 +331,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
331331
| `` <space> `` | Toggle file included in patch | Toggle whether the file is included in the custom patch. See https://github.com/jesseduffield/lazygit#rebase-magic-custom-patches. |
332332
| `` a `` | Toggle all files included in patch | Add/remove all commit's files to custom patch. See https://github.com/jesseduffield/lazygit#rebase-magic-custom-patches. |
333333
| `` <enter> `` | Enter file to add selected lines to the patch (or toggle directory collapsed) | If a file is selected, enter the file so that you can add/remove individual lines to the custom patch. If a directory is selected, toggle the directory. |
334-
| `` ` `` | 파일 트리뷰로 전환 | Toggle file view between flat and tree layout. Flat layout shows all file paths in a single list, tree layout groups files by directory. |
334+
| `` ` `` | 파일 트리뷰로 전환 | Toggle file view between flat and tree layout. Flat layout shows all file paths in a single list, tree layout groups files by directory.<br><br>The default can be changed in the config file with the key 'gui.showFileTree'. |
335335
| `` - `` | Collapse all files | Collapse all directories in the files tree |
336336
| `` = `` | Expand all files | Expand all directories in the file tree |
337337
| `` 0 `` | Focus main view | |
@@ -384,7 +384,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
384384
| `` d `` | View 'discard changes' options | View options for discarding changes to the selected file. |
385385
| `` g `` | View upstream reset options | |
386386
| `` D `` | 초기화 | View reset options for working tree (e.g. nuking the working tree). |
387-
| `` ` `` | 파일 트리뷰로 전환 | Toggle file view between flat and tree layout. Flat layout shows all file paths in a single list, tree layout groups files by directory. |
387+
| `` ` `` | 파일 트리뷰로 전환 | Toggle file view between flat and tree layout. Flat layout shows all file paths in a single list, tree layout groups files by directory.<br><br>The default can be changed in the config file with the key 'gui.showFileTree'. |
388388
| `` <c-t> `` | Open external diff tool (git difftool) | |
389389
| `` M `` | Git mergetool를 열기 | Run `git mergetool`. |
390390
| `` f `` | Fetch | Fetch changes from remote. |

docs/keybindings/Keybindings_nl.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
1414
| `` @ `` | View command log options | View options for the command log e.g. show/hide the command log and focus the command log. |
1515
| `` P `` | Push | Push the current branch to its upstream branch. If no upstream is configured, you will be prompted to configure an upstream branch. |
1616
| `` p `` | Pull | Pull changes from the remote for the current branch. If no upstream is configured, you will be prompted to configure an upstream branch. |
17-
| `` ) `` | Increase rename similarity threshold | Increase the similarity threshold for a deletion and addition pair to be treated as a rename. |
18-
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
19-
| `` } `` | Increase diff context size | Increase the amount of the context shown around changes in the diff view. |
20-
| `` { `` | Decrease diff context size | Decrease the amount of the context shown around changes in the diff view. |
17+
| `` ) `` | Increase rename similarity threshold | Increase the similarity threshold for a deletion and addition pair to be treated as a rename.<br><br>The default can be changed in the config file with the key 'git.renameSimilarityThreshold'. |
18+
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename.<br><br>The default can be changed in the config file with the key 'git.renameSimilarityThreshold'. |
19+
| `` } `` | Increase diff context size | Increase the amount of the context shown around changes in the diff view.<br><br>The default can be changed in the config file with the key 'git.diffContextSize'. |
20+
| `` { `` | Decrease diff context size | Decrease the amount of the context shown around changes in the diff view.<br><br>The default can be changed in the config file with the key 'git.diffContextSize'. |
2121
| `` : `` | Execute shell command | Bring up a prompt where you can enter a shell command to execute. |
2222
| `` <c-p> `` | Bekijk aangepaste patch opties | |
2323
| `` m `` | Bekijk merge/rebase opties | View options to abort/continue/skip the current merge/rebase. |
@@ -30,7 +30,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
3030
| `` <c-e> `` | Open diff menu | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. |
3131
| `` q `` | Quit | |
3232
| `` <esc> `` | Annuleren | |
33-
| `` <c-w> `` | Toggle whitespace | Toggle whether or not whitespace changes are shown in the diff view. |
33+
| `` <c-w> `` | Toggle whitespace | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
3434
| `` z `` | Ongedaan maken (via reflog) (experimenteel) | The reflog will be used to determine what git command to run to undo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |
3535
| `` <c-z> `` | Redo (via reflog) (experimenteel) | The reflog will be used to determine what git command to run to redo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |
3636

@@ -75,7 +75,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
7575
| `` d `` | Bekijk 'veranderingen ongedaan maken' opties | View options for discarding changes to the selected file. |
7676
| `` g `` | Bekijk upstream reset opties | |
7777
| `` D `` | Reset | View reset options for working tree (e.g. nuking the working tree). |
78-
| `` ` `` | Toggle bestandsboom weergave | Toggle file view between flat and tree layout. Flat layout shows all file paths in a single list, tree layout groups files by directory. |
78+
| `` ` `` | Toggle bestandsboom weergave | Toggle file view between flat and tree layout. Flat layout shows all file paths in a single list, tree layout groups files by directory.<br><br>The default can be changed in the config file with the key 'gui.showFileTree'. |
7979
| `` <c-t> `` | Open external diff tool (git difftool) | |
8080
| `` M `` | Open external merge tool | Run `git mergetool`. |
8181
| `` f `` | Fetch | Fetch changes from remote. |
@@ -141,7 +141,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
141141
| `` <space> `` | Toggle bestand inbegrepen in patch | Toggle whether the file is included in the custom patch. See https://github.com/jesseduffield/lazygit#rebase-magic-custom-patches. |
142142
| `` a `` | Toggle all files | Add/remove all commit's files to custom patch. See https://github.com/jesseduffield/lazygit#rebase-magic-custom-patches. |
143143
| `` <enter> `` | Enter bestand om geselecteerde regels toe te voegen aan de patch | If a file is selected, enter the file so that you can add/remove individual lines to the custom patch. If a directory is selected, toggle the directory. |
144-
| `` ` `` | Toggle bestandsboom weergave | Toggle file view between flat and tree layout. Flat layout shows all file paths in a single list, tree layout groups files by directory. |
144+
| `` ` `` | Toggle bestandsboom weergave | Toggle file view between flat and tree layout. Flat layout shows all file paths in a single list, tree layout groups files by directory.<br><br>The default can be changed in the config file with the key 'gui.showFileTree'. |
145145
| `` - `` | Collapse all files | Collapse all directories in the files tree |
146146
| `` = `` | Expand all files | Expand all directories in the file tree |
147147
| `` 0 `` | Focus main view | |

0 commit comments

Comments
 (0)