1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2026-05-22 10:15:43 +02:00
Commit Graph

7499 Commits

Author SHA1 Message Date
Stefan Haller 146f004918 Revert the change of <ctrl+j>/<ctrl+k> to <alt+down>/<alt+up> (#5582)
While I strongly prefer the alt-arrow bindings myself, I'm worried that
existing users might not be happy about the change, so I'm reverting it.

I'm working on supporting multiple keybindings for every command, so
once that's in, we can change the default to include both.
2026-05-04 18:25:16 +02:00
Stefan Haller 2332d9b27b Revert the change of <ctrl+j>/<ctrl+k> to <alt+down>/<alt+up>
While I strongly prefer the alt-arrow bindings myself, I'm worried that existing
users might not be happy about the change, so I'm reverting it.

I'm working on supporting multiple keybindings for every command, so once that's
in, we can change the default to include both.
2026-05-04 18:17:37 +02:00
Stefan Haller abe9e6c041 Add an AGENTS.md file (#5581) 2026-05-04 14:21:17 +02:00
Stefan Haller 9a2891818e Add an AGENTS.md file 2026-05-04 14:16:54 +02:00
Stefan Haller c6d73ace9a Show push URLs for remotes that have any (#5576)
In the Remotes panel, when selecting a remote that has push URLs, show
them in the main view in addition to the fetch URL(s).

Addresses half of #5566 (just the showing part, not the editing).
2026-05-04 13:13:17 +02:00
Stefan Haller 127dd9d325 Expose PushUrls to custom commands 2026-05-04 13:09:47 +02:00
Stefan Haller 6f1c57b604 Show PushUrls for selected remote if there are any 2026-05-04 13:09:47 +02:00
Stefan Haller d0ed65e0fd Add PushUrls field to models.Remote
Add some tests for RemoteLoader while we're at it; we didn't have any.
2026-05-04 13:09:47 +02:00
Stefan Haller 59b9b5959d Use more widely-supported Unicode symbols for the commit graph (#5573)
The commit graph used '⏣' (U+23E3 BENZENE RING WITH CIRCLE) for merge
commits and '◯' (U+25EF LARGE CIRCLE) for regular commits. Both have
very poor coverage in popular monospace fonts:

- '⏣' lives in the Misc Technical block and is essentially absent from
every common monospace font (Source Code Pro, JetBrains Mono, Fira Code,
Cascadia Code, Hack, Iosevka, Menlo, Consolas, Monaco, IBM Plex Mono,
Ubuntu Mono, Noto Sans Mono, Inconsolata). It is always drawn from a
system fallback font.
- '◯' is the late-addition LARGE CIRCLE codepoint. It is present in some
fonts (Cascadia, Fira Code, Hack, Iosevka, Menlo, Noto Sans Mono) but
missing from many others, including Source Code Pro and most Nerd Font
derivatives based on it.

This is why the graph renders inconsistently across platforms even when
the same monospace font is configured: each OS picks a different
fallback font (Apple Symbols on macOS, Segoe UI Symbol on Windows,
Noto/DejaVu/Symbola on Linux), and the substituted glyphs differ in
shape, weight, and advance width. '◯' is also East Asian Ambiguous
width, so some terminals render it wider than one cell, exaggerating the
misalignment.

Replace the symbols with codepoints from the foundational 1991 Geometric
Shapes block, which has far broader font coverage:

- Merge: '◎' U+25CE BULLSEYE -- concentric circles, the visually closest
cousin to the previous benzene-ring glyph.
- Commit: '○' U+25CB WHITE CIRCLE -- the same hollow-circle silhouette
as before, just a more universally available codepoint.

The new symbols are present in the font directly in significantly more
cases; and when fallback is still required, they are universally
well-drawn (unlike '⏣', which many fallback fonts also lack).

I also considered choosing suitable nerd font symbols for those who are
using nerd fonts, on the assumption that these must work better because
they are guaranteed to be in the font and no fallback font substitution
is necessary; several suitable icons could be considered, e.g.
`nf-cod-circle_large` or `nf-md-circle_double`. Surprisingly, these
didn't work well, and the reason is that (at least in the font I am
using) these are defined with a glyph width that is wider than their
advance width, which means they draw in different sizes depending on
whether they are followed by a space or not. The glyphs we picked above
don't have this problem.

And finally, I considered adding config options so that users with weird
fonts can pick symbols that work well for them. I would like to avoid
having to do this though; ideally we should be able to make a choice
that works well for everybody.
2026-05-04 13:09:28 +02:00
Stefan Haller 35d3659cce Use more widely-supported Unicode symbols for the commit graph
The commit graph used '⏣' (U+23E3 BENZENE RING WITH CIRCLE) for merge
commits and '◯' (U+25EF LARGE CIRCLE) for regular commits. Both have
very poor coverage in popular monospace fonts:

- '⏣' lives in the Misc Technical block and is essentially absent from
  every common monospace font (Source Code Pro, JetBrains Mono, Fira
  Code, Cascadia Code, Hack, Iosevka, Menlo, Consolas, Monaco, IBM
  Plex Mono, Ubuntu Mono, Noto Sans Mono, Inconsolata). It is always
  drawn from a system fallback font.
- '◯' is the late-addition LARGE CIRCLE codepoint. It is present in
  some fonts (Cascadia, Fira Code, Hack, Iosevka, Menlo, Noto Sans
  Mono) but missing from many others, including Source Code Pro and
  most Nerd Font derivatives based on it.

This is why the graph renders inconsistently across platforms even
when the same monospace font is configured: each OS picks a different
fallback font (Apple Symbols on macOS, Segoe UI Symbol on Windows,
Noto/DejaVu/Symbola on Linux), and the substituted glyphs differ in
shape, weight, and advance width. '◯' is also East Asian Ambiguous
width, so some terminals render it wider than one cell, exaggerating
the misalignment.

Replace the symbols with codepoints from the foundational 1991
Geometric Shapes block, which has far broader font coverage:

- Merge: '◎' U+25CE BULLSEYE -- concentric circles, the visually
  closest cousin to the previous benzene-ring glyph.
- Commit: '○' U+25CB WHITE CIRCLE -- the same hollow-circle silhouette
  as before, just a more universally available codepoint.

The new symbols are present in the font directly in significantly
more cases; and when fallback is still required, they are universally
well-drawn (unlike '⏣', which many fallback fonts also lack).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 13:06:29 +02:00
Stefan Haller bbc254253d Fix new gopls linter warnings (#5580)
These have started to pop up in my editor after the last gopls update,
and I like my IDE's problems panel to be clean, so fix them.
2026-05-04 13:05:21 +02:00
Stefan Haller 8dbdd74400 Fix linter warnings about ignoring errors from bufio.Scanner 2026-05-03 16:57:24 +02:00
Stefan Haller 562d0541a1 Fix linter warning about inefficient string concatenation 2026-05-03 16:39:41 +02:00
Stefan Haller f2ff1eb24b Fix failing windows tests (#5574)
See commit messages for details.
2026-05-02 18:04:34 +02:00
stk 7fbc2a8c14 Close temp file handles before cleanup on Windows
Windows cannot remove files while handles are still open. In
TestOSCommandFileType we created files and immediately called RemoveAll without
closing handles, which left untracked artifacts (e.g. "testFile" and "file with
spaces") in the working tree. Close the handles and assert RemoveAll succeeds so
cleanup failures are visible.
2026-05-02 17:59:27 +02:00
stk 3ffc4ac832 Remove now unnecessary Setenv call
The call was meant to guarantee a UTC time zone to make the tests deterministic,
but as the previous commit explained, this only worked on Mac and Linux, not on
Windows. Since we now have a better fix, this workaround is no longer needed.
2026-05-02 17:59:27 +02:00
stk 5761f92e16 Make UnixToDateSmart timezone-deterministic
The "custom time format" test case of TestGetCommitListDisplayStrings failed on
Windows. Root cause: UnixToDateSmart used time.Unix(timestamp, 0), which formats
in process-local time. In tests we pass an explicit 'now' (often UTC), but the
timestamp was rendered in Local, causing one-hour drift on non-UTC machines.

The test tried to work around this by doing os.Setenv("TZ", "UTC"); however,
this only worked on Mac and Linux. On Windows, it has no effect because Windows
uses registry-based timezone configuration, not TZ environment variables.

Change: convert the timestamp into now.Location() before both the same-day
comparison and formatting.

Why this is safe: callers already define the presentation timezone via the 'now'
argument (typically time.Now() in app code, controlled time in tests). This
aligns timestamp rendering with that caller intent and removes dependence on
global TZ state or OS-specific environment variable behavior.

Added regression tests for UTC and UTC+1 to ensure deterministic behavior across
all platforms.
2026-05-02 17:59:27 +02:00
Stefan Haller 8bc329a5a6 Clear LC_* env vars when running LANG tests (#5568)
In the event that LC_ALL was set, for example, the tests would fail as
it takes precedence over LANG.

Tiny change that prevents language tests from failing if LC_ALL is set
(I also added LC_MESSAGES but I am not sure if that's also needed, from
what I read it also takes precedence) so I did not open an issue prior,
hopefully that's ok!
2026-05-01 08:16:22 +02:00
Antoine Gaudreau Simard f4e0e9e93c Clear LC_* env vars when running LANG tests
In the event that LC_ALL was set, for example, the tests would fail as
it takes precedence over LANG
2026-05-01 08:13:52 +02:00
Stefan Haller 749bb2901a Fix regressions with alternate edit bindings for backspace and move-cursor-right (#5570)
These have alternate keys (`<ctrl+h>` for backspace, and `<ctrl+f>` for
move-cursor-right). Both of these broke with commit 22169e22ffc46c5; the
first because it was accidentally omitted, the second because of a
stupid copy/paste mistake.
2026-05-01 08:11:09 +02:00
Stefan Haller dadc5ffede Fix regressions with alternate edit bindings for backspace and move-cursor-right
These have alternate keys (<ctrl+h> for backspace, and <ctrl+f> for
move-cursor-right). Both of these broke with commit 22169e22ffc46c5; the first
because it was accidentally omitted, the second because of a stupid copy/paste
mistake.
2026-05-01 08:06:01 +02:00
Stefan Haller dc44e0e231 Change canonical keybinding syntax (<ctrl+a> instead of <c-a>) (#5565)
In #5563 we started to support an alternative syntax for keybindings:
instead of `<c-a>` you could say `<ctrl+a>`, which is easier to read
especially when there are multiple modifiers (`<ctrl+shift+x>` instead
of `<c-s-x>`). In this PR we make this new syntax the default.
2026-04-30 22:46:03 +02:00
Stefan Haller 6663867bb5 Change keybinding syntax to spell out full modifier names, and use + instead of -
The change to filter_menu_by_keybinding.go is needed because + now occurs in
many keybindings, so pick a different one that occurs only once.
2026-04-30 22:38:53 +02:00
Stefan Haller 74a6ea85c8 Remove the keybindings legend in the cheatsheets
With the new longer syntax that we are about to make the default in the next
commit it is no longer needed.
2026-04-30 22:38:53 +02:00
Stefan Haller ccae993b40 Platform-specific edit bindings for move-by-word and backspace-word (#5564)
Make the edit keybindings for "move-by-word" and "backspace-word"
platform-dependent so that they are with ctrl on Windows and Linux, but
alt on Mac. These are the common conventions on these platforms. Also,
make them configurable so that user who can't get used to the change can
map it back to what they were.

Add a "forward-delete-word" keybinding, bound to alt-delete on Mac, and
ctrl-delete on Windows and Linux.
2026-04-30 22:38:35 +02:00
Stefan Haller bfdea2bb4f Add a forwardDeleteWord keybinding
Bound to alt-delete on Mac, and ctrl-delete on Windows and Linux.
2026-04-30 22:31:44 +02:00
Stefan Haller 976dbec9ff Make edit keybindings for move-by-word and backspace-word configurable
And make them platform dependent so that they are with ctrl on Windows and
Linux, but alt on Mac.
2026-04-30 22:31:44 +02:00
Stefan Haller 396e1ae8b9 Keybinding revamp (#5563)
Revamp lazygit's keybinding mechanism to support richer keybindings for
those terminals that support the newer keyboard protocols. This makes it
possible to use keybindings such as `ctrl-alt-shift-x`.

Change the default keybindings for moving commits up and down from
`ctrl-k`/`ctrl-j` to `alt-up`/`alt-down`; this is mostly for personal
preference, I find them easier to remember, and they are nicely similar
to moving a line of code up and down in many code editors. Also, change
the default binding for submitting a commit from the commit description
editor from `alt-enter` to `command-enter` on Mac, or `ctrl-enter` on
Linux and Windows; these are the same bindings that are used in many
multi-line edit field situations, e.g. in GitHub comments.

See docs/keybindings/Custom_Keybindings.md for caveats about terminal
compatibility.
2026-04-30 22:30:27 +02:00
Stefan Haller 8a6c97a920 Add breaking changes note for the changed bindings 2026-04-30 22:22:53 +02:00
Stefan Haller f5cefc8a58 Change bindings for moving commits to a-up/down
These are the same as many editors (e.g. VS Code) use for moving a line up/down,
so they are easy to remember.
2026-04-30 22:22:53 +02:00
Stefan Haller 578ee9a31b Change a-enter keybinding to m-enter on mac, and c-enter elsewhere 2026-04-30 22:22:53 +02:00
Stefan Haller 09d671e642 Document custom keybinding syntax
The previous version only enumerated the supported (non-rune) bindings.
Replace it with a description of the syntax: how to spell single-rune
keys, special keys, and modified keys; how to combine modifiers; the
keyword forms for `<space>`, `<minus>`, `<plus>`; and which combinations
are rejected because terminals can't deliver them.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-30 22:22:53 +02:00
Stefan Haller 22169e22ff Move modifiers into Key
This changes not only how we store modifiers (inside of Key instead of passing
it separately), but also how we parse keybinding strings: it supports all
combinations of modifiers now (if the terminal supports it, that is).
2026-04-30 22:22:53 +02:00
Stefan Haller 30b619b3db Get rid of pkg/gui/keybindings package
Move keybindings.GetKey to config.GetValidatedKeyBindingKey
2026-04-30 22:22:53 +02:00
Stefan Haller c41fae9fc4 Unexport the labelByKey and keyByLabel maps 2026-04-30 22:22:53 +02:00
Stefan Haller 69e99ffd64 Move keybindings.LabelFromKey to config package
So that it is next to KeyFromLabel.
2026-04-30 22:22:53 +02:00
Stefan Haller c455fca062 Add config.KeyFromLabel 2026-04-30 22:22:53 +02:00
Stefan Haller a5b760f8d1 Fix typo in keybinding
An uppercase letter is not valid with ctrl, and only works because we lowercase
the string before parsing it. This will change later in this branch when we
start supporting bindings like <c-s-r>.
2026-04-30 22:22:53 +02:00
Stefan Haller 69635f379c Update to tcell v3 (#5562)
Refactor code to introduce a Key type in gocui that bundles the keyName
and a rune, so that we don't have to pass these around separately
everywhere.

This, and updating tcell to v3 lays the ground for supporting more
keybindings in terminals that support the CSIu keyboard protocol.
2026-04-30 22:22:30 +02:00
Stefan Haller 5d3715f96b Bump tcell dependency to v3 2026-04-30 22:14:26 +02:00
Stefan Haller 64996d12d9 Add Key type
This bundles the keyName and a rune, so that we don't have to pass these around
separately everywhere. This should make it easier to swap out the rune for a
string when we upgrade to tcell v3.
2026-04-30 22:14:26 +02:00
Stefan Haller bff77fc4f9 Rename Key to KeyName
This is to free up the name Key for a type that can be either a KeyName or a
rune (or later a string when we upgrade to tcell v3).
2026-04-30 22:14:26 +02:00
Stefan Haller e633ae6aa6 Cleanup: use named constant 2026-04-30 22:14:26 +02:00
Stefan Haller 679a196dc7 Cleanup: fix typo in comment 2026-04-30 22:14:26 +02:00
Stefan Haller ff58687b68 Cleanup: remove unnecessary function Label()
It's a no-op. (I think this might not have been the case in the past, where
Label() was needed to "normalize" a keybinding or something.)
2026-04-30 22:14:26 +02:00
Stefan Haller f866f04b7c Cleanup: simplify code
The wrappedHandler business is no longer needed (and maybe never was).
2026-04-30 22:14:26 +02:00
Stefan Haller e2e58e3811 Cleanup: remove obsolete code
Should have been deleted in b955002d17.
2026-04-30 22:14:26 +02:00
Stefan Haller 95c237fdbb Copy gocui into lazygit repo (#5561)
Over the past few months or even years, [Jesse's gocui
fork](https://github.com/jesseduffield/gocui) has become more and more
tied to lazygit; I have repeatedly made API-breaking changes to it
without caring much about what this means for other clients like
lazydocker or lazynpm (and Jesse was ok with that).

Given that situation, it no longer makes much sense to maintain it in a
standalone repo, so copy it into lazygit; this will greatly reduce the
friction of making changes to it. If/when the time comes to update those
other clients to also benefit from the improvements we make here, we can
always copy the files back to the gocui fork and resume it there.
2026-04-30 22:14:07 +02:00
Stefan Haller fd52adc752 Remove unused Parse/ParseAll and friends
We will provide better ones in lazygit later.
2026-04-30 22:11:57 +02:00
Stefan Haller 714a1baa43 Remove unused StartTicking and tickingMutex 2026-04-30 22:11:57 +02:00